收银台限制
This commit is contained in:
parent
e80caaed6b
commit
f5dc2f7331
@ -4,6 +4,7 @@ namespace app\store\controller\cart;
|
|||||||
|
|
||||||
use app\api\logic\order\CartLogic;
|
use app\api\logic\order\CartLogic;
|
||||||
use app\api\validate\CartValidate;
|
use app\api\validate\CartValidate;
|
||||||
|
use app\common\model\store_branch_product\StoreBranchProduct;
|
||||||
use app\store\lists\cart\CartList;
|
use app\store\lists\cart\CartList;
|
||||||
use app\common\model\order\Cart;
|
use app\common\model\order\Cart;
|
||||||
use app\store\controller\BaseAdminController;
|
use app\store\controller\BaseAdminController;
|
||||||
@ -32,6 +33,14 @@ class CartController extends BaseAdminController
|
|||||||
if ($count > 100) {
|
if ($count > 100) {
|
||||||
return $this->fail('购物车商品不能大于100个,请先结算');
|
return $this->fail('购物车商品不能大于100个,请先结算');
|
||||||
}
|
}
|
||||||
|
//数量下单判断
|
||||||
|
$stock = StoreBranchProduct::where(
|
||||||
|
['product_id'=>$params['product_id'],
|
||||||
|
'store_id'=>$params['store_id']
|
||||||
|
])->value('stock')??0;
|
||||||
|
if ($params['cart_num'] >$stock) {
|
||||||
|
return $this->fail('库存数量不足');
|
||||||
|
}
|
||||||
if ($result) {
|
if ($result) {
|
||||||
$res = CartLogic::edit($params);
|
$res = CartLogic::edit($params);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user