diff --git a/app/api/controller/order/CartController.php b/app/api/controller/order/CartController.php index 9253aaa09..c5f070326 100644 --- a/app/api/controller/order/CartController.php +++ b/app/api/controller/order/CartController.php @@ -40,12 +40,14 @@ class CartController extends BaseApiController if ($params['cart_num'] < $branchProduct['batch']) { return $this->fail('起批发量低于最低值' . $branchProduct['batch']); } - // if ($params['cart_num']<1) { - // $is_bulk = StoreProductUnit::where('id', $branchProduct['unit'])->value('is_bulk'); - // if ($is_bulk == 0) { - // return $this->fail('非计量商品,不能有小数'); - // } - // } + + if (convertNumber($params['cart_num']) === false) { + $is_bulk = StoreProductUnit::where('id', $branchProduct['unit'])->value('is_bulk'); + if ($is_bulk == 0) { + return $this->fail('非计量商品,不能有小数,请编辑购物车'); + } + + } //数量下单判断 $count = Cart::where(['uid' => $params['uid'], 'delete_time' => null, 'is_pay' => 0])->count(); diff --git a/app/store/controller/cart/CartController.php b/app/store/controller/cart/CartController.php index 3f4641e2f..29d3cf937 100644 --- a/app/store/controller/cart/CartController.php +++ b/app/store/controller/cart/CartController.php @@ -43,10 +43,10 @@ class CartController extends BaseAdminController if ($count > 100) { return $this->fail('购物车商品不能大于100个,请先结算'); } - if ($params['cart_num'] < 1) { + if (convertNumber($params['cart_num']) === false) { $is_bulk = StoreProductUnit::where('id', $branchProduct['unit'])->value('is_bulk'); if ($is_bulk == 0) { - return $this->fail('非计量商品,不能有小数'); + return $this->fail('非计量商品,不能有小数,请编辑购物车'); } } //数量下单判断