---
# System prepended metadata

title: 大小單雙

---

# 大小單雙

## 定義表

下注, 輸贏, 籌碼限額 ...

    [大, 小, 單, 雙]


## client -> server

为cli端请求srv端的cmd, 透过 cbId 做消息配对, 响应后c端先判断 err 字段是否为空作例外处理.

### RoomStatus

请求参数:

    {
      "svr": "bsmall",              // <string> 游戏名
      "route": "bsmall.roomStatus", // <string> 游戏名.的cmd
      "args": null,                 // <any>
      "cbId": 3
    }
    
返回数据:

<table>
  <thead class="ant-table-thead">
    <tr>
      <th key="name" style="width: 500px">名称</th>
      <th key="type">类型</th>
      <th key="required">是否必须</th>
      <th key="default">默认值</th>
      <th key="desc">备注</th>
      <th key="sub">其他信息</th>
    </tr>
  </thead>
  <tbody className="ant-table-tbody">
    <tr key="0-0">
      <td key="0">
        <span style="padding-left: 0px"
          ><span style="color: #8c8a8a"></span> svr</span
        >
      </td>
      <td key="1"><span>string</span></td>
      <td key="2">必须</td>
      <td key="3"></td>
      <td key="4"><span style="white-space: pre-wrap"></span></td>
      <td key="5"></td>
    </tr>
    <tr key="0-1">
      <td key="0">
        <span style="padding-left: 0px"
          ><span style="color: #8c8a8a"></span> route</span
        >
      </td>
      <td key="1"><span>string</span></td>
      <td key="2">必须</td>
      <td key="3"></td>
      <td key="4"><span style="white-space: pre-wrap"></span></td>
      <td key="5"></td>
    </tr>
    <tr key="0-2">
      <td key="0">
        <span style="padding-left: 0px"
          ><span style="color: #8c8a8a"></span> cbId</span
        >
      </td>
      <td key="1"><span>number</span></td>
      <td key="2">必须</td>
      <td key="3"></td>
      <td key="4"><span style="white-space: pre-wrap"></span></td>
      <td key="5"></td>
    </tr>
    <tr key="0-3">
      <td key="0">
        <span style="padding-left: 0px"
          ><span style="color: #8c8a8a"></span> args</span
        >
      </td>
      <td key="1"><span>object</span></td>
      <td key="2">必须</td>
      <td key="3"></td>
      <td key="4"><span style="white-space: pre-wrap"></span></td>
      <td key="5"></td>
    </tr>
    <tr key="0-3-0">
      <td key="0">
        <span style="padding-left: 20px"
          ><span style="color: #8c8a8a">├-</span> 1</span
        >
      </td>
      <td key="1"><span>object</span></td>
      <td key="2">必须</td>
      <td key="3"></td>
      <td key="4"><span style="white-space: pre-wrap"></span></td>
      <td key="5"></td>
    </tr>
    <tr key="0-3-0-0">
      <td key="0">
        <span style="padding-left: 40px"
          ><span style="color: #8c8a8a">├─</span> id</span
        >
      </td>
      <td key="1"><span>number</span></td>
      <td key="2">必须</td>
      <td key="3"></td>
      <td key="4"><span style="white-space: pre-wrap"></span></td>
      <td key="5"></td>
    </tr>
    <tr key="0-3-0-1">
      <td key="0">
        <span style="padding-left: 40px"
          ><span style="color: #8c8a8a">├─</span> name</span
        >
      </td>
      <td key="1"><span>string</span></td>
      <td key="2">必须</td>
      <td key="3"></td>
      <td key="4"><span style="white-space: pre-wrap">房间标题</span></td>
      <td key="5"></td>
    </tr>
    <tr key="0-3-0-2">
      <td key="0">
        <span style="padding-left: 40px"
          ><span style="color: #8c8a8a">├─</span> gametype_name</span
        >
      </td>
      <td key="1"><span>string</span></td>
      <td key="2">必须</td>
      <td key="3"></td>
      <td key="4"><span style="white-space: pre-wrap">游戏代号</span></td>
      <td key="5"></td>
    </tr>
    <tr key="0-3-0-3">
      <td key="0">
        <span style="padding-left: 40px"
          ><span style="color: #8c8a8a">├─</span> from_wallet</span
        >
      </td>
      <td key="1"><span>string</span></td>
      <td key="2">必须</td>
      <td key="3"></td>
      <td key="4"><span style="white-space: pre-wrap">钱包 from</span></td>
      <td key="5"></td>
    </tr>
    <tr key="0-3-0-4">
      <td key="0">
        <span style="padding-left: 40px"
          ><span style="color: #8c8a8a">├─</span> to_wallet</span
        >
      </td>
      <td key="1"><span>string</span></td>
      <td key="2">必须</td>
      <td key="3"></td>
      <td key="4"><span style="white-space: pre-wrap">钱包 to</span></td>
      <td key="5"></td>
    </tr>
    <tr key="0-3-0-5">
      <td key="0">
        <span style="padding-left: 40px"
          ><span style="color: #8c8a8a">├─</span> bet_level</span
        >
      </td>
      <td key="1"><span>number []</span></td>
      <td key="2">必须</td>
      <td key="3"></td>
      <td key="4"><span style="white-space: pre-wrap">筹码 下注阵列</span></td>
      <td key="5">
        <p key="3">
          <span style="font-weight: '700'">item 类型: </span><span>number</span>
        </p>
      </td>
    </tr>
    <tr key="array-1">
      <td key="0">
        <span style="padding-left: 60px"
          ><span style="color: #8c8a8a">├─</span>
        </span>
      </td>
      <td key="1"><span></span></td>
      <td key="2">必须</td>
      <td key="3"></td>
      <td key="4">
        <span style="white-space: pre-wrap">筹码 比值 1: 10000</span>
      </td>
      <td key="5"></td>
    </tr>
    <tr key="0-3-0-6">
      <td key="0">
        <span style="padding-left: 40px"
          ><span style="color: #8c8a8a">├─</span> player_bet_upper_limit</span
        >
      </td>
      <td key="1"><span>number []</span></td>
      <td key="2">必须</td>
      <td key="3"></td>
      <td key="4">
        <span style="white-space: pre-wrap">个人上限 比值 1: 10000</span>
      </td>
      <td key="5">
        <p key="3">
          <span style="font-weight: '700'">item 类型: </span><span>number</span>
        </p>
      </td>
    </tr>
    <tr key="array-2">
      <td key="0">
        <span style="padding-left: 60px"
          ><span style="color: #8c8a8a">├─</span>
        </span>
      </td>
      <td key="1"><span></span></td>
      <td key="2">必须</td>
      <td key="3"></td>
      <td key="4">
        <span style="white-space: pre-wrap"
          >[庄1,庄2,庄3,闲1,闲2,闲3] 比值 1: 10000</span
        >
      </td>
      <td key="5"></td>
    </tr>
    <tr key="0-3-0-7">
      <td key="0">
        <span style="padding-left: 40px"
          ><span style="color: #8c8a8a">├─</span> player_bet_lower_limit</span
        >
      </td>
      <td key="1"><span>number []</span></td>
      <td key="2">必须</td>
      <td key="3"></td>
      <td key="4">
        <span style="white-space: pre-wrap">个人下限 比值 1: 10000</span>
      </td>
      <td key="5">
        <p key="3">
          <span style="font-weight: '700'">item 类型: </span><span>number</span>
        </p>
      </td>
    </tr>
    <tr key="array-3">
      <td key="0">
        <span style="padding-left: 60px"
          ><span style="color: #8c8a8a">├─</span>
        </span>
      </td>
      <td key="1"><span></span></td>
      <td key="2">必须</td>
      <td key="3"></td>
      <td key="4">
        <span style="white-space: pre-wrap"
          >[庄1,庄2,庄3,闲1,闲2,闲3] 比值 1: 10000</span
        >
      </td>
      <td key="5"></td>
    </tr>
    <tr key="0-3-0-8">
      <td key="0">
        <span style="padding-left: 40px"
          ><span style="color: #8c8a8a">├─</span> area_bet_upper_limit</span
        >
      </td>
      <td key="1"><span>number []</span></td>
      <td key="2">必须</td>
      <td key="3"></td>
      <td key="4">
        <span style="white-space: pre-wrap">单区上限 比值 1: 10000</span>
      </td>
      <td key="5">
        <p key="3">
          <span style="font-weight: '700'">item 类型: </span><span>number</span>
        </p>
      </td>
    </tr>
    <tr key="array-4">
      <td key="0">
        <span style="padding-left: 60px"
          ><span style="color: #8c8a8a">├─</span>
        </span>
      </td>
      <td key="1"><span></span></td>
      <td key="2">必须</td>
      <td key="3"></td>
      <td key="4">
        <span style="white-space: pre-wrap"
          >[庄1,庄2,庄3,闲1,闲2,闲3] 比值 1: 10000</span
        >
      </td>
      <td key="5"></td>
    </tr>
    <tr key="0-4">
      <td key="0">
        <span style="padding-left: 0px"
          ><span style="color: #8c8a8a"></span> err</span
        >
      </td>
      <td key="1"><span>string</span></td>
      <td key="2">必须</td>
      <td key="3"></td>
      <td key="4"><span style="white-space: pre-wrap">错误提示</span></td>
      <td key="5"></td>
    </tr>
  </tbody>
