From 0b99ced546ed6cab395918825f3b1221e8c2922a Mon Sep 17 00:00:00 2001 From: Lemon <15040771@qq.com> Date: Fri, 21 Aug 2020 17:24:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=B4=AD=E7=89=A9=E8=BD=A6?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=88=9D=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controller/PurchaseLimitController.php | 9 +++++++++ app/Service/PurchaseLimitService.php | 11 ++++++++++- app/Service/PurchaseLimitServiceInterface.php | 2 ++ config/routes.php | 1 + 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/app/Controller/PurchaseLimitController.php b/app/Controller/PurchaseLimitController.php index d56ca24..3f9abf7 100644 --- a/app/Controller/PurchaseLimitController.php +++ b/app/Controller/PurchaseLimitController.php @@ -26,4 +26,13 @@ class PurchaseLimitController extends BaseController return $this->success($res); } + public function updateShopCar() + { + $res = $this->purchaseLimitService->updateShopCar($this->request->all()); + if (!$res) { + return $this->result(ErrorCode::GOODS_FAILURE, '', '更新购物车失败'); + } + return $this->success($res); + } + } diff --git a/app/Service/PurchaseLimitService.php b/app/Service/PurchaseLimitService.php index c6b1ffe..88b3795 100644 --- a/app/Service/PurchaseLimitService.php +++ b/app/Service/PurchaseLimitService.php @@ -8,10 +8,19 @@ class PurchaseLimitService implements PurchaseLimitServiceInterface { public function addShopCar($params) { - if($params['goods_id'] == 1561){ + if($params['good_id'] == 1561){ return false; }else{ return '加入购物车成功'; } } + + public function updateShopCar($params) + { + if($params['good_id'] == 1561){ + return false; + }else{ + return '更新购物车成功'; + } + } } \ No newline at end of file diff --git a/app/Service/PurchaseLimitServiceInterface.php b/app/Service/PurchaseLimitServiceInterface.php index 03e6f08..79f3df3 100644 --- a/app/Service/PurchaseLimitServiceInterface.php +++ b/app/Service/PurchaseLimitServiceInterface.php @@ -7,4 +7,6 @@ namespace App\Service; interface PurchaseLimitServiceInterface { public function addShopCar($params); + + public function updateShopCar($params); } \ No newline at end of file diff --git a/config/routes.php b/config/routes.php index b2093b6..28f4299 100644 --- a/config/routes.php +++ b/config/routes.php @@ -57,6 +57,7 @@ Router::addGroup('/v1/',function (){ //加入购物车 Router::post('PurchaseLimit/addShopCar', 'App\Controller\PurchaseLimitController@addShopCar'); + Router::post('PurchaseLimit/updateShopCar', 'App\Controller\PurchaseLimitController@updateShopCar'); },['middleware' => [\App\Middleware\Auth\ApiMiddleware::class]]); Router::addGroup('/wechat/',function () {