# 登录&注册

# 登录

  • 打开登录页首次请求

  • 请求地址:users/login

  • 请求方式:GET

  • 需要授权:否

返回结果

// 调用成功返回
{
    "code": 1, 
    "msg": "ok", 
    "data": {
        "title": "A3Mall B2B2C", 
        "ctitle": "沃生优购", 
        "split": 0
    }
}
// 调用失败返回
{
    "msg":"",
    "code":0
}

  • 提交表单

  • 请求地址:users/login

  • 请求方式:POST

  • 需要授权:否

请求参数

参数 类型 描述
username string 手机号
password string 密码

返回结果

// 调用成功返回
{
    "code": 1, 
    "msg": "登录成功", 
    "data": {
        "id": 1, 
        "token": "40a78a658f5b8339085707517e8dc7f9cb6854f4", 
        "username": "demo", 
        "nickname": "demo", 
        "group_name": "钻石会员", 
        "shop_count": 0, 
        "birthday": 0, 
        "sex": 0, 
        "is_spread": true, 
        "mobile": "18026740326", 
        "point": 0, 
        "amount": "0.00", 
        "avatar": null, 
        "order_count": {}
    }
}

// 调用失败返回
{
    "msg":"",
    "code":0
}

# 注册

  • 打开注册页首次请求

  • 请求地址:users/register

  • 请求方式:GET

  • 需要授权:否

返回结果

// 调用成功返回
{
    "code": 1, 
    "msg": "ok", 
    "data": {
        "title": "A3Mall B2B2C", 
        "ctitle": "沃生优购", 
        "split": 0
    }
}
// 调用失败返回
{
    "msg":"",
    "code":0
}

  • 提交表单

  • 请求地址:users/login

  • 请求方式:POST

  • 需要授权:否

请求参数

参数 类型 描述
username string 手机号
password string 密码
code string 验证码

返回结果

// 调用成功返回
{
    "code": 1, 
    "msg": "注册成功", 
    "data": {
        "id": 1, 
        "token": "40a78a658f5b8339085707517e8dc7f9cb6854f4", 
        "username": "demo", 
        "nickname": "demo", 
        "group_name": "钻石会员", 
        "shop_count": 0, 
        "birthday": 0, 
        "sex": 0, 
        "is_spread": true, 
        "mobile": "18026740326", 
        "point": 0, 
        "amount": "0.00", 
        "avatar": null, 
        "order_count": {}
    }
}

// 调用失败返回
{
    "msg":"",
    "code":0
}

# 找回密码

  • 打开找回密码页首次请求

  • 请求地址:users/forget

  • 请求方式:GET

  • 需要授权:否

返回结果

// 调用成功返回
{
    "code": 1, 
    "msg": "ok", 
    "data": {
        "title": "A3Mall B2B2C", 
        "ctitle": "沃生优购", 
        "split": 0
    }
}
// 调用失败返回
{
    "msg":"",
    "code":0
}

  • 提交表单

  • 请求地址:users/forget

  • 请求方式:POST

  • 需要授权:否

请求参数

参数 类型 描述
username string 手机号
password string 密码
code string 验证码

返回结果

// 调用成功返回
{
    "code": 1, 
    "msg": "修改密码成功", 
    "data": {
        "id": 1, 
        "token": "40a78a658f5b8339085707517e8dc7f9cb6854f4", 
        "username": "demo", 
        "nickname": "demo", 
        "group_name": "钻石会员", 
        "shop_count": 0, 
        "birthday": 0, 
        "sex": 0, 
        "is_spread": true, 
        "mobile": "18026740326", 
        "point": 0, 
        "amount": "0.00", 
        "avatar": null, 
        "order_count": {}
    }
}

// 调用失败返回
{
    "msg":"",
    "code":0
}

# 公众号登录

  • 用户授权登录

  • 请求地址:wechat.auth/login

  • 请求方式:GET

  • 需要授权:否


  • 授权成功,回调处理

  • 请求地址:wechat.auth/login

  • 请求方式:POST

  • 需要授权:否

请求参数

参数 类型 描述
source int 值1 公众号
code string 通过code换取网页授权access_token
state string 重定向后会带上state参数

返回结果

// 调用成功返回
{
    "code": 1, 
    "msg": "授权成功", 
    "data": {
        "id": 1, 
        "token": "40a78a658f5b8339085707517e8dc7f9cb6854f4", 
        "username": "demo", 
        "nickname": "demo", 
        "group_name": "钻石会员", 
        "shop_count": 0, 
        "birthday": 0, 
        "sex": 0, 
        "is_spread": true, 
        "mobile": "18026740326", 
        "point": 0, 
        "amount": "0.00", 
        "avatar": null, 
        "order_count": {}
    }
}

// 调用失败返回
{
    "msg":"",
    "code":0
}

# 微信小程序登录

  • 授权成功,回调处理

  • 请求地址:wechat.auth/login

  • 请求方式:POST

  • 需要授权:否

请求参数

参数 类型 描述
source int 值2 微信小程序
userInfo string 用户信息
code string 通过code换取网页授权access_token

返回结果

// 调用成功返回
{
    "code": 1, 
    "msg": "授权成功", 
    "data": {
        "id": 1, 
        "token": "40a78a658f5b8339085707517e8dc7f9cb6854f4", 
        "username": "demo", 
        "nickname": "demo", 
        "group_name": "钻石会员", 
        "shop_count": 0, 
        "birthday": 0, 
        "sex": 0, 
        "is_spread": true, 
        "mobile": "18026740326", 
        "point": 0, 
        "amount": "0.00", 
        "avatar": null, 
        "order_count": {}
    }
}

// 调用失败返回
{
    "msg":"",
    "code":0
}

# 发送短信

  • 用于注册和找回密码发送短信

  • 请求地址:users/send_sms

  • 请求方式:POST

  • 需要授权:否

请求参数

参数 类型 描述
username string 手机号码
type string 值:password/register

返回结果

// 调用成功返回
{
    "code": 1, 
    "msg": "发送成功", 
    "data": {}
}

// 调用失败返回
{
    "msg":"",
    "code":0
}

# 自动登录

  • 请求地址:users/autologin

  • 请求方式:POST

  • 需要授权:否

header头

参数 类型 描述
Auth-Token string token

请求参数

参数 类型 描述
spread_id int 推广者

返回结果

// 调用成功返回
{
    "code": 1000, 
    "msg": "ok", 
    "data": {
		"id": 1,
		"token": "40a78a658f5b8339085707517e8dc7f9cb6854f4", 
		"username": "demo", 
		"nickname": "demo", 
		"group_name": "钻石会员", 
		"shop_count": 0, 
		"birthday": 0, 
		"sex": 0, 
		"is_spread": true, 
		"mobile": "18026740326", 
		"point": 0, 
		"amount": "0.00", 
		"avatar": null, 
		"order_count": {}
	}
}

// 调用失败返回
{
    "msg":"错误信息",
    "code":'-1002'
}