UserCommissionApply.php
3.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<?php
namespace app\api\controller;
use addons\shopro\model\User;
/**
* 佣金提现接口
*/
class UserCommissionApply extends Base
{
protected $noNeedLogin = [''];
protected $noNeedRight = ['*'];
/**
* @ApiWeigh (99)
* @ApiTitle (提现记录)
* @ApiSummary (提现记录)
* @ApiMethod (GET)
*
* @ApiHeaders (name=token, type=string, required=true, description="请求的token")
*
* @ApiReturn({
"code": 1,
"msg": "提现记录",
"time": "1608987808",
"data": [{
"id": 1, //提现ID
"user_id": 1, //用户ID
"money": "10.00", //提现金额
"status": 0, //提现状态:0=申请中,1=已打款,-1=已拒绝
"status_msg": null, //驳回理由
"createtime": "2020/12/27", //申请时间
"updatetime": 1608987492,
"deletetime": null,
"avatar": "https://thirdwx.qlogo.cn/mmopen/vi_32/C8dW9GFDHAy3wwnZwoqibeNciaN6jUZXp6QCrtjehdF3GyHickt9oiaDSibMBhATtF7f19w4AgpcQIR1Mibwu1pjYKEA/132", //头像地址
"nickname": "wn", //昵称
"status_name": "申请处理中", //状态注释
"status_text": "申请处理中" //状态注释
}]
})
*/
public function index()
{
$this->success('提现记录', \app\api\model\UserCommissionApply::getList());
}
/**
* @ApiWeigh (97)
* @ApiTitle (申请提现)
* @ApiSummary (申请提现)
* @ApiMethod (POST)
*
* @ApiHeaders (name=token, type=string, required=true, description="请求的token")
* @ApiParams (name=money, type=string, required=true, description="提现金额")
*
* @ApiReturn({
"code": 1,
"msg": "申请成功",
"time": "1608987492",
"data": {
"user_id": 1, //用户ID
"money": "10", //提现金额
"status": 0, //提现状态:0=申请中,1=已打款,-1=已拒绝
"createtime": 1608987492, //申请时间
"updatetime": 1608987492,
"id": "1", //ID
"status_name": "申请处理中", //状态注释
"status_text": "申请处理中" //状态注释
}
})
*/
public function apply () {
$params = $this->request->post();
$this->success('申请成功', \app\api\model\UserCommissionApply::apply($params));
}
/**
* @ApiWeigh (95)
* @ApiTitle (待提现&审核中)
* @ApiSummary (待提现&审核中)
* @ApiMethod (GET)
*
* @ApiHeaders (name=token, type=string, required=true, description="请求的token")
*
* @ApiReturn({
"code": 1,
"msg": "申请成功",
"time": "1609140783",
"data": {
"wait_apply": 90, //待提现
"ing_apply": 0 //审核中
}
})
*/
public function commission () {
$wait_apply = (float)\addons\shopro\model\User::where('id',$this->auth->id)->value('commission');
$ing_apply = \app\api\model\UserCommissionApply::where(['user_id' => $this->auth->id,'status'=>0])->sum('money');
$this->success('申请成功', compact('wait_apply','ing_apply'));
}
}