From 78e013a1fe6849871f1265d5a035ef0eb99f0198 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Tue, 23 Jan 2024 12:29:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../order/StoreOrderCreateRepository.php | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/app/common/repositories/store/order/StoreOrderCreateRepository.php b/app/common/repositories/store/order/StoreOrderCreateRepository.php index fc91d364..c4c72d1f 100644 --- a/app/common/repositories/store/order/StoreOrderCreateRepository.php +++ b/app/common/repositories/store/order/StoreOrderCreateRepository.php @@ -85,16 +85,6 @@ class StoreOrderCreateRepository extends StoreOrderRepository } } foreach ($merchantCart['list'] as $cart) { - $canBuy = (new StoreActivityDao())->canBuy($cart['uid'], $cart['product_id']); - if (!$canBuy) { - throw new ValidateException('活动商品限购1个'); - } - if ($canBuy == 2) { - $activityProductCount += $cart['cart_num']; - if ($activityProductCount > 1){ - throw new ValidateException('活动商品限购1个'); - } - } 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) . '...'); @@ -112,6 +102,18 @@ class StoreOrderCreateRepository extends StoreOrderRepository $order_type = $cart['product_type']; } $source = $cart['source']; + if($source==103){ + $canBuy = (new StoreActivityDao())->canBuy($cart['uid'], $cart['product_id']); + if (!$canBuy) { + throw new ValidateException('活动商品限购1个'); + } + if ($canBuy == 2) { + $activityProductCount += $cart['cart_num']; + if ($activityProductCount > 1){ + throw new ValidateException('活动商品限购1个'); + } + } + } if ($cart['product_type'] <= 97 && $cart['product_type'] > 0 && (($cart['product_type'] != 10 && count($merchantCart['list']) != 1) || count($merchantCartList) != 1)) { throw new ValidateException('活动商品必须单独购买'); }