Skip to content

门户_用户接口

heylinlook edited this page May 14, 2018 · 2 revisions

1.登录

/user/#.do

post(代码需要post方式请求),开放get,方便调试

request

username,password

response

fail

{
"status": 1,
"msg": "密码错误"
}

success

{
"status": 0,
"data": {
    "id": 12,
    "username": "aaa",
    "email": "aaa@163.com",
    "phone": null,
    "role": 0,
    "createTime": 1479048325000,
    "updateTime": 1479048325000
}
}

2.注册 /user/register.do

request

username,password,email,phone,question,answer

response

success

{
"status": 0,
"msg": "校验成功"
}

fail

{
"status": 1,
"msg": "用户已存在"
}

3.检查用户名是否有效

/user/check_valid.do

/check_valid.do?str=admin&type=username就是检查用户名。

request

str,type
str可以是用户名也可以是email。对应的type是username和email

response

success

{
"status": 0,
"msg": "校验成功"
}

fail

{
"status": 1,
"msg": "用户已存在"
}

4.获取登录用户信息

/user/get_user_info.do

request

无参数

response

success

{
"status": 0,
"data": {
    "id": 12,
    "username": "aaa",
    "email": "aaa@163.com",
    "phone": null,
    "role": 0,
    "createTime": 1479048325000,
    "updateTime": 1479048325000
}
}

fail

{
"status": 1,
"msg": "用户未登录,无法获取当前用户信息"
}

5.忘记密码

/user/forget_get_question.do

localhost:8080/user/forget_get_question.do?username=geely

request

username

response

success

{
"status": 0,
"data": "这里是问题"
}

fail

{
"status": 1,
"msg": "该用户未设置找回密码问题"
}

6.提交问题答案

/user/forget_check_answer.do

localhost:8080/user/forget_check_answer.do?username=aaa&question=aa&answer=sss

request

username,question,answer

response

正确的返回值里面有一个token,修改密码的时候需要用这个。传递给下一个接口

success

{
"status": 0,
"data": "531ef4b4-9663-4e6d-9a20-fb56367446a5"
}

fail

{
"status": 1,
"msg": "问题答案错误"
}

7.忘记密码的重设密码

/user/forget_reset_password.do

localhost:8080/user/forget_reset_password.do?username=aaa&passwordNew=xxx&forgetToken=531ef4b4-9663-4e6d-9a20-fb56367446a5

request

username,passwordNew,forgetToken

response

success

{
"status": 0,
"msg": "修改密码成功"
}

fail

{
"status": 1,
"msg": "修改密码操作失效"
}

或

{
"status": 1,
"msg": "token已经失效"
}

8.登录中状态重置密码

/user/reset_password.do

request

passwordOld,passwordNew

response

success

{
"status": 0,
"msg": "修改密码成功"
}

fail

{
"status": 1,
"msg": "旧密码输入错误"
}

9.登录状态更新个人信息

/user/update_information.do

request

email,phone,question,answer

response

success

{
"status": 0,
"msg": "更新个人信息成功"
}

fail

{
"status": 1,
"msg": "用户未登录"
}

10.获取当前登录用户的详细信息,并强制登录

/user/get_information.do

request

无参数

response

success

{
"status": 0,
"data": {
    "id": 1,
    "username": "admin",
    "password": "",
    "email": "admin@163.com",
    "phone": "13800138000",
    "question": "question",
    "answer": "answer",
    "role": 1,
    "createTime": 1478422605000,
    "updateTime": 1491305256000
}
}

fail

{
"status": 10,
"msg": "用户未登录,无法获取当前用户信息,status=10,强制登录"
}

11.退出登录

/user/logout.do

request

response

success

{
"status": 0,
"msg": "退出成功"
}

fail

{
"status": 1,
"msg": "服务端异常"
}