接口模型.md 3.0 KB

机会导向管理后台接口

全局统一设定

请求头指定要求的字段

字段 说明
x-mmm-accesstoken 发起请求时使用时校验用 token
x-mmm-refreshtoken 刷新 token 时使用的 token
  • 备注 :token 使用 jwt 进行处理.其中包含有 user_id、company_id 的数据,登录时获取

通用响应结构

{
  "code": "错误码字符串",
  "msg": "错误描述字符串",
  "data": {
    "xxx": "any"
  }
}
  • 备注:data 中的内容根据各接口实际情况确定

认证相关

登录

  • 请求路径 :/auth/login
  • 请求方式 :POST
  • 请求 json:
{
  "account": "账号",
  "password": "密码"
}
  • 响应 json
{
  "code": "00000",
  "msg": "成功",
  "data": {
    "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1NzYwNTM2OTAsImlhdCI6MTU3NjA1MTg4OCwiaXNzIjoibW1tX29wcG1nIiwibmJmIjoxNTc2MDUxODg4LCJ1aWQiOjEwLCJjb21wYW55X2lkIjoyfQ.R056B306_vO4UKfMRalncFULE5Z0phN4WOhS9PMwydc",
    "expires_in": 1576053688,
    "refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1NzYwNTU0OTAsImlhdCI6MTU3NjA1MTg4OCwiaXNzIjoibW1tX29wcG1nIiwibmJmIjoxNTc2MDUxODg4LCJ1aWQiOjEwLCJjb21wYW55X2lkIjoyfQ.OY54QdDwAq2B1NPnAmHkSxy_KvhktmZA2boSlcSSfoU",
    "refresh_expires": 1576055488
  }
}
  • 备注:该请求无需指定请求头

刷新 token

  • 请求路径 :/v1/auth/refresh_token
  • 请求方式 :get
  • 请求 json:
  • 响应 json
{
  "code": "00000",
  "msg": "成功",
  "data": {
    "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1NzYwNTM2OTAsImlhdCI6MTU3NjA1MTg4OCwiaXNzIjoibW1tX29wcG1nIiwibmJmIjoxNTc2MDUxODg4LCJ1aWQiOjEwLCJjb21wYW55X2lkIjoyfQ.R056B306_vO4UKfMRalncFULE5Z0phN4WOhS9PMwydc",
    "expires_in": 1576053688,
    "refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1NzYwNTU0OTAsImlhdCI6MTU3NjA1MTg4OCwiaXNzIjoibW1tX29wcG1nIiwibmJmIjoxNTc2MDUxODg4LCJ1aWQiOjEwLCJjb21wYW55X2lkIjoyfQ.OY54QdDwAq2B1NPnAmHkSxy_KvhktmZA2boSlcSSfoU",
    "refresh_expires": 1576055488
  }
}
  • 备注:无

切换公司

  • 请求路径 :/v1/auth/change_company
  • 请求方式 :post
  • 请求 json:
{
  "company_id": 2
}
  • 响应 json
{
  "code": "00000",
  "msg": "成功",
  "data": {
    "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1NzYwNTM2OTAsImlhdCI6MTU3NjA1MTg4OCwiaXNzIjoibW1tX29wcG1nIiwibmJmIjoxNTc2MDUxODg4LCJ1aWQiOjEwLCJjb21wYW55X2lkIjoyfQ.R056B306_vO4UKfMRalncFULE5Z0phN4WOhS9PMwydc",
    "expires_in": 1576053688,
    "refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1NzYwNTU0OTAsImlhdCI6MTU3NjA1MTg4OCwiaXNzIjoibW1tX29wcG1nIiwibmJmIjoxNTc2MDUxODg4LCJ1aWQiOjEwLCJjb21wYW55X2lkIjoyfQ.OY54QdDwAq2B1NPnAmHkSxy_KvhktmZA2boSlcSSfoU",
    "refresh_expires": 1576055488
  }
}
  • 备注:切换公司实际是变更 token 信息