作者 耿培杰

修改购物车接口

... ... @@ -237,4 +237,29 @@ class Car extends Api
if ($res) $this->success('SUCCESS');
else $this->error('ERROR');
}
/**
* @ApiTitle (删除购物车)
* @ApiSummary (删除购物车)
* @ApiMethod (POST)
* @ApiRoute (/api/car/delCar)
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
* @ApiParams (name=car_id, type=string, required=true, description="购物车id 批量1,2,3")
* @ApiReturn({
"code": 1,
"msg": "SUCCESS",
"time": "1587472510",
"data": {
}
})
*/
public function delCar(){
$userId = $this->getUserId();
$car_id = $this->request->param('car_id');
if (empty($car_id)) $this->error('缺少参数 car_id!');
$res = $this->carModel->where(['id'=>['in',$car_id]])->delete();
if ($res) $this->success('SUCCESS');
else $this->error('ERROR');
}
}
... ...
... ... @@ -141,15 +141,23 @@ class Member extends Api
* @ApiRoute (/api/member/getMoneyLog)
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
* @ApiParams (name=date, type=string, required=true, description="日期 例2020-2-1")
* @ApiParams (name=type, type=string, required=false, description="类型:1=支出,2=收入")
* @ApiParams (name=page, type=string, required=true, description="页数")
* @ApiReturn({
"code": 1,
"msg": "SUCCESS",
"time": "1587361014",
"data": {
"user_id": 1, 用户id
"nickname": "admin1", 昵称
"avatar": "http://q7s0a1rb4.bkt.clouddn.com/assets/img/qrcode.png", 头像
"data":
"total": 3,
"list": [
{
"money": "145.50",
"after": "9769.25",
"type": "3", 类型:1=提现,2=充值,3=购物消费,4=佣金收入,5=工资发放,6=退款
"createtime": "2020-05-11 16:07",
"type_text": "购物消费"
}
},
}
})
*/
... ... @@ -159,6 +167,7 @@ class Member extends Api
$userId = $this->getUserId();
$page = $this->request->param('page');
$date = $this->request->param('date');
$type = $this->request->param('type');
$limit = Config::get('paginate.index_rows');
... ... @@ -170,6 +179,11 @@ class Member extends Api
$betweenTime = [$date, $lastDate];
}
if (!empty($type)){
if ($type == 1) $where['type'] = ['in','1,3'];
else $where['type'] = ['in','2,4,5,6'];
}
$where['user_id'] = $userId;
$data = $model->selectPageData($where, $page, $limit, $betweenTime);
... ... @@ -184,6 +198,7 @@ class Member extends Api
* @ApiRoute (/api/member/getScoreLog)
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
* @ApiParams (name=date, type=string, required=true, description="日期 例2020-2-1")
* @ApiParams (name=type, type=string, required=false, description="类型:1=支出,2=收入")
* @ApiParams (name=page, type=string, required=true, description="页数")
* @ApiReturn({
"code": 1,
... ... @@ -195,7 +210,7 @@ class Member extends Api
{
"score": "10.00", 变更积分
"after": "10.00", 变更后积分
"type": "type",
"type": "type", //类型:1=购物返积分,2=积分商城兑换
"createtime": "2020-04-20 16:13"
}
]
... ... @@ -208,6 +223,7 @@ class Member extends Api
$userId = $this->getUserId();
$page = $this->request->param('page');
$date = $this->request->param('date');
$type = $this->request->param('type');
$limit = Config::get('paginate.index_rows');
$betweenTime = ['1970-1-1', date('Y-m-d')];
if ($date) {
... ... @@ -216,7 +232,10 @@ class Member extends Api
$lastDate = $dateArr[0] . '-' . $dateArr[1] . '-' . $lastDay;
$betweenTime = [$date, $lastDate];
}
if (!empty($type)){
if ($type == 1) $where['type'] = 2;
else $where['type'] = 1;
}
$where['user_id'] = $userId;
$data = $model->selectPageData($where, $page, $limit, $betweenTime);
... ...
此 diff 太大无法显示。