- 用户注册分两步:
- 发送注册验证码 -> 手机接受验证码
- 注册用户
- 验证码有效期为5分钟,120秒以后可以重发
- 请求地址 /v1/user/sendRegisterMessage
POST
- 请求方式 JSON/Http POST
- 请求参数
字段 | 类型 | 描述 |
---|---|---|
countryCode | string | 电话的国家码,如果留空,默认为86 |
phone | string | 电话号码 |
- 返回和请求示例: POST /v1/user/sendRegisterMessage
{
"phone":"13800138001"
}
假如用户已经存在,返回类似:(用户电话号码已经存在的情形)
{
"success": false,
"message": "User Phone exists",
"code": "USER_PHONE_EXIST",
"status": 400
}
(发送太频繁的)
{
"success": false,
"message": "SEND_MESSAGE_FREQUENTLY",
"code": "SEND_MESSAGE_FREQUENTLY",
"status": 400,
"token": "..."
}
假如发送成功,则返回:
{
"status": 200,
"result": "T0RZLi5xenktc3AtdG9rZW5ANmNzOTJkLXRva2VuLk1UTTJNamN4TkRBME9ETS4ucXp5LXNwLXRva2VuQDZjczkyZC10b2tlbi5NVEEuLnF6eS1zcC10b2tlbkA2Y3M5MmQtdG9rZW4uYzIzMGY0MjQxNmY5YzhhNGIzYzkwZGFkNjk1N2NjZmU.",
"code": "OK",
"success": true,
"token": "..."
}
code 字段 | 类型 | 描述 |
---|---|---|
{PHONE}_REQUIRED | 400 | 提交数据缺失phone字段 |
USER_PHONE_EXIST | 400 | 此电话号码已经被注册,请直接登录 |
SEND_MESSAGE_ERROR | 400 | 系统错误,请稍后再试 |
PHONE_NOT_VALIDATE | 400 | 电话号码有误 |
- 请求地址 /v1/user/register
POST
- 请求方式 JSON/Http POST
- 请求参数
Properties | Type | Description |
---|---|---|
name | string | The login name of user |
password | string | 用户输入密码进行UTF-8 MD5以后的小写值 |
code | string | Validate code from SMS |
phoneInfo | string | info code from sendSMS interface |
- 返回和请求示例: POST /v1/user/register
{
"phoneInfo":"T0RZLi5xenktc3AtdG9rZW5ANmNzOTJkLXRva2VuLk1UTTJNamN4TkRBME9ETS4ucXp5LXNwLXRva2VuQDZjczkyZC10b2tlbi5NVEEuLnF6eS1zcC10b2tlbkA2Y3M5MmQtdG9rZW4uYzIzMGY0MjQxNmY5YzhhNGIzYzkwZGFkNjk1N2NjZmU.",
"code":"119614",
"name":"eric",
"password":"665421e4e5c6a354d8698fa1df103851"
}
假如用户已经存在,返回类似:(用户电话号码已经存在的情形)
{
"success": false,
"message": "USER_PHONE_EXIST",
"code": "USER_PHONE_EXIST",
"status": 400
}
{
"success": false,
"message": "Phone not validate",
"code": "PHONE_NOT_VALIDATE",
"status": 400
}
假如用户创建成功,则返回:
{
"status": 200,
"result": {
"uuid": 4,
"name": "eric",
"email": "",
"countryCode": "86",
"phone": "13800138001",
"createTime": 1532521829536,
"createIp": "::ffff:123.59.101.89",
"ssid": {},
"icon": "default.jpg",
"spaceUsed": 0,
"spaceCapacity": 8192,
"type": 0,
"status": 0
},
"code": "OK",
"success": true,
"token": "..."
}