---
# System prepended metadata

title: 共同定義

---

# 共同定義


錯誤代碼表

    400101    空的下注
    400102    多幣別下注
    400103    互斥下注
    400104    錯誤的籌碼組合
    400105    已達投注上限
    400106    已達投注上限
    400107    已達投注上限，請稍後再試
    500000    服務器忙碌



| Stage | Name  |
| ----- | ----- |
|   0   | 休息  |
|   1   | 下注  |
|   2   | 洗牌  |
|   3   | 哈希  |
|   4   | 結算  |




相對於各遊戲功能可以共用的 command

client -> server
--

Login
---

**Method：** GET

**接口描述：** 登入, 建立ws连线

wss://api.cool-games.club/internal/217/gw/gateway/login?id=3021802&token=6531970996369563366


| 参数名称 | 是否必须 | 示例 | 备注 |
| - | - | - | - |
| id | Y  | 3021802 | 玩家id |
| token | Y  | 6531970996369563366 | 口令 |


**响应**
    
 成功示例: 

    {
      "svr": "", 
      "route": "MsgHandlers.login",
      "cbId": 0, 
      "args": {
        "id": 5047107,                 # 玩家ID
        "username": "6673377-A05UUID", # agent-username
        "nickname": "A05",             # 昵称
        "group": "97832887",           # 分群 (店 id)
        "is_live": false,              # 入场标志 (皇后特规)
        "vip_room": 0,                 # vip 房间标志 (皇后特规)
        "gold": 0,                     # 忽略, 接入 SyncGold 同步
        "avatar": "0"                  # 头像号
        "currency": "USDT"             # 用點幣別
      },
      "err": ""
    }

失败:

    {
      "svr": "",
      "route": "MsgHandlers.login",
      "cbId": 0,
      "args": null,
      "err": "認證失敗"                 # 失败原因
    }




Gold
---

请求参数:

    {
      "svr": "cpay",
      "route": "cpay.gold",
      "args": null,
      "cbId": 3
    }
       
返回数据: 

    {
      "svr": "",
      "route": "",
      "cbId": 3,
      "args":  10000000000,
      "err": ""
    }
    
    
WatcherJoin
---

    {
      "svr": "watcher",
      "route": "watcher.join",
      "args": {
        "game":["niuniu"],
        "room":[1,2,3,4]
      },
      "cbId": 0
    }
    
***** no return, callback nil

WatcherLeave
---

    {
      "svr": "watcher",
      "route": "watcher.leave",
      "args": {
        "game":["niuniu", "baccarat", "bsmall","drogontiger","football",],
        "room":[1,2,3,4,6,9]
      },
      "cbId": 0
    }

***** no return, callback nil


server -> client
--

Logout 
---

收到 cmd 後1秒會斷開

route: "MsgHandlers.logout"

    {
        "svr": "",
        "route": "MsgHandlers.logout",
        "cbId": 0,
        "args": "賬號在其他設備登入",
        "err": ""
    }

SyncGold
---

同步钱, 登入, 下注, 赢分时候同步

route: "MsgHandlers.syncGold"

    {
      "svr": "",
      "route": "MsgHandlers.syncGold",
      "cbId": 0,
      "args": 1000001500000, 
      "err": ""