From 234a9b084bcdd1e8b19071058dea1fc98e2c52e5 Mon Sep 17 00:00:00 2001 From: wuhui_zzw <1760308791@qq.com> Date: Tue, 4 Jun 2024 13:32:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=E9=85=92=E9=81=93?= =?UTF-8?q?=E9=A6=86=E8=BF=9B=E8=B4=A7=20=20=E6=89=B9=E9=87=8F=E8=BF=9B?= =?UTF-8?q?=E8=B4=A7=E6=97=B6=E4=BB=B7=E6=A0=BC=E5=92=8C=E6=95=B0=E9=87=8F?= =?UTF-8?q?=E8=AE=A1=E7=AE=97=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../repositories/store/order/StoreOrderCreateRepository.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/common/repositories/store/order/StoreOrderCreateRepository.php b/app/common/repositories/store/order/StoreOrderCreateRepository.php index 107ad6b..ebc440b 100644 --- a/app/common/repositories/store/order/StoreOrderCreateRepository.php +++ b/app/common/repositories/store/order/StoreOrderCreateRepository.php @@ -82,6 +82,12 @@ class StoreOrderCreateRepository extends StoreOrderRepository{ //检查商品类型, 活动商品只能单独购买 foreach($merchantCartList as $merchantCart){ foreach($merchantCart['list'] as $cart){ + // 判断:是否按照批量购买 批量购买修改购买数量 + if($cart['is_batch'] == 1){ + $batch_num = $cart['batch_num'] ?? 1; + $cart['cart_num'] = (float)sprintf("%.2f", $batch_num * $cart['cart_num']); + } + if($cart['product_type'] == 0){ if($cart['product']['once_min_count'] > 0 && $cart['product']['once_min_count'] > $cart['cart_num']) throw new ValidateException('[低于起购数:'.$cart['product']['once_min_count'].']'.mb_substr($cart['product']['store_name'],0,10).'...'); if($cart['product']['pay_limit'] == 1 && $cart['product']['once_max_count'] < $cart['cart_num']) throw new ValidateException('[超出单次限购数:'.$cart['product']['once_max_count'].']'.mb_substr($cart['product']['store_name'],0,10).'...');