添加大礼包限购
This commit is contained in:
parent
5b8d5e23ca
commit
0afaadb797
@ -3,6 +3,9 @@
|
||||
namespace app\common\repositories\store\order;
|
||||
|
||||
use app\common\dao\store\coupon\StoreCouponUserDao;
|
||||
use app\common\model\store\order\StoreOrder;
|
||||
use app\common\model\store\product\ProductCate;
|
||||
use app\common\model\system\merchant\Merchant;
|
||||
use app\common\repositories\system\form\FormRepository;
|
||||
use app\common\repositories\system\RecordRepository;
|
||||
use crmeb\jobs\SendSmsJob;
|
||||
@ -100,6 +103,27 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
}
|
||||
$product_cart = [];
|
||||
|
||||
//大礼包限购
|
||||
$isPlatformCard = $merchantCart['list'][0]['product']->isPlatformCard();
|
||||
if ($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('paid', 1)
|
||||
->where('is_refund', 0)
|
||||
->count();
|
||||
if ($orderRecord > 0) {
|
||||
throw new ValidateException('大礼包仅能购买一次');
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($merchantCart['list'] as $k => $cart) {
|
||||
//获取订单商品支持的配送类型
|
||||
if ($cart['product']['delivery_way']) {
|
||||
@ -144,7 +168,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
if ($presellType == 2)
|
||||
$down_price = bcadd($down_price, bcmul($cart['cart_num'], $cart['productPresellAttr']['down_price'], 2), 2);
|
||||
}
|
||||
if ($cart['product']['type'] == 1 && !$cart['product']->isPlatformCard()) {
|
||||
if ($cart['product']['type'] == 1 && $isPlatformCard) {
|
||||
$enabledPlatformCoupon = false;
|
||||
$enabledCoupon = false;
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ class MerchantIntention extends BaseController
|
||||
public function lst()
|
||||
{
|
||||
[$page, $limit] = $this->getPage();
|
||||
$where = $this->request->params(['mer_name', 'status', 'date', 'keyword', 'mer_intention_id', 'category_id', 'type_id']);
|
||||
$where = $this->request->params(['mer_name', 'status', 'date', 'keyword', 'mer_intention_id', 'category_id', 'type_id', 'type']);
|
||||
return app('json')->success($this->repository->getList($where, $page, $limit));
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,7 @@ class StoreProductPresell extends BaseController
|
||||
public function lst()
|
||||
{
|
||||
[$page, $limit] = $this->getPage();
|
||||
$where = $this->request->params([['type',4],'star','mer_id']);
|
||||
$where = $this->request->params([['type',4],'star','mer_id', 'keyword']);
|
||||
return app('json')->success($this->repository->getApiList($where,$page, $limit));
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user