chong

Merge branch master

This diff is collapsed. Click to expand it.
# boxfish用户认证系统
#### 测试环境部署地址
[http://114.55.58.184:8099/](http://114.55.58.184:8099/)
#### 生产环境部署地址
[http\(s\)//base.boxfish.cn/passbook/](http://base.boxfish.cn/passbook/)
认证接口 /user/auth
#### 请求方式
POST 方法
#### 请求头信息
x-be-product com.boxfishedu.teacher \(必须包含 teacher or student \)
#### 请求参数
* json
```json
{
"username":"username",
"password":"password"
}
```
#### 返回值
* 合法用户
http code 200
```json
{
"id": 7566,
"username": "b@b.cn",
"access_token": "futT9nmvb5",
"score":3801,
"goal":100,
"figure_url":"http://avatars.boxfish.cn/user/-12/figure/1411532427.jpg"
}
```
* 用户不存在
http code 404
```json
{
"msg": "用户不存在!"
}
```
* 用户密码不正确
http code 401
```json
{
"msg":"用户密码不正确!"
}
```
* 用户不合法 用户头信息中 和用户账号类型不匹配
http code 412
```json
{
"msg":"用户不合法"
}
```
#### 用户信息接口 /user/me
#### URL参数
* access\_token string 必须
#### 请求方式
GET 方法
#### 返回值
* 合法用户
http code 200
```json
{
"id": 7566,
"username": "b@b.cn",
"access_token": "futT9nmvb5",
"score":3801,
"goal":100,
"figure_url":"http://avatars.boxfish.cn/user/-12/figure/1411532427.jpg"
}
```
* accessToken 不合法
http code 400
```json
{
"msg": "accessToken 不合法!"
}
```
* 用户不存在
http code 404
```json
{
"msg": "用户不存在!"
}
```
#### 用户信息接口 /relation/user/{user\_id}?access\_token={access\_token}
#### URL参数
* user\_id Long 必须
* access\_token string 必须
#### 请求方式
GET 方法
#### 返回值
* 用户关系合法
http code 200
```json
{
"id": 100000000640,
"target": {
"id": 1298963,
"username": "iosstudent13@bf.cn",
"score": 3912,
"gold": 2362,
"figure_url": "http://avatars.boxfish.cn/user/1298963/figure/1477366527.jpg"
}
}
```
* accessToken 不合法
http code 400
```json
{
"msg": "accessToken 不合法!"
}
```
* accessToken 过期
http code 401
```json
{
"msg": "用户token过期!"
}
```
* 该用户没有绑定其它用户!
http code 404
```json
{
"msg": "该用户没有绑定其它用户!"
}
```
... ...