From 3f00f243348a078c2d73abfc1b6a2548e3086912 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Mon, 26 Aug 2024 20:00:51 +0800 Subject: [PATCH] =?UTF-8?q?feat(cart):=20=E4=BC=98=E5=8C=96=E8=B4=AD?= =?UTF-8?q?=E7=89=A9=E8=BD=A6=E5=95=86=E5=93=81=E6=95=B0=E9=87=8F=E5=88=A4?= =?UTF-8?q?=E6=96=AD=E9=80=BB=E8=BE=91=EF=BC=8C=E5=A2=9E=E5=8A=A0=E9=9D=9E?= =?UTF-8?q?=E8=AE=A1=E9=87=8F=E5=95=86=E5=93=81=E5=B0=8F=E6=95=B0=E5=88=A4?= =?UTF-8?q?=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/order/CartController.php | 14 ++++++++------ app/store/controller/cart/CartController.php | 4 ++-- 2 files changed, 10 insertions(+), 8 deletions(-) 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('非计量商品,不能有小数,请编辑购物车'); } } //数量下单判断