用户注册接口文档
接口概述
- 接口名称: 用户注册
- 接口路径:
/login/register
- 请求方式: POST
- 接口描述: 通过用户前台填写表单提交进行注册。
请求参数
- ajax (必填): ajax返回标识,字段类型
number
,默认值1
- tel (必填): 手机号,字段类型
number
- email (非必填): 邮箱,找回密码需要,字段类型
string
- password (必填): 密码,字段类型
string
- repassword (必填): 重复密码,字段类型
string
- vercode (必填): 验证码,字段类型
string
,生成方式参考: 验证码
tip
如果后台关闭了前台验证码,则vercode
可以为空!
- autologin (非必填):是否自动登录,字段类型
number
,默认值1
响应参数
- code (整数): 响应码,0表示成功。
- msg (字符串): 响应消息,成功时返回"注册成功!"。
- data (对象): 响应对象,成功时返回数据对象,失败返回空数组。
- url (字符串): 返回登录链接
tip
如果传了autologin
参数,返回如下:
- code (整数): 响应码,0表示成功。
- msg (字符串): 响应消息,成功时返回"注册成功!"。
- data (对象): 响应对象,成功时返回数据对象,失败返回空数组。
- token (字符串): 登录密钥
示例请求
curl -X POST -d "ajax=1&tel=13800138000&email=123456@qq.com&password=123456&repassword=123456&vercode=abcd" https://demo.jizhicms.cn/login/register
示例响应
{
"code": 0,
"msg": "注册成功!",
"url": "https://demo.jizhicms.cn/login/index.html"
}
{
"code": 0,
"msg": "注册成功!",
"token": "IONDSAH1231msd"
}
{
"code": 1,
"msg": "手机号格式错误!"
}
错误码
- 0: 请求正确,返回正确。
- 1: 请求参数错误,如tel格式不正确或缺失。