登录

接口约定

  • 使用https
  • restful风格
  • 用户端:https://{域名}/api/{接口版本号}/{resource}/{resource_id}/{sub_resource}/{sub_resource_id}/{action}?{query_string}
  • 管理端:https://{域名}/admin/api/{接口版本号}/{resource}/{resource_id}/{sub_resource}/{sub_resource_id}/{action}?{query_string}
  • 测试环境域名babieta.xivan.cn
  • 正式环境域名待定
  • 公共参数放在header,如userid,token,unionid,version等
  • resource: auth

接口


POST /auth/login

name cname type Description
用途 用户登录,无注册态则自动注册
版本号 v1.0
请求数据:

query_string 参数

name cname type Description
avatar_url 头像 string
city 城市 string
country 国家 string
gender 性别 string
language 语言 string
nickname 昵称 string
province 省份 string

curl -XPOST https://babieta.xivan.cn/api/v1.0/auth/login -d '{"code":"xxx", "nickname":"134",...}'
wx.request({
          "url": "https://babieta.xivan.cn/api/v1.0/auth/login",
          "method": "POST",
          "success": res => {
            console.log(res)
          },
          "data": { code: "023RaD4B04iEDg2jV93B0RCC4B0RaD4o", "nickname":"134", ... },
          "dataType": "json",
          "header": {
            "content-type": "application/json",
          },
          "complete": res => {
            console.log(res)
          }
        })
返回数据:
name cname type Description
code int 返回码 0成功 非0失败
msg string 错误信息
userid string
token string 登录凭证

{
    "code"0,
    "msg":"",
    "userid":"123",
    "token":"xxxx"
}
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容