正在显示
2 个修改的文件
包含
0 行增加
和
73 行删除
application/api/controller/Demo.php
已删除
100644 → 0
1 | -<?php | ||
2 | - | ||
3 | -namespace app\api\controller; | ||
4 | - | ||
5 | -use app\common\controller\Api; | ||
6 | - | ||
7 | -/** | ||
8 | - * 示例接口 | ||
9 | - */ | ||
10 | -class Demo extends Api | ||
11 | -{ | ||
12 | - | ||
13 | - //如果$noNeedLogin为空表示所有接口都需要登录才能请求 | ||
14 | - //如果$noNeedRight为空表示所有接口都需要验证权限才能请求 | ||
15 | - //如果接口已经设置无需登录,那也就无需鉴权了 | ||
16 | - // | ||
17 | - // 无需登录的接口,*表示全部 | ||
18 | - protected $noNeedLogin = ['test', 'test1']; | ||
19 | - // 无需鉴权的接口,*表示全部 | ||
20 | - protected $noNeedRight = ['test2']; | ||
21 | - | ||
22 | - /** | ||
23 | - * 测试方法 | ||
24 | - * | ||
25 | - * @ApiTitle (测试名称) | ||
26 | - * @ApiSummary (测试描述信息) | ||
27 | - * @ApiMethod (POST) | ||
28 | - * @ApiRoute (/api/demo/test/id/{id}/name/{name}) | ||
29 | - * @ApiHeaders (name=token, type=string, required=true, description="请求的Token") | ||
30 | - * @ApiParams (name="id", type="integer", required=true, description="会员ID") | ||
31 | - * @ApiParams (name="name", type="string", required=true, description="用户名") | ||
32 | - * @ApiParams (name="data", type="object", sample="{'user_id':'int','user_name':'string','profile':{'email':'string','age':'integer'}}", description="扩展数据") | ||
33 | - * @ApiReturnParams (name="code", type="integer", required=true, sample="0") | ||
34 | - * @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功") | ||
35 | - * @ApiReturnParams (name="data", type="object", sample="{'user_id':'int','user_name':'string','profile':{'email':'string','age':'integer'}}", description="扩展数据返回") | ||
36 | - * @ApiReturn ({ | ||
37 | - 'code':'1', | ||
38 | - 'msg':'返回成功' | ||
39 | - }) | ||
40 | - */ | ||
41 | - public function test() | ||
42 | - { | ||
43 | - $this->success('返回成功', $this->request->param()); | ||
44 | - } | ||
45 | - | ||
46 | - /** | ||
47 | - * 无需登录的接口 | ||
48 | - * | ||
49 | - */ | ||
50 | - public function test1() | ||
51 | - { | ||
52 | - $this->success('返回成功', ['action' => 'test1']); | ||
53 | - } | ||
54 | - | ||
55 | - /** | ||
56 | - * 需要登录的接口 | ||
57 | - * | ||
58 | - */ | ||
59 | - public function test2() | ||
60 | - { | ||
61 | - $this->success('返回成功', ['action' => 'test2']); | ||
62 | - } | ||
63 | - | ||
64 | - /** | ||
65 | - * 需要登录且需要验证有相应组的权限 | ||
66 | - * | ||
67 | - */ | ||
68 | - public function test3() | ||
69 | - { | ||
70 | - $this->success('返回成功', ['action' => 'test3']); | ||
71 | - } | ||
72 | - | ||
73 | -} |
此 diff 太大无法显示。
-
请 注册 或 登录 后发表评论