</table>


    {
      "svr": "",
      "route": "",
      "cbId": 3,
      "args": {
        "4": {
          "id": 4,
          "name": "B104",
          "gametype_name": "大小單雙",
          "from_wallet": "TCTfPcF1wTRDK1qFAb7w2zGjF11WE9v8DA",
          "to_wallet": "TRCJhQw5u4F3wZ1PkY199p3jm2XN4WjKYR",
          "bet_level": [
            5000000,
            10000000,
            20000000,
            50000000
          ],
          "player_bet_upper_limit": [
            500000000,
            500000000,
            500000000,
            500000000
          ],
          "player_bet_lower_limit": [
            5000000,
            5000000,
            5000000,
            5000000
          ],
          "area_bet_upper_limit": [
            20000000000,
            20000000000,
            20000000000,
            20000000000
          ]
        }
      },
      "err": null
    }
    

### JoinGame

请求参数: 

    {
      "svr": "bsmall",
      "route": "bsmall.joinGame",
      "args": {
        "room_id":4
      },
      "cbId": 3
    }
  
返回数据:

    {
      "svr": "",
      "route": "",
      "cbId": 3,
      "args": {
        "info": {
          "id": 4,
          "name": "B104",
          "gametype_name": "大小單雙",
          "from_wallet": "TCTfPcF1wTRDK1qFAb7w2zGjF11WE9v8DA",
          "to_wallet": "TRCJhQw5u4F3wZ1PkY199p3jm2XN4WjKYR",
          "bet_level": [
            5000000,
            10000000,
            20000000,
            50000000
          ],
          "player_bet_upper_limit": [
            500000000,
            500000000,
            500000000,
            500000000
          ],
          "player_bet_lower_limit": [
            5000000,
            5000000,
            5000000,
            5000000
          ],
          "area_bet_upper_limit": [
            20000000000,
            20000000000,
            20000000000,
            20000000000
          ]
        },
        "self": {
          "id": 4986462,
          "nickname": "jjj333"
        },
        "code": "6", // code = "" 為新局, code = "num"/“abcde" 表示這局結果
        "code_index": 0, // idx = -2 新局, idx = -1 => 通殺,
        "player_count": 1,
        "history": {
          "history": [
            {
              "code": "3",
              "code_index": 0,
              "win_area": [
                -1,
                1,
                1,
                -1
              ],
              "abandon": false
            },
            {
              "code": "6",
              "code_index": 0,
              "win_area": [
                1,
                -1,
                -1,
                1
              ],
              "abandon": false
            }
          ],
          "win_ratio": [
            50,
            50,
            50,
            50
          ]
        },
        "room_chips": [
          0,
          0,
          0,
          0
        ],
        "bets": [
          0,
          0,
          0,
          0
        ],
        "room_remain_chips": [
          20000000000,
          20000000000,
          20000000000,
          20000000000
        ],
        "round_uuid": "BDXB1042208050032"
      },
      "err": null
    }

