From 020e53a607bff3bff836ac39470de969db5b152f Mon Sep 17 00:00:00 2001 From: Lemon <15040771@qq.com> Date: Mon, 14 Sep 2020 19:30:23 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B4=AD=E7=89=A9=E8=BD=A6=E8=84=8F=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Service/v3/Implementations/ShopCartUpdateService.php | 6 ++++++ 1 file changed, 6 insertions(+) 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)){