Browse Source

特价商品限购

master
Lemon 5 years ago
parent
commit
04fc6b7ae9
  1. 9
      app/Service/v3/Implementations/ShopCartUpdateService.php

9
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();

Loading…
Cancel
Save