diff --git a/app/common/dao/store/StoreActivityDao.php b/app/common/dao/store/StoreActivityDao.php index 66f21c0a..aea07da9 100644 --- a/app/common/dao/store/StoreActivityDao.php +++ b/app/common/dao/store/StoreActivityDao.php @@ -111,7 +111,7 @@ class StoreActivityDao extends BaseDao * 是否可购买活动商品 * @param $userId * @param $productId - * @return bool + * @return bool|int * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException @@ -123,7 +123,7 @@ class StoreActivityDao extends BaseDao if ($find && $activityId == 2) { return false; } - return true; + return $activityId; } /** diff --git a/app/common/repositories/store/order/StoreOrderCreateRepository.php b/app/common/repositories/store/order/StoreOrderCreateRepository.php index dcca4176..a6b3813a 100644 --- a/app/common/repositories/store/order/StoreOrderCreateRepository.php +++ b/app/common/repositories/store/order/StoreOrderCreateRepository.php @@ -85,7 +85,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository } foreach ($merchantCart['list'] as $cart) { $canBuy = (new StoreActivityDao())->canBuy($cart['uid'], $cart['product_id']); - if (!$canBuy) { + if (!$canBuy || ($canBuy == 2 && $cart['cart_num'] > 1)){ throw new ValidateException('活动商品限购1个'); } if ($cart['product_type'] == 0) {