diff --git a/app/Service/v3/Implementations/ShopCartUpdateService.php b/app/Service/v3/Implementations/ShopCartUpdateService.php index 7b69881..8ec7769 100644 --- a/app/Service/v3/Implementations/ShopCartUpdateService.php +++ b/app/Service/v3/Implementations/ShopCartUpdateService.php @@ -34,11 +34,17 @@ class ShopCartUpdateService implements ShopCartUpdateServiceInterface $builder = GoodsActivity::query(); $goodsType = GoodsActivity::class; $goods = $builder->find($goodsId); + if(empty($goods)){ + throw new ErrorCodeException(ErrorCode::GOODS_NOT_EXISTS); + } $goodsCheck = $this->goodsActivityService->check($goods,$num,$userId); }else{ $builder = Goods::query(); $goodsType = Goods::class; $goods = $builder->find($goodsId); + if(empty($goods)){ + throw new ErrorCodeException(ErrorCode::GOODS_NOT_EXISTS); + } $goodsCheck = $this->goodsService->check($goods,$num); } if(empty($goods)){