Browse Source

更新购物车接口初始化

master
Lemon 6 years ago
parent
commit
0b99ced546
  1. 9
      app/Controller/PurchaseLimitController.php
  2. 11
      app/Service/PurchaseLimitService.php
  3. 2
      app/Service/PurchaseLimitServiceInterface.php
  4. 1
      config/routes.php

9
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);
}
}

11
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 '更新购物车成功';
}
}
}

2
app/Service/PurchaseLimitServiceInterface.php

@ -7,4 +7,6 @@ namespace App\Service;
interface PurchaseLimitServiceInterface
{
public function addShopCar($params);
public function updateShopCar($params);
}

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

Loading…
Cancel
Save