Showing
2 changed files
with
178 additions
and
0 deletions
This diff is collapsed. Click to expand it.
用户鉴权/README.md
0 → 100644
| 1 | +# boxfish用户认证系统 | ||
| 2 | + | ||
| 3 | +#### 测试环境部署地址 | ||
| 4 | + | ||
| 5 | +[http://114.55.58.184:8099/](http://114.55.58.184:8099/) | ||
| 6 | + | ||
| 7 | +#### 生产环境部署地址 | ||
| 8 | + | ||
| 9 | +[http\(s\)//base.boxfish.cn/passbook/](http://base.boxfish.cn/passbook/) | ||
| 10 | + | ||
| 11 | +认证接口 /user/auth | ||
| 12 | + | ||
| 13 | +#### 请求方式 | ||
| 14 | + | ||
| 15 | +POST 方法 | ||
| 16 | + | ||
| 17 | +#### 请求头信息 | ||
| 18 | + | ||
| 19 | +x-be-product com.boxfishedu.teacher \(必须包含 teacher or student \) | ||
| 20 | + | ||
| 21 | +#### 请求参数 | ||
| 22 | + | ||
| 23 | +* json | ||
| 24 | + ```json | ||
| 25 | + { | ||
| 26 | + "username":"username", | ||
| 27 | + "password":"password" | ||
| 28 | + } | ||
| 29 | + ``` | ||
| 30 | + | ||
| 31 | +#### 返回值 | ||
| 32 | + | ||
| 33 | +* 合法用户 | ||
| 34 | + http code 200 | ||
| 35 | + | ||
| 36 | + ```json | ||
| 37 | + { | ||
| 38 | + "id": 7566, | ||
| 39 | + "username": "b@b.cn", | ||
| 40 | + "access_token": "futT9nmvb5", | ||
| 41 | + "score":3801, | ||
| 42 | + "goal":100, | ||
| 43 | + "figure_url":"http://avatars.boxfish.cn/user/-12/figure/1411532427.jpg" | ||
| 44 | + } | ||
| 45 | + ``` | ||
| 46 | + | ||
| 47 | +* 用户不存在 | ||
| 48 | + http code 404 | ||
| 49 | + | ||
| 50 | + ```json | ||
| 51 | + { | ||
| 52 | + "msg": "用户不存在!" | ||
| 53 | + } | ||
| 54 | + ``` | ||
| 55 | + | ||
| 56 | +* 用户密码不正确 | ||
| 57 | + | ||
| 58 | + http code 401 | ||
| 59 | + | ||
| 60 | + ```json | ||
| 61 | + { | ||
| 62 | + "msg":"用户密码不正确!" | ||
| 63 | + } | ||
| 64 | + ``` | ||
| 65 | + | ||
| 66 | +* 用户不合法 用户头信息中 和用户账号类型不匹配 | ||
| 67 | + http code 412 | ||
| 68 | + | ||
| 69 | + ```json | ||
| 70 | + { | ||
| 71 | + "msg":"用户不合法" | ||
| 72 | + } | ||
| 73 | + ``` | ||
| 74 | + | ||
| 75 | +#### 用户信息接口 /user/me | ||
| 76 | + | ||
| 77 | +#### URL参数 | ||
| 78 | + | ||
| 79 | +* access\_token string 必须 | ||
| 80 | + | ||
| 81 | +#### 请求方式 | ||
| 82 | + | ||
| 83 | +GET 方法 | ||
| 84 | + | ||
| 85 | +#### 返回值 | ||
| 86 | + | ||
| 87 | +* 合法用户 | ||
| 88 | + http code 200 | ||
| 89 | + | ||
| 90 | + ```json | ||
| 91 | + { | ||
| 92 | + "id": 7566, | ||
| 93 | + "username": "b@b.cn", | ||
| 94 | + "access_token": "futT9nmvb5", | ||
| 95 | + "score":3801, | ||
| 96 | + "goal":100, | ||
| 97 | + "figure_url":"http://avatars.boxfish.cn/user/-12/figure/1411532427.jpg" | ||
| 98 | + | ||
| 99 | + } | ||
| 100 | + ``` | ||
| 101 | + | ||
| 102 | +* accessToken 不合法 | ||
| 103 | + | ||
| 104 | + http code 400 | ||
| 105 | + | ||
| 106 | + ```json | ||
| 107 | + { | ||
| 108 | + "msg": "accessToken 不合法!" | ||
| 109 | + } | ||
| 110 | + ``` | ||
| 111 | + | ||
| 112 | +* 用户不存在 | ||
| 113 | + http code 404 | ||
| 114 | + | ||
| 115 | + ```json | ||
| 116 | + { | ||
| 117 | + "msg": "用户不存在!" | ||
| 118 | + } | ||
| 119 | + ``` | ||
| 120 | + | ||
| 121 | + #### 用户信息接口 /relation/user/{user\_id}?access\_token={access\_token} | ||
| 122 | + | ||
| 123 | +#### URL参数 | ||
| 124 | + | ||
| 125 | +* user\_id Long 必须 | ||
| 126 | +* access\_token string 必须 | ||
| 127 | + | ||
| 128 | +#### 请求方式 | ||
| 129 | + | ||
| 130 | +GET 方法 | ||
| 131 | + | ||
| 132 | +#### 返回值 | ||
| 133 | + | ||
| 134 | +* 用户关系合法 | ||
| 135 | + http code 200 | ||
| 136 | + ```json | ||
| 137 | + { | ||
| 138 | + "id": 100000000640, | ||
| 139 | + "target": { | ||
| 140 | + "id": 1298963, | ||
| 141 | + "username": "iosstudent13@bf.cn", | ||
| 142 | + "score": 3912, | ||
| 143 | + "gold": 2362, | ||
| 144 | + "figure_url": "http://avatars.boxfish.cn/user/1298963/figure/1477366527.jpg" | ||
| 145 | + } | ||
| 146 | + } | ||
| 147 | + ``` | ||
| 148 | +* accessToken 不合法 | ||
| 149 | + | ||
| 150 | + http code 400 | ||
| 151 | + | ||
| 152 | + ```json | ||
| 153 | + { | ||
| 154 | + "msg": "accessToken 不合法!" | ||
| 155 | + } | ||
| 156 | + ``` | ||
| 157 | + | ||
| 158 | +* accessToken 过期 | ||
| 159 | + | ||
| 160 | + http code 401 | ||
| 161 | + | ||
| 162 | + ```json | ||
| 163 | + { | ||
| 164 | + "msg": "用户token过期!" | ||
| 165 | + } | ||
| 166 | + ``` | ||
| 167 | + | ||
| 168 | +* 该用户没有绑定其它用户! | ||
| 169 | + http code 404 | ||
| 170 | + | ||
| 171 | + ```json | ||
| 172 | + { | ||
| 173 | + "msg": "该用户没有绑定其它用户!" | ||
| 174 | + } | ||
| 175 | + ``` | ||
| 176 | + | ||
| 177 | + | ||
| 178 | + |
-
Please register or login to post a comment