调整活动商品限购
This commit is contained in:
parent
8386b526a6
commit
908968961c
@ -77,6 +77,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
$order_extend = [];
|
||||
//检查商品类型, 活动商品只能单独购买
|
||||
$allowDelivery = true;
|
||||
$activityProductCount = 0;
|
||||
foreach ($merchantCartList as $merchantCart) {
|
||||
if (($merchantCart['type_id'] != Merchant::TypeSupplyChain) && $address) {
|
||||
if ($merchantCart['street_id'] != $address['street_code'] && $createOrder && !in_array($merchantCart['mer_id'], $takes)) {
|
||||
@ -85,9 +86,15 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
}
|
||||
foreach ($merchantCart['list'] as $cart) {
|
||||
$canBuy = (new StoreActivityDao())->canBuy($cart['uid'], $cart['product_id']);
|
||||
if (!$canBuy || ($canBuy == 2 && $cart['cart_num'] > 1)){
|
||||
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) . '...');
|
||||
|
Loading…
x
Reference in New Issue
Block a user