2019-03-06

目录

  • 定义
  • 说明
  • 身份验证
  • 接口定义
    • 注册 (/user/register POST)
    • 登录 (/user/login POST)
    • 用户信息(别人看到的) (/user/info GET)
    • 好友列表 (/friend/list POST)
    • 剧本列表 (/play/list GET)
    • 剧本详情 (/play/detail GET)
    • 购买剧本 (/play/buy POST)
    • 收藏 (/play/collect POST)
    • 收藏列表 (/play/collection GET)
    • 创建房间 (/room/create POST)
    • 选择剧本 (/room/choose/play POST)
    • 房间信息 (/room/info POST)
    • 加入房间 (/room/join POST)
    • 准备 (/room/ready POST)
    • 开始游戏 (/room/start POST)
    • 真相页面 (/room/play/truth GET)
    • 复盘 (/room/play/review GET)
    • 选角色 (/room/play/character POST)
    • 探索(获取线索) (/room/clue/explore POST)
    • 获取我的线索 (/room/clue GET)
    • 公开线索 (/room/clue/public POST)
    • 回收线索 (/room/clue/archive POST)
    • 取消回收线索 (/room/clue/cancelArchive POST)
    • 投票 (/room/play/vote POST)
    • 继续游戏 --- 待完成 (/room/continue GET)
    • 踢人 (/room/kickout POST)
    • 离开房间(不包括投票解散) (/room/leave POST)
  • Model 列表
  • 类型定义 列表
  • 错误码

定义

  • Host: http://api.test.findxapp.com
  • Path: 资源地址,根据接口不同
  • Params: 参数列表
  • Token: 登录用户的唯一标识(token={token} 形式附加到header里)

Back to TOC

说明

  1. 接口请求方式: curl [-G] {Host}+{Path} -d {Params}
  2. 返回数据格式: JSON (接口只定义data内的内容)
    {
        "meta":{
            "code":2000,
            "message":"操作成功"
        },
        "data":[]
    }
  1. 通用header: token

Back to TOC

身份验证

  1. /user/register 或者 /user/login 获取token
  2. 需要验证的接口附加token, 如,curl -H "token: {token}"

Back to TOC


注册

/user/register POST

Params

Arg Type Desc Require
mobile string 手机号
code string 验证码
invite string 邀请码

Returns

Arg Type Desc Require
user User 用户信息
token string token

Back to TOC

登录

/user/login POST

Params

Arg Type Desc Require
mobile string 手机号

Returns

Arg Type Desc Require
user User 用户信息
token string token

Back to TOC

用户信息(别人看到的)

/user/info GET

Params

Arg Type Desc Require
uid int 用户ID

Returns

Arg Type Desc Require
friend Friend 用户信息

Back to TOC

好友列表

/friend/list POST

Params

Arg Type Desc Require
offset int 偏移量 从0开始

Returns

Arg Type Desc Require
friends array 列表

Back to TOC

剧本列表

/play/list GET

Params

Arg Type Desc Require
playerCnt int 剧本人数 0或者不传 all
level int 难度等级 0或者不传 all
pay int 是否付费 0 否 1 是 -1或者不传 all
offset int 偏移量 从0开始

Returns

Arg Type Desc Require
plays array 列表

Back to TOC

剧本详情

/play/detail GET

Params

Arg Type Desc Require
id int 剧本ID

Returns

Arg Type Desc Require
play Play 剧本

Back to TOC

购买剧本

/play/buy POST

Params

Arg Type Desc Require
playId int 剧本ID

Returns

Arg Type Desc Require

Back to TOC

收藏

/play/collect POST

Params

Arg Type Desc Require
playId int 剧本ID

Returns

Arg Type Desc Require

Back to TOC

收藏列表

/play/collection GET

Params

Arg Type Desc Require

Returns

Arg Type Desc Require
plays array 列表

Back to TOC

创建房间

/room/create POST

Params

Arg Type Desc Require
playId int 剧本ID
match int 是否允许随机匹配

Returns

Arg Type Desc Require
room Room 房间信息

Back to TOC

选择剧本

/room/choose/play POST

Params

Arg Type Desc Require
playId int 剧本ID

Returns

Arg Type Desc Require

Back to TOC

房间信息

/room/info POST

Params

Arg Type Desc Require

Returns

Arg Type Desc Require
room Room 房间信息

Back to TOC

加入房间

/room/join POST

Params

Arg Type Desc Require
id int 房间ID

Returns

Arg Type Desc Require
room Room 房间信息

Back to TOC

准备

/room/ready POST

Params

Arg Type Desc Require

Returns

Arg Type Desc Require

Back to TOC

开始游戏

/room/start POST

Params

Arg Type Desc Require

Returns

Arg Type Desc Require

Back to TOC

真相页面

/room/play/truth GET

Params

Arg Type Desc Require

Returns

Arg Type Desc Require
iswin int 选择是否正确
truth Truth 真相

Back to TOC

复盘

/room/play/review GET

Params

Arg Type Desc Require

Returns

Arg Type Desc Require
exp int 获得积分
coin int 获得金币
votes array 投票结果列表

Back to TOC

选角色

/room/play/character POST

Params

Arg Type Desc Require
roleId int 角色ID

Returns

Arg Type Desc Require

Back to TOC

探索(获取线索)

/room/clue/explore POST

Params

Arg Type Desc Require
sceneId int 场景ID

Returns

Arg Type Desc Require
clue Clue 线索

Back to TOC

获取我的线索

/room/clue GET

Params

Arg Type Desc Require
type int 类型 1 我的 2 公开 3 回收站

Returns

Arg Type Desc Require
clues array 线索列表

Back to TOC

公开线索

/room/clue/public POST

Params

Arg Type Desc Require
clueId int 线索ID

Returns

Arg Type Desc Require

Back to TOC

回收线索

/room/clue/archive POST

Params

Arg Type Desc Require
clueId int 线索ID

Returns

Arg Type Desc Require

Back to TOC

取消回收线索

/room/clue/cancelArchive POST

Params

Arg Type Desc Require
clueId int 线索ID

Returns

Arg Type Desc Require

Back to TOC

投票

/room/play/vote POST

Params

Arg Type Desc Require
ids array 用户ID数组

Returns

Arg Type Desc Require

Back to TOC

继续游戏 --- 待完成

/room/continue GET

Params

Arg Type Desc Require

Returns

Arg Type Desc Require

Back to TOC

踢人

/room/kickout POST

Params

Arg Type Desc Require
uid int 踢出的用户ID

Returns

Arg Type Desc Require

Back to TOC

离开房间(不包括投票解散)

/room/leave POST

Params

Arg Type Desc Require

Returns

Arg Type Desc Require

Back to TOC


Model 列表

Clue
Play
Room
User
Vote
Scene
Truth
Friend
Player
Discuss
Process
VoteInfo
Character
Storyline

Back to TOC

错误码

Arg Type Value Desc
SUCCESS int 2000 操作成功
NOTFOUND int 404 接口错误
FAILED int 500 服务器错误

Back to TOC

你可能感兴趣的:(2019-03-06)