调整首页接口和返回数据
This commit is contained in:
@@ -65,14 +65,6 @@ class OrderBuyController extends Controller
|
||||
}
|
||||
|
||||
|
||||
$areaCode = $user->info->areaCode;
|
||||
if (! $areaCode) {
|
||||
return $this->failed('您没有提货码不可参与此活动');
|
||||
}
|
||||
if ($areaCode->status != AreaCode::STATUS_INIT) {
|
||||
return $this->failed('提货码已被使用,不可重复使用');
|
||||
}
|
||||
|
||||
$address_id = $request->address_id;
|
||||
if ($address_id) {
|
||||
$address = Address::find($address_id);
|
||||
@@ -93,6 +85,14 @@ class OrderBuyController extends Controller
|
||||
$type = OrderModel::TYPE_SCORE;
|
||||
}
|
||||
|
||||
$areaCode = $user->info->areaCode;
|
||||
if (! $areaCode && $type == OrderModel::TYPE_SAMPLE) {
|
||||
return $this->failed('您没有提货码不可参与此活动');
|
||||
}
|
||||
if ($areaCode->status != AreaCode::STATUS_INIT && $type == OrderModel::TYPE_SAMPLE) {
|
||||
return $this->failed('提货码已被使用,不可重复使用');
|
||||
}
|
||||
|
||||
$freight = $item->freight();
|
||||
$amount = $item->total();
|
||||
$weight = $item->weight();
|
||||
@@ -154,14 +154,6 @@ class OrderBuyController extends Controller
|
||||
$qty = $request->qty;
|
||||
$share_user_id = $request->share_user_id ?? 0;
|
||||
|
||||
$areaCode = $user->info->areaCode;
|
||||
if (! $areaCode) {
|
||||
return $this->failed('您没有提货码不可参与此活动');
|
||||
}
|
||||
if ($areaCode->status != AreaCode::STATUS_INIT) {
|
||||
return $this->failed('提货码已被使用,不可重复使用');
|
||||
}
|
||||
|
||||
|
||||
$detail = collect();
|
||||
|
||||
@@ -187,6 +179,14 @@ class OrderBuyController extends Controller
|
||||
$type = OrderModel::TYPE_SCORE;
|
||||
}
|
||||
|
||||
$areaCode = $user->info->areaCode;
|
||||
if (! $areaCode && $type == OrderModel::TYPE_SAMPLE) {
|
||||
return $this->failed('您没有提货码不可参与此活动');
|
||||
}
|
||||
if ($areaCode->status != AreaCode::STATUS_INIT && $type == OrderModel::TYPE_SAMPLE) {
|
||||
return $this->failed('提货码已被使用,不可重复使用');
|
||||
}
|
||||
|
||||
$address = Address::where('user_id', $user->id)->where('id', $address_id)->first();
|
||||
|
||||
if (in_array($type, [OrderModel::TYPE_SCORE, OrderModel::TYPE_NORMAL]) && ! $address) {
|
||||
|
||||
@@ -64,15 +64,15 @@ class OrderController extends Controller
|
||||
}, function ($query) {
|
||||
$query->common();
|
||||
})
|
||||
// ->when($type, function ($q) use ($type) {
|
||||
// if ($type == 'score') {
|
||||
// $q->TypeScore();
|
||||
// }
|
||||
//
|
||||
// if ($type == 'sample') {
|
||||
// $q->TypeSample();
|
||||
// }
|
||||
// })
|
||||
->when($type, function ($q) use ($type) {
|
||||
if ($type == 'score') {
|
||||
$q->TypeScore();
|
||||
}
|
||||
|
||||
if ($type == 'sample') {
|
||||
$q->TypeSample();
|
||||
}
|
||||
})
|
||||
->paginate();
|
||||
|
||||
return $this->success(new OrderCollection($list));
|
||||
|
||||
Reference in New Issue
Block a user