Update.php
1.9 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
<?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']]);
}
}