diff --git a/app/api/controller/order/CartController.php b/app/api/controller/order/CartController.php index 7c74e03f..0f0346d9 100644 --- a/app/api/controller/order/CartController.php +++ b/app/api/controller/order/CartController.php @@ -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个,请先结算'); diff --git a/app/store/controller/cart/CartController.php b/app/store/controller/cart/CartController.php index 1e3ae32f..ae4587ee 100644 --- a/app/store/controller/cart/CartController.php +++ b/app/store/controller/cart/CartController.php @@ -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个,请先结算');