Update.php
5.7 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
<?php
namespace app\api\controller;
use app\common\controller\Api;
use think\Db;
/**
* 改版接口
*/
class Update extends Api
{
protected $noNeedLogin = ['*'];
protected $noNeedRight = '*';
/**
* 改版接口
* @ApiTitle (token换UserId)
* @ApiSummary (token换UserId)
* @ApiMethod (POST)
* @ApiRoute (/api/Update/TokenToUser)
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
* @ApiReturnParams (name="code", type="integer", required=true, sample="0")
* @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功")
* @ApiReturn ({
'code':'1',
'msg':'返回成功',
"data": 29 用户UserID
})
*/
public function TokenToUser()
{
$UserId = $this->is_token($this->request->header());
$this->success('成功', $UserId);
}
/**
* 改版接口
* @ApiTitle (被邀请页)
* @ApiSummary (被邀请页)
* @ApiMethod (POST)
* @ApiRoute (/api/Update/InviteHtml)
* @ApiParams (name="user_id", type="int", required=true, description="用户UserID")
* @ApiReturnParams (name="code", type="integer", required=true, sample="0")
* @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功")
* @ApiReturn ({
'code':'1',
'msg':'返回成功',
"data": {
"Nickname": "允安",
"Avatar": "https://thirdwx.qlogo.cn/mmopen/vi_32/PiajxSqBRaEKRz8aJsbiaEwSkCamJBVEx05Y9IHhic7qpd5AK7uQJv8fia6QPXnCBaTFpXxF0Epml7u8K1TybnSwVA/132"
}
})
*/
public function InviteHtml()
{
$UserId = input('user_id');
$Info = Db::name('user')->where('id', $UserId)->find();
if (empty($Info)) {
$this->error('网络异常', 0);
}
$this->success('成功', ['Nickname' => $Info['nickname'], 'Avatar' => $Info['avatar']]);
}
/**
* 改版接口
* @ApiTitle (支付后分享内容)
* @ApiSummary (支付后分享内容)
* @ApiMethod (POST)
* @ApiRoute (/api/Update/AfterPayWindow)
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
* @ApiReturnParams (name="code", type="integer", required=true, sample="0")
* @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功")
* @ApiReturn ({
'code':'1',
'msg':'返回成功',
"data": {
"title": "点击领取榴莲味儿的鸡蛋仔送你的免费能量测试及健康礼券",
"image": "http://xm-public.xyslife.com/life2c/20210106/FmpUPCk0MZAmKJ-LHaKzNwvCdhJk.jpg"
}
}
})
*/
public function AfterPayWindow()
{
$UserId = $this->is_token($this->request->header());
$UserInfo = Db::name('user')->where('id', $UserId)->find();
$Info = Db::name('pay_miniappfriends')->find();
$this->success('成功', ['title' => '点击领取' . $UserInfo['nickname'] . '送你的' . $Info['title'], 'image' => cdnurl($Info['image'])]);
}
/**
* 改版接口
* @ApiTitle (氧气泡泡使用规则)
* @ApiSummary (氧气泡泡使用规则)
* @ApiMethod (POST)
* @ApiRoute (/api/Update/WaterOOGroup)
* @ApiReturnParams (name="code", type="integer", required=true, sample="0")
* @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功")
* @ApiReturn ({
'code':'1',
'msg':'返回成功',
"data": {
"id": 1,
"content": "<p><span style=\"color: rgb(255, 192, 0);\"><strong>使用条件:</strong></span></p><ol class=\" list-paddingleft-2\" style=\"list-style-type: decimal;\"><li><p>订单金额≥199元</p></li><li><p>氧气泡泡≥100元</p></li></ol><p> 氧气泡泡支付不得超过每笔订单应付金额的20%<br/></p><p><br/></p><p><span style=\"color: rgb(255, 192, 0);\"><strong>使用数量</strong></span></p><p> 1.100氧气泡泡=1元<br/></p><p> 2.可兑换到分位,例如102氧气泡泡=1.02元<br/></p>"
}
}
})
*/
public function WaterOOGroup()
{
$Info = Db::name('warter_content')->find();
$this->success('成功', $Info);
}
/**
* 改版接口
* @ApiTitle (用户获取一张优惠券)
* @ApiSummary (用户获取一张优惠券)
* @ApiMethod (POST)
* @ApiRoute (/api/Update/InserUserTick)
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
* @ApiReturnParams (name="code", type="integer", required=true, sample="0")
* @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功")
* @ApiReturn ({
'code':'1',
'msg':'返回成功',
}
})
*/
public function InserUserTick()
{
$UserId = $this->is_token($this->request->header());
$TickInfo = Db::name('tick')->find();
$data = [
'user_id' => $UserId,
'exp_time' => time() + $TickInfo['you_time'] * 86400,
'createtime' => time(),
'status' => 0
];
$Res = Db::name('user_tick')->insert($data);
$this->Res($Res);
}
/**
* 改版接口
* @ApiTitle (下单选择优惠券页面)
* @ApiSummary (下单选择优惠券页面)
* @ApiMethod (POST)
* @ApiRoute (/api/Update/ThinkUserTick)
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
* @ApiReturnParams (name="code", type="integer", required=true, sample="0")
* @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功")
* @ApiReturn ({
'code':'1',
'msg':'返回成功',
}
})
*/
}