@BurdenBear
2017-07-08T03:47:20.000000Z
字数 2610
阅读 475
大鱼商城文档
URL: /user/login/
1.已成功登录
{"data": {"success": 1,"user_name": "fxlmj","user_id": "1"},"code": 200,"message": ""}
{
"data": {
"success": 0,
"user_name": "",
"user_id": ""
},
"code": 200,
"message": ""
}
URL: /user/login/
1.登录成功
request
{"username": "fxlmj","password": "666666","code": -2,}
response
{"data": {"success": 1,"user_name": "fxlmj","user_id": "1"},"code": 200,"message": ""}
成功时success为1,message为登录成功的用户名
2.登录失败
request
{"username": "fxlmj","password": "666666","code": -2,}
response
{"data": {"success": 0,"user_name": "","user_id": ""},"code": 200,"message": "账号或密码不正确"}
失败时success为0,message返回失败原因
URL: /user/login/
response
1.成功
{"code": 200, "data": "", "message": ""}
2.失败:
{"code": 500, "data": "", "message": ""}
URL: /user/register/
example1:
request:
{"method": "email""code": -2"email": "541795600@qq.com""nickname": "fxlmj""password": "666666""password2": "666666"}
response:
{"status": "OK"}
method = ("email, "phone"),用来区分是用邮箱注册还是手机注册。
example 2:
request:
{"method": "email""code": -8"email": "541795600@qq.com""nickname": "fxlmj""password": "666666""password2": "6666667"}
response:
{"status": "ERROR","info": {"code": ["验证码输入错误"],"email": ["已注册的邮箱"]"password2": ["两次输入的密码不一致"]}}
若返回为False,则会info中会返回一个表示具体错误出现在哪些POST的字段上的字典,字典值为列表,取第一条作为显示的错误信息就好
URL: /user/register/
example 1:
传入参数:
{"method": "phone","phone": "13955133760","nickname": "fxlmj","password": "666666","password2": "666666","phone_code": "666666",}
返回结果:
{"status": "OK",}
错误的情况同邮箱注册
URL: /user/activate/
example 1
{"status": "OK","info": "fxlmj",}
example 2
{"status": "ERROR","info": "notFind"}
成功时info中返回用户昵称,失败时info可能的值有:
"activated": 表示已激活过
"notFind": 表示找不到用户
"expired" : 激活链接已过期
此接口用于调试,当服务器开启Debug模式时才会启动。使用此页面可配合postman进行接口测试
- URL: /admin
- 管理员账号:root
- 密码: Xinger520
URL: /user/utils/picCode/
example 1:
request
{"code": -2}
response
{"status": "OK"}
验证成功返回"OK", 失败返回"ERROR"
URL: /user/utils/msgCode
example 1:
request
{"phone": "13955133777"}
response
{"status": "OK","info": "0"}
example 2:
request
{"phone": "13955133777"}
response
{"status": "ERROR","info": "12"}
"OK"表示成功。
"ERROR"表示失败。
此时info若不为空,则表示失败原因是触发了短信发送间隔限制,info中为还需等待的秒数;
若info为空,表示发生其他错误,此时后台会有日志记录。
URL: /user/utils/msgCode
example 1:
request
{"phone": "13955133777","code": "666666"}
response
{"status": "OK","info": ""}
example 2:
request
{"phone": "13955133777","code": "666666"}
response
{"status": "ERROR","info": "incorrect"}
"OK"表示成功。
"ERROR"表示失败,此时若:
info为"incorrect" 表示验证码不正确
info为"expired" 表示验证码失效,有效时间为600秒或连续验证错误5次。