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 () {