@a5635268
2018-03-18T12:12:05.000000Z
字数 4268
阅读 1269
接口文档
# server
{
type: '业务类型(英文)',
message: '消息内容(主要是提示说明)',
code: '成功的code都为0,不成功状态为其它值(不成功状态包括数据验证不通过等)',
data: '交互数据'
}
# client
{
"type": "业务类型",
"data": [], // 业务数据
"message": "消息体说明,方便后端日志阅读"
}
2. websocket服务地址
Websocket://dev.landapi.chamshare.cn:8282
注意:要绑定本地hosts: 172.28.3.24
client
{
"type": "login",
"data": {
"user_key": "7f5931b4fd3621e3a1e29803df44ca69" # 用户key从GET获取,有效时间5分钟
},
"message": "登录"
}
service
{
"type":"login",
"code":0, // 非0代表有错误,比如用户被禁用,数据验证不通过,用户key过期
"message":"调用成功",
"data":{
"nickname":"菜问",
"avatar":"http://wx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTKcthg7CBtDdA9eL8dibXXhYQhbKKXbpAEhNQylJAvXMSzF5ud2txpHoAb4HsXOZoMJezqqDlOJXuA/0",
"longbi":0, # 龙币
"longjing":0, # 龙晶
"signData":{
"is_signed":0, # 今日是否已签到,如果为0就要弹出签到页面
"continuous":0 # 签到了多少天
}
}
}
client
{
"type": "sign",
"data": [],
"message": "进行签到"
}
service
{
"type":"sign",
"code":0, // 非0代表有错误
"message":"调用成功",
"data":{
# 返回签到后的龙币和龙晶,用于显示到页面上
"longbi": 3000,
"longjing":0
}
}
client
{
"type": "top",
"data": [],
"message": "获取排行榜数据"
}
service
{
"type":"sign",
"code":0, // 非0代表有错误
"message":"调用成功",
"data":{
// 前10名数据
"topTen":{
[
"rank":1, # 当前的名次
"nickname": '昵称',
"avatar": "头像",
"longbi":"龙币"
],
// 我的数据
"myRank":{
[
"rank":1, # 当前的名次
"nickname": '昵称',
"avatar": "头像",
"longbi":"龙币"
]
}
}
}
client
{
"type": "choice_model",
"data": [
"model_id":"1", // 模式ID(1,经典模式)
"greade_id":"1" // 等级id (1初级,2中级,3高级)
],
"message": "选择模式加入房间"
}
service
{
"type":"choice_model",
"code":0, // 非0代表有错误,要弹出(比如)
"message":"调用成功",
"data": []
}
client
{
"type": "join_table",
"data": [],
"message": "匹配进入游戏"
}
service
{
"type":"join_table",
"code":0,
"message":"调用成功",
"data":{
"members":[
{
"member_id":"14",
"nickname":"Skins",
"longbi":"60000",
"is_ai":0 //是否ai,0是1否
}
],
"base_num":1 // 当前房间的基础倍数
}
}
client
{
"type": "shuffle",
"data": [],
"message": "洗牌发牌"
}
service
{
"type":"shuffle",
"code":0,
"message":"调用成功",
"data":[
{
// 扑克牌数组后缀:1代表黑桃 2代表红桃 3代表梅花 4代表方块
// 99小王,100大王
// member_id为0就代表底牌
"member_id":15,
"poker":[
"8_1",
"9_1",
"9_2",
"1_4",
"11_3",
"13_1",
"2_2",
99,
"3_4",
"11_4",
"6_4",
"8_4",
"12_2",
"5_4",
"13_3",
"3_2",
"9_4"
]
},
{
"member_id":0,
"poker":[
"13_4",
"11_2",
"7_2"
]
}
]
}
client
{
"type":"game_start",
"data":{
"status":"1" // 0普通开始 1明牌开始 2进行中明牌开始 3结束后明牌开始
},
"message":"游戏开始"
}
service
{
"type":"game_start",
"code":0,
"message":"调用成功",
"data": []
}
client
{
"type":"call",
"data": {'is_call':1}, // 1不叫2叫
"message":"叫地主"
}
service
{
"type":"call",
"code":0,
"message":"调用成功",
"data": [
'member_id' : 1 // 广播出去的,谁叫的地主
]
}
client
{
"type":"rob",
"data": [],
"message":"叫地主"
}
service
{
"type":"rob",
"code":0,
"message":"调用成功",
"data": [
'member_id' : 1 // 广播出去的,谁叫的地主
]
}
client
{
"type":"hand",
"data": [
'1-1','2-2','3-2'
],
"message":"出牌"
}
service
出牌就是个验证的过程:
{
"type":"hand",
"code":0,
"message":"调用成功",
"data": []
}
参数默认都是必传的,非必传的会有说明
都是通过POST方式请求
成功的status状态都为0
api
http://dev.landapi.chamshare.cn/member/Publics/authorization
params
{
"code": "asdf",
}
response
# success
{
"status": 0,
"data": {
'url': '标识了用户信息的链接' // 注意该链接中的用户标识只有五分钟有效
},
"message": "调用成功"
}
# error // 1003跳转绑定手机号,其它错误弹框提示
{
"status": 1003,
"data": {
'openid': '绑定手机号时用到'
},
"message": "调用成功"
}
api
http://dev.landapi.chamshare.cn/member/Publics/sendSms
params
{"phone" : "18221998888"}
response
{
"status": 3,
"data": [],
"message": "手机号码格式不正确"
}
api
http://dev.landapi.chamshare.cn/member/Publics/binding
params
{
"phone" : "18221998888",
"code" : "验证码",
"openid" : “”,
}
response
{
"status": 0,
"data": {
'url': '标识了用户信息的链接' // 注意该链接中的用户标识只有五分钟有效
},
"message": "调用成功"
}
api
http://dev.landapi.chamshare.cn/member/Publics/getAppid
response
{
"status": 0,
"data": {
'app_id': '用户端id'
},
"message": "调用成功"
}
api
http://landapi.chamshare.cn/member/Publics/setAnti
param
{
"card_id": '身份证号',
"realname": "真实姓名",
"openid"
}
response
{
"status": 0,
"data": {
'app_id': '用户端id'
},
"message": "调用成功"
}
api
http://dev.landapi.chamshare.cn/member/Publics/login
跳转获得user_key的链接 http://landclient.chamshare.cn/ (注意:必须在微信客户端打开)
param
{
"user_key": '身份证号',
}
response
{
"type":"login",
"code":0, // 非0代表有错误,比如用户被禁用,数据验证不通过,用户key过期
"message":"调用成功",
"data":{
"nickname":"菜问",
"avatar":"http://wx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTKcthg7CBtDdA9eL8dibXXhYQhbKKXbpAEhNQylJAvXMSzF5ud2txpHoAb4HsXOZoMJezqqDlOJXuA/0",
"longbi":0, # 龙币
"longjing":0, # 龙晶
"token" : 'uuuuuuu',
"signData":{
"is_signed":0, # 今日是否已签到,如果为0就要弹出签到页面
"continuous":0 # 签到了多少天
}
}
}
api
http://landapi.chamshare.cn/member/Member/longbiAdd
http://landapi.chamshare.cn/member/Member/longbiSub
param
{
"value": '积分值',
"source": 2
"token" : '用户token'
}