From 04fc6b7ae9f27ba559efbd0789c8251d0345d58a Mon Sep 17 00:00:00 2001 From: Lemon <15040771@qq.com> Date: Fri, 18 Sep 2020 21:28:25 +0800 Subject: [PATCH] =?UTF-8?q?=E7=89=B9=E4=BB=B7=E5=95=86=E5=93=81=E9=99=90?= =?UTF-8?q?=E8=B4=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Service/v3/Implementations/ShopCartUpdateService.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/Service/v3/Implementations/ShopCartUpdateService.php b/app/Service/v3/Implementations/ShopCartUpdateService.php index 3a40bde..2e7f1a7 100644 --- a/app/Service/v3/Implementations/ShopCartUpdateService.php +++ b/app/Service/v3/Implementations/ShopCartUpdateService.php @@ -44,6 +44,15 @@ class ShopCartUpdateService implements ShopCartUpdateServiceInterface if(empty($goods)){ throw new ErrorCodeException(ErrorCode::GOODS_NOT_EXISTS); } + //特价商品限购 + $goodsArr = ShoppingCart::query() + ->where(['user_id' => $userId,'market_id' => $goods->market_id,'activity_type' => GoodsConstants::IS_ACTIVITY]) + ->pluck('goods_id')->toArray(); + array_push($goodsArr,$goodsId); + $checkGoodsActivity = $this->goodsActivityService->checkOrderActivityCount($goodsArr); + if(!$checkGoodsActivity){ + throw new ErrorCodeException(ErrorCode::GOODS_ACTIVITY_BUY); + } $goodsCheck = $this->goodsActivityService->check($goods,$num,$userId); }else{ $builder = Goods::query();