用户模块
sfyr111 edited this page Feb 26, 2018
·
1 revision
{{host}}/user/login
username
password
{
"status": 0,
"msg": "登录成功",
"data": {
"id": 12,
"username": "xiaoyang",
"email": "1@2.com",
"phone": null,
"role": 0
}
}
{
"status": 1,
"msg": "密码错误",
"data": null
}
{{host}}/user/logout
{
"status": 0
}
{{host}}/manage/user/login
username
password
{
"status": 0,
"msg": "登录成功",
"data": {
"id": 14,
"username": "laoyang",
"email": "laoyang@123.com",
"phone": null,
"role": 1
}
}
{
"status": 1,
"msg": "密码错误",
"data": null
}
{{host}}/user/register
username
password
email
phone
question
answer
{
"status": 0,
"msg": "注册成功",
"data": {
"createTime": "2018-02-26T07:05:49.599Z",
"updateTime": "2018-02-26T07:05:49.599Z",
"id": 15,
"username": "xiaoyang2",
"email": "xiaoyang2@123.com",
"question": "你好吗?",
"answer": "是的",
"role": 0
}
}
{
"status": 1,
"msg": "用户名已存在",
"data": null
}
{{host}}/user/checkValid/:type/:value
type: email | username
value
{
"status": 0,
"msg": "用户名不存在",
"data": null
}
{
"status": 1,
"msg": "用户名已存在",
"data": null
}
{{host}}/user/getUserSession
{
"status": 0,
"msg": "用户已登录",
"data": {
"id": 14,
"username": "laoyang",
"email": "laoyang@123.com",
"phone": null,
"role": 1
}
}
{
"status": 1,
"msg": "用户未登录,无法获取用户信息",
"data": null
}
{{host}}/user/forgetGetQuestion/:username
{
"status": 0,
"msg": null,
"data": {
"question": "你好吗?"
}
}
{
"status": 1,
"msg": "用户不存在",
"data": null
}
{{host}}/user/forgetCheckAnswer
username
question
answer
{
"status": 0,
"msg": "问题回答正确",
"data": {
"token": "95b54140-1aca-11e8-8ac0-911848615e93"
}
}
{
"status": 1,
"msg": "问题的答案错误",
"data": null
}
{{host}}/user/forgetRestPassword
username
forgetToken
paswordNew
{
"status": 0,
"msg": "修改密码成功",
"data": null
}
{
"status": 0,
"msg": "token错误, 请重新获取充值密码的token",
"data": null
}
{{host}}/user/resetPassword
passwordOld
passwordNew
{
"status": 0,
"msg": "修改密码成功",
"data": null
}
{
"status": 1,
"msg": "旧密码错误",
"data": null
}
{{host}}/user/updateUserInfo
email
phone
{
"status": 0,
"msg": "更新个人信息成功",
"data": {
"id": 12,
"username": "xiaoyang",
"email": "1@2.com",
"phone": null
}
}
{
"status": 1,
"msg": "email已经存在, 请更换",
"data": null
}
{{host}}/user/getUserInfo
{
"status": 0,
"msg": null,
"data": {
"id": 12,
"username": "xiaoyang",
"email": "1@2.com",
"phone": null,
"question": "你好吗?"
}
}
{
"status": 10,
"msg": "用户未登录",
"data": null
}