起批价限制处理

This commit is contained in:
liu 2024-06-20 18:02:20 +08:00
parent 1a952e4c57
commit adbfdbd618
2 changed files with 19 additions and 0 deletions

View File

@ -25,6 +25,16 @@ class CartController extends BaseApiController
$params = (new CartValidate())->post()->goCheck('add');
$params['uid'] = $this->request->userId;
$result = Cart::where(['uid' => $params['uid'], 'store_id' => $params['store_id'], 'product_id' => $params['product_id'], 'is_fail' => 0, 'is_pay' => 0,'delete_time' => null])->find();
//判断起批发价
$batch = StoreBranchProduct::where(
['product_id'=>$params['product_id'],
'store_id' => $params['store_id']
]
)->value('batch');
if($params['cart_num'] < $batch){
return $this->fail('起批发量低于最低值'.$batch);
}
$count = Cart::where(['uid' => $params['uid'], 'delete_time' => null, 'is_pay' => 0])->count();
if ($count > 100) {
return $this->fail('购物车商品不能大于100个请先结算');

View File

@ -28,6 +28,15 @@ class CartController extends BaseAdminController
$params['staff_id'] = $adminInfo['admin_id'];
$params['store_id'] = $adminInfo['store_id'];
$result = Cart::where(['uid' => 0,'staff_id'=>$adminInfo['admin_id'], 'store_id' => $adminInfo['store_id'], 'product_id' => $params['product_id'], 'is_fail' => 0, 'is_pay' => 0])->find();
//判断起批发价
$batch = StoreBranchProduct::where(
['product_id'=>$params['product_id'],
'store_id' => $adminInfo['store_id']
]
)->value('batch');
if($params['cart_num'] < $batch){
return $this->fail('起批发量低于最低值'.$batch);
}
$count = Cart::where(['uid' => $params['uid'], 'is_pay' => 0])->count();
if ($count > 100) {
return $this->fail('购物车商品不能大于100个请先结算');