调整活动商品限购
This commit is contained in:
parent
cc8562411c
commit
566808e9d0
@ -111,7 +111,7 @@ class StoreActivityDao extends BaseDao
|
|||||||
* 是否可购买活动商品
|
* 是否可购买活动商品
|
||||||
* @param $userId
|
* @param $userId
|
||||||
* @param $productId
|
* @param $productId
|
||||||
* @return bool
|
* @return bool|int
|
||||||
* @throws \think\db\exception\DataNotFoundException
|
* @throws \think\db\exception\DataNotFoundException
|
||||||
* @throws \think\db\exception\DbException
|
* @throws \think\db\exception\DbException
|
||||||
* @throws \think\db\exception\ModelNotFoundException
|
* @throws \think\db\exception\ModelNotFoundException
|
||||||
@ -123,7 +123,7 @@ class StoreActivityDao extends BaseDao
|
|||||||
if ($find && $activityId == 2) {
|
if ($find && $activityId == 2) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return $activityId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -85,7 +85,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
|||||||
}
|
}
|
||||||
foreach ($merchantCart['list'] as $cart) {
|
foreach ($merchantCart['list'] as $cart) {
|
||||||
$canBuy = (new StoreActivityDao())->canBuy($cart['uid'], $cart['product_id']);
|
$canBuy = (new StoreActivityDao())->canBuy($cart['uid'], $cart['product_id']);
|
||||||
if (!$canBuy) {
|
if (!$canBuy || ($canBuy == 2 && $cart['cart_num'] > 1)){
|
||||||
throw new ValidateException('活动商品限购1个');
|
throw new ValidateException('活动商品限购1个');
|
||||||
}
|
}
|
||||||
if ($cart['product_type'] == 0) {
|
if ($cart['product_type'] == 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user