作者 耿培杰

添加购物车数量接口

@@ -20,6 +20,26 @@ class Car extends Api @@ -20,6 +20,26 @@ class Car extends Api
20 $this->carModel = new \app\api\model\Car; 20 $this->carModel = new \app\api\model\Car;
21 } 21 }
22 22
  23 + /**
  24 + * @ApiTitle (获取购物车数量)
  25 + * @ApiSummary (获取购物车数量)
  26 + * @ApiMethod (POST)
  27 + * @ApiRoute (/api/car/getCarNumber)
  28 + * @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
  29 + * @ApiReturn({
  30 + "code": 1,
  31 + "msg": "SUCCESS",
  32 + "time": "1587610459",
  33 + "data": 1 购物车数量
  34 + })
  35 + */
  36 + public function getCarNumber(){
  37 + $userId = $this->getUserId();
  38 + $where['user_id'] = $userId;
  39 +
  40 + $data = $this->carModel->where($where)->count();
  41 + $this->success('SUCCESS',$data);
  42 + }
23 43
24 /** 44 /**
25 * @ApiTitle (获取购物车列表) 45 * @ApiTitle (获取购物车列表)
此 diff 太大无法显示。