### Leave

请求参数: 

    {
      "svr": "bsmall",
      "route": "bsmall.leave",
      "args": {},
      "cbId": 3
    }
  
返回数据:

    {
      "svr": "",
      "route": "",
      "cbId": 3,
      "args": "成功啦",      
      "err": ""
    }
    
    

### Bet

请求参数: 

    {
      "svr": "bsmall",
      "route": "bsmall.bet",
      "args": {
          "bets":[100000,0,0,0], 
          "room_id":1
      },
      "cbId": 3
    }


返回数据:

    {
      "svr": "",
      "route": "",
      "cbId": 3,
      "args": {
        "room_chips": [
          10000000,
          0,
          0,
          0
        ],
        "room_remain_chips": [
          19990000000,
          20000000000,
          20000000000,
          20000000000
        ],
        "my_bets": [
          10000000,
          0,
          0,
          0
        ],
        "before_balance": 52800000,
        "after_balance": 42800000
      },
      "err": null
    }


## server -> client

### RestStage

推送时间: 休息阶段开始

route:"bsmall.restStage"

    {
      "svr": "",
      "route": "bsmall.restStage",
      "cbId": 0,
      "args": {
        "cd": 5,
        "cd_max": 5,
        "msg": "等待開局",
        "round_uuid": "BNN-B101-220718172402-0000-0005"
      },
      "err": ""
    }

### RestStageMid

推送时间: 中途加入休息阶段

route:"niuniu.restStageMid"

    {
      "svr": "",
      "route": "bsmall.restStageMid",
      "cbId": 0,
      "args": {
        "cd": 2,
        "cd_max": 5,
        "msg": "等待開局"
      },
      "err": ""
    }

### BetStage

推送时间: 下注阶段开始

route:"niuniu.restStage"

    {
      "svr": "",
      "route": "bsmall.betStage",
      "cbId": 0,
      "args": {
        "cd": 10,
        "cd_max": 25,
        "msg": "開始下注"
      },
      "err": ""
    }

### BetStageMid

推送时间: 中途加入下注阶段

