调整大礼包限购
This commit is contained in:
parent
65da0fbcfe
commit
27531c6931
@ -161,7 +161,8 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
|||||||
if ($presellType == 2)
|
if ($presellType == 2)
|
||||||
$down_price = bcadd($down_price, bcmul($cart['cart_num'], $cart['productPresellAttr']['down_price'], 2), 2);
|
$down_price = bcadd($down_price, bcmul($cart['cart_num'], $cart['productPresellAttr']['down_price'], 2), 2);
|
||||||
}
|
}
|
||||||
if ($cart['product']['type'] == 1 && $isPlatformCard) {
|
//商品中包含了大礼包,不允许使用优惠券
|
||||||
|
if ($isPlatformCard) {
|
||||||
$enabledPlatformCoupon = false;
|
$enabledPlatformCoupon = false;
|
||||||
$enabledCoupon = false;
|
$enabledCoupon = false;
|
||||||
}
|
}
|
||||||
@ -1511,32 +1512,33 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
|||||||
*/
|
*/
|
||||||
public function checkBuyLimit($carts, $uid)
|
public function checkBuyLimit($carts, $uid)
|
||||||
{
|
{
|
||||||
$isPlatformCard = false;
|
$hasPlatformCard = false;
|
||||||
foreach ($carts as $cart) {
|
foreach ($carts as $cart) {
|
||||||
if ($cart['product']->isPlatformCard() && !$isPlatformCard) {
|
if ($cart['product']->isPlatformCard() && !$hasPlatformCard) {
|
||||||
$isPlatformCard = true;
|
$hasPlatformCard = true;
|
||||||
}
|
break;
|
||||||
if ($cart['product']->isPlatformCard()) {
|
|
||||||
$merchantTypeId = Merchant::where('uid', $uid)->value('type_id');
|
|
||||||
if (empty($merchantTypeId) || $merchantTypeId != 21) {
|
|
||||||
throw new ValidateException('大礼包仅限种养殖户购买');
|
|
||||||
}
|
|
||||||
//平台购物卡仅能购买一次
|
|
||||||
$productIds = ProductCate::where('mer_cate_id', env('PLATFORM_CARD_CATE_ID'))->column('product_id');
|
|
||||||
$orderRecord = StoreOrder::alias('t1')
|
|
||||||
->leftJoin('store_order_product t2', 't1.order_id = t2.order_id')
|
|
||||||
->whereIn('product_id', $productIds)
|
|
||||||
->where('t1.uid', $uid)
|
|
||||||
->where('is_del', 0)
|
|
||||||
->where('is_system_del', 0)
|
|
||||||
->where('status', '<>', Enum::STATUS_REFUNDED)
|
|
||||||
->count();
|
|
||||||
if ($orderRecord > 0) {
|
|
||||||
throw new ValidateException('大礼包仅能购买一次');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $isPlatformCard;
|
if ($hasPlatformCard) {
|
||||||
|
$merchantTypeId = Merchant::where('uid', $uid)->value('type_id');
|
||||||
|
if (empty($merchantTypeId) || $merchantTypeId != 21) {
|
||||||
|
throw new ValidateException('大礼包仅限种养殖户购买');
|
||||||
|
}
|
||||||
|
//平台购物卡仅能购买一次
|
||||||
|
$productIds = ProductCate::where('mer_cate_id', env('PLATFORM_CARD_CATE_ID'))->column('product_id');
|
||||||
|
$orderRecord = StoreOrder::alias('t1')
|
||||||
|
->leftJoin('store_order_product t2', 't1.order_id = t2.order_id')
|
||||||
|
->whereIn('product_id', $productIds)
|
||||||
|
->where('t1.uid', $uid)
|
||||||
|
->where('is_del', 0)
|
||||||
|
->where('is_system_del', 0)
|
||||||
|
->where('status', '<>', Enum::STATUS_REFUNDED)
|
||||||
|
->count();
|
||||||
|
if ($orderRecord > 0) {
|
||||||
|
throw new ValidateException('大礼包仅能购买一次');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $hasPlatformCard;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user