账户相关
账户相关
账户相关的接口,含用户注册、登录等
apis
1. 用户注册接口
用户注册接口说明
author: alovn
POST /user/account/register
Request:
| parameter | parameterType | dataType | required | validate | example | description |
|---|---|---|---|---|---|---|
| from | query | string | false | test | ||
| password | form | string | true | required | 密码 | |
| username | form | string | true | required | 用户名 | |
| x-request-id | header | string | false | request id |
body:
{ //object(handler.RegisterRequest), 注册请求参数
"password": "abc", //string, required, 密码
"username": "abc" //string, required, 用户名
}
Response:
//StatusCode: 200 注册成功返回数据
{ //object(common.Response), 通用返回结果
"code": 0, //int, 返回状态码
"data": { //object(handler.RegisterResponse), 注册返回数据
"user_id": 123, //int64, 注册的用户ID
"username": "abc", //string, 注册的用户名
"welcome_msg": "abc" //string, 注册后的欢迎语
},
"msg": "success" //string, 返回消息
}
//StatusCode: 200 密码格式错误
{ //object(common.Response), 通用返回结果
"code": 10011, //int, 返回状态码
"msg": "password format error" //string, 返回消息
}
2. 用户登录接口
author: alovn
POST /user/account/login
Request:
| parameter | parameterType | dataType | required | validate | example | description |
|---|---|---|---|---|---|---|
| password | form | string | true | required | 登录密码 | |
| username | form | string | true | required | 登录用户名 | |
| validate_code | form | string | false | 验证码 |
Response:
//StatusCode: 200 登录成功返回数据
{ //object(common.Response), 通用返回结果
"code": 0, //int, 返回状态码
"data": { //object(handler.LoginResponse), 登录返回数据
"welcome_msg": "abc" //string, 登录成功欢迎语
},
"msg": "success" //string, 返回消息
}
//StatusCode: 200 密码错误
{ //object(common.Response), 通用返回结果
"code": 10020, //int, 返回状态码
"msg": "password_error" //string, 返回消息
}