From e9a92d5a09ea5c2e4ae9d128b46a3c93803d6840 Mon Sep 17 00:00:00 2001 From: weigang Date: Tue, 8 Sep 2020 19:08:11 +0800 Subject: [PATCH] FIxe --- app/Controller/v3/ShopCartController.php | 14 +++++++------- .../v3/Implementations/GoodsActivityService.php | 4 ++++ app/Service/v3/Implementations/GoodsService.php | 4 ++++ 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/app/Controller/v3/ShopCartController.php b/app/Controller/v3/ShopCartController.php index e82dc18..6241b15 100644 --- a/app/Controller/v3/ShopCartController.php +++ b/app/Controller/v3/ShopCartController.php @@ -20,13 +20,13 @@ class ShopCartController extends BaseController return $this->success($this->shopCartService->allForUser($userId, $marketId)); - //获取购物车商品信息 - $res['store_lists'] = $this->shopCartService->do($userId,$marketId); - //获取购物车失效商品信息 - $res['store_lists_invalid'] = $this->shopCartService->undo($userId,$marketId); - //计算购物车价格 - $res['total'] = $this->shopCartService->getTotal($userId,$marketId); - return $this->success($res); + // //获取购物车商品信息 + // $res['store_lists'] = $this->shopCartService->do($userId,$marketId); + // //获取购物车失效商品信息 + // $res['store_lists_invalid'] = $this->shopCartService->undo($userId,$marketId); + // //计算购物车价格 + // $res['total'] = $this->shopCartService->getTotal($userId,$marketId); + // return $this->success($res); } public function info() diff --git a/app/Service/v3/Implementations/GoodsActivityService.php b/app/Service/v3/Implementations/GoodsActivityService.php index 6c2279b..798497d 100644 --- a/app/Service/v3/Implementations/GoodsActivityService.php +++ b/app/Service/v3/Implementations/GoodsActivityService.php @@ -23,6 +23,10 @@ class GoodsActivityService implements GoodsActivityServiceInterface public function check(GoodsActivity $goods, $num, $userId) { + if (empty($goods)) { + return ErrorCode::GOODS_ACTIVITY_ON_SALE_NO; + } + // 活动是否已经结束 if ($goods->expire_time < time()) { return ErrorCode::GOODS_ACTIVITY_EXPIRED; diff --git a/app/Service/v3/Implementations/GoodsService.php b/app/Service/v3/Implementations/GoodsService.php index 2b4c282..ebe9eaa 100644 --- a/app/Service/v3/Implementations/GoodsService.php +++ b/app/Service/v3/Implementations/GoodsService.php @@ -20,6 +20,10 @@ class GoodsService implements GoodsServiceInterface public function check(Goods $goods,$num = 1) { + if (empty($goods)) { + return ErrorCode::GOODS_ON_SALE_NO; + } + // 商户歇业 if($goods->store->is_rest == 1){ return ErrorCode::GOODS_ON_SALE_NO;