route:"niuniu.restStageMid"

    {
        {
      "svr": "",
      "route": "bsmall.betStageMid",
      "cbId": 0,
      "args": {
        "cd": 23,
        "cd_max": 25,
        "msg": "開放下注"
      },
      "err": ""
    }




### HashStage

推送时间: 開始取得哈希

route:"bsmall.restStage"

    {
      "svr": "",
      "route": "bsmall.hashStage",
      "cbId": 0,
      "args": {
        "cd": 30,
        "cd_max": 30,
        "msg": "等待哈希值"
      },
      "err": ""
    }

### HashStageMid

推送时间: 中途加入取哈希阶段

route:"niuniu.restStageMid"

    {
      "svr": "",
      "route": "bsmall.hashStageMid",
      "cbId": 0,
      "args": {
        "cd": 6,
        "cd_max": 30,
        "msg": "等待哈希值"
      },
      "err": ""
    }

### SettleStage

推送时间: 結算

    {
      "svr": "",
      "route": "bsmall.settleStage",
      "cbId": 0,
      "args": {
        "cd": 23,
        "cd_max": 23,
        "msg": "結算階段",
        "block_hash": "000000000194b4692753bf59ff4186ad39a351063ca2ccc418f84aeb0f3f1229",
        "block_number": 26522729,
        "block_tx_id": "70f16c2b8f07d7f5bc2346ca0c537ef15d1f0267fa130e48221840165e8e0f1c",
        "code": "9",
        "code_index": 0,
        "win_area": [
          1,
          -1,
          1,
          -1
        ],
        "win_ratio": [
          55,
          45,
          30,
          70
        ]
      },
      "err": null
    }
        

### SettleStageMid

推送时间: 中途加入結算階段

    {
      "svr": "",
      "route": "bsmall.settleStageMid",
      "cbId": 0,
      "args": {
        "cd": 0,
        "cd_max": 23,
        "msg": "结算完成",
        "block_hash": "000000000194b3732b9837baefef101a085f971a1f98d81668ed75ede9298a7f",
        "block_number": 26522483,
        "block_tx_id": "eba85c1d8cf4eb507beacdeff031e67bd19e0e4f09d03690a45d26e70802d4ff",
        "code": "7",      // 通殺 為 “abcde"
        "code_index": 1,  // 通殺 為 -1
        "win_area": [
          1,
          -1,
          1,
          -1
        ],
        "win_ratio": [
          55,
          45,
          30,
          70
        ]
      },
      "err": null
    }
    
### RoomPlayerCounter
推送时间: 每n秒同步給房內玩家

route: "niuniu.roomPlayerCounter"


    {
      "svr": "",
      "route": "niuniu.roomPlayerCounter",
      "cbId": 0,
      "args": 1,                           // 人數
      "err": ""
    }

### ChangeStage

推送时间: 加入观察者后, 每局切换都以这个做路子

route: "niuniu.changeStage"



    {
      "svr": "",
      "route": "bsmall.changeStage",
      "cbId": 0,
      "args": {
        "id": 4,
        "stage": 1,
        "stage_name": "下注階段",
        "cd": 6,
        "cd_max": 60,
        "history": {
          "history": [],
          "win_ratio": [
            0,
            0,
            0,
            0
          ]
        },
        "player_count": 0
      },
      "err": null
    }

### RoomPlayerBet

    {
      "svr": "",
      "route": "bsmall.roomPlayerBet",
      "cbId": 0,
      "args": {
        "room_chips": [ 
          0,
          0,
          0,
          100000
        ],
        "player_id": 4637343, // 內部id
        "nickname": "A10", // 玩家暱稱
        "bets": [
          0,
          0,
          0,
          100000
        ],
        "room_remain_chips": [
          100000000000,
          100000000000,
          100000000000,
          99999900000
        ]
      },
      "err": ""
    }

### SettleReport

    {
      "svr": "",
      "route": "bsmall.settleReport",
      "cbId": 0,
      "args": {
        "id": "BDXB1042208050008-04986462",
        "round_uuid": "BDXB1042208050008",
        "game_type": 17,
        "game_code": "BDX",
        "game_name": "大小單雙",
        "room_id": 4,
        "round": 8,
        "sub_round": 0,
        "player_id": 4986462,
        "dealer_id": 0,
        "total_bet": 10000000,
        "you_xiao_tou_zhu": 0,
        "you_xiao_ying_fen": 0,
        "total_winlose": -10000000,
        "bets": [
          10000000,
          0,
          0,
          0
        ],
        "prepay": 0,
        "winloses": [
          -10000000,
          0,
          0,
          0
        ],
        "date": "",
        "created_at": "2022-08-05T14:09:09.288265427+08:00",
        "type": 1,
        "status": 1,
        "currency": "TWD"
      },
      "err": null
    }