Thank.php
2.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
<?php
namespace app\api\controller;
use app\api\model\Price;
use app\common\controller\Api;
/**
* 答谢
*/
class Thank extends Api
{
// 无需登录的接口,*表示全部
protected $noNeedLogin = ['*'];
// 无需鉴权的接口,*表示全部
protected $noNeedRight = ['*'];
/**
* 支付下单
* @ApiTitle (支付下单)
* @ApiSummary (支付下单)
* @ApiMethod (POST)
* @ApiHeaders (name="token", type="string", required=true, description="请求的Token")
* @ApiParams (name="price", type="integer", required=true, description="价格")
* @ApiReturnParams (name="code", type="integer", required=true, sample="0")
* @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功")
* @ApiReturnParams (name="data", type="object", sample="{'user_id':'int','user_name':'string','profile':{'email':'string','age':'integer'}}", description="扩展数据返回")
* @ApiReturn ()
*/
public function pay()
{
$price = $this->request->param('price', 0, 'int');
if(!$price || $price <= 0) {
$this->error('您的操作有误');
}
}
/**
* 获取价目表
* @ApiTitle (获取价目表)
* @ApiSummary (获取价目表)
* @ApiMethod (POST)
* @ApiReturnParams (name="code", type="integer", required=true, sample="0")
* @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功")
* @ApiReturnParams (name="data", type="object", sample="{'user_id':'int','user_name':'string','profile':{'email':'string','age':'integer'}}", description="扩展数据返回")
* @ApiReturn ({
"code": 1,
"msg": "获取价目表成功",
"time": "1586398313",
"data": [
{
"id": 1,
"price": 1,
"weigh": 0,
"createtime": 0,
"updatetime": 0,
"deletetime": null,
"show_switch": 1
}
]
})
*/
public function getPriceList()
{
$price = new Price();
$priceList = $price->listAll();
$this->success('获取价目表成功', $priceList);
}
}