---
# System prepended metadata

title: 哈希百家樂

---

# 哈希百家樂

## 定義表

## client -> server

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

### RoomStatus

请求参数:

    {
      "svr": "baccarat",              // <string> 游戏名
      "route": "baccarat.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: 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: 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: 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": {
    "2": {
      "id": 2,
      "name": "B102",
      "gametype_name": "哈希百家樂",
      "from_wallet": "TCTfPcF1wTRDK1qFAb7w2zGjF11WE9v8DA",
      "to_wallet": "TRCJhQw5u4F3wZ1PkY199p3jm2XN4WjKYR",
      "bet_level": [
        100000,
        200000,
        300000,
        400000
      ],
      "player_bet_upper_limit": [
        900000,
        900000,
        900000,
        900000
      ],
      "player_bet_lower_limit": [
        100000,
        100000,
        100000,
        100000
      ],
      "area_bet_upper_limit": [
        100000000000,
        100000000000,
        100000000000,
        100000000000
      ]
    }
  },
  "err": ""
}
```
    

### JoinGame

请求参数: 

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

```
{
  "svr": "",
  "route": "",
  "cbId": 3,
  "args": {
    "info": {
      "id": 2,
      "name": "B102",
      "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"
    },
    "player_count": 1,
    "history": {
      "history": [
        [
          1, // 閒
          0, // 莊
          0, // 和
          0, // 對
          0  // 棄局
        ]
      ]
    },
    "room_chips": [
      0,
      0,
      0,
      0
    ],
    "bets": [
      0,
      0,
      0,
      0
    ],
    "room_remain_chips": [
      20000000000,
      20000000000,
      20000000000,
      20000000000
    ],
    "round_uuid": "BBJB1022208050943",
    "bet_ratio": [
      0, 閒
      0, 莊
    ]
  },
  "err": null
}
```

### Leave

请求参数: 

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

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

### Bet

请求参数: 

    {
      "svr": "baccarat",
      "route": "baccarat.bet",
      "args": {
          "bets":[0,0,100000,0], // 閑,莊,和,任意對子
          "room_id":2
      },
      "cbId": 3
    }


返回数据:
  
```
{
  "svr": "",
  "route": "",
  "cbId": 3,
  "args": {
    "room_chips": [
      130000000,
      0,
      0,
      0
    ],
    "room_remain_chips": [
      19870000000,
      20130000000,
      20000000000,
      20000000000
    ],
    "my_bets": [
      130000000,
      0,
      0,
      0
    ],
    "before_balance": 27855000000,
    "after_balance": 27845000000,
    "bet_ratio": [
      100,
      0
    ]
  },
  "err": null
}

``````


## server -> client


 RestStage
 推送时间: 休息阶段开始
route:"baccarat.restStage"

```
{
  "svr": "",
  "route": "baccarat.restStage",
  "cbId": 0,
  "args": {
    "cd": 5,
    "cd_max": 5,
    "msg": "等待開局",
    "round_uuid": "BBJB1022207270313"
  },
  "err": ""
}

```
### RestStageMid

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

route:"baccarat.restStageMid"

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


### BetStage
推送时间: 下注阶段开始
route:"baccarat.restStage"
```

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

```
### BetStageMid

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

route:"baccarat.restStageMid"


```
{
  "svr": "",
  "route": "baccarat.betStageMid",
  "cbId": 0,
  "args": {
    "cd": 10,
    "cd_max": 25,
    "msg": "開放下注"
  },
  "err": ""
}
```
### HashStage

推送时间: 開始取得哈希

route:"baccarat.restStage"

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

### HashStageMid

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

route:"baccarat.restStageMid"

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

### SettleStage

推送时间: 結算
```

{
  "svr": "",
  "route": "baccarat.settleStage",
  "cbId": 0,
  "args": {
    "cd": 25,
    "cd_max": 25,
    "msg": "結算階段",
    "block_hash": "000000000194c51f8e7dba4df2d283d3e74825f71af8cd3da1486cef58ee0e14",
    "block_number": 26527007,
    "block_tx_id": "80a0ed287cb1d56dcaed747ea7aa26fe339291d23747c878c8a7bd2f9b8d6d81",
    "banker_cards": [
      {
        "code": 26,
        "color": 3,
        "point": 1,
        "value": 1
      },
      {
        "code": 7,
        "color": 1,
        "point": 8,
        "value": 8
      },
      {
        "code": 52,
        "color": 0,
        "point": 0,
        "value": 0
      }
    ],
    "player_cards": [
      {
        "code": 16,
        "color": 2,
        "point": 4,
        "value": 4
      },
      {
        "code": 9,
        "color": 1,
        "point": 10,
        "value": 0
      },
      {
        "code": 52,
        "color": 0,
        "point": 0,
        "value": 0
      }
    ],
    "draw_type": 0,
    "draw_type_name": "不補",
    "win_area": [
      0,
      1,
      0,
      0
    ]
  },
  "err": null
}
```


### SettleStageMid

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

```
 {
  "svr": "",
  "route": "baccarat.settleStageMid",
  "cbId": 0,
  "args": {
    "cd": 15,
    "cd_max": 25,
    "msg": "结算完成",
    "block_hash": "000000000194c5b2ec2bdf17b96215d5a84179a311a1b2cd9024f1d406c44422",
    "block_number": 26527154,
    "block_tx_id": "dadacad1b05baf8ecd1ea090614696a3587893436bc9219b75ed87249f04da04",
    "banker_cards": [
      {
        "code": 14,
        "color": 2,
        "point": 2,
        "value": 2
      },
      {
        "code": 16,
        "color": 2,
        "point": 4,
        "value": 4
      },
      {
        "code": 52,
        "color": 0,
        "point": 0,
        "value": 0
      }
    ],
    "player_cards": [
      {
        "code": 1,
        "color": 1,
        "point": 2,
        "value": 2
      },
      {
        "code": 29,
        "color": 3,
        "point": 4,
        "value": 4
      },
      {
        "code": 52,
        "color": 0,
        "point": 0,
        "value": 0
      }
    ],
    "draw_type": 1,
    "draw_type_name": "不補",
    "win_area": [
      0,
      0,
      1,
      0
    ]
  },
  "err": null
}

```
### RoomPlayerCounter
推送时间: 每n秒同步給房內玩家

route: "baccarat.roomPlayerCounter"


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


### ChangeStage

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

route: "baccarat.changeStage"


### RoomPlayerBet

    {
      "svr": "",
      "route": "baccarat.roomPlayerBet",
      "cbId": 0,
      "args": {
        "room_chips": [ // 閑,莊,和,任意對子
          0,
          0,
         100000 
          0,
        ],
        "player_id": 1478285, // 內部id
        "nickname": "12345678", // 玩家暱稱
        "bets": [
          0,
          0,
          0,
          100000
        ],
        "room_remain_chips": [
          100000000000,
          100000000000,
          99999900000,
          100000000000,
        ],
        "bet_ratio": [
          100,
          0
        ]
      },
      "err": ""
    }

### SettleReport

```
 {
  "svr": "",
  "route": "baccarat.settleReport",
  "cbId": 0,
  "args": {
    "id": "BBJB1022207280489-01478285",
    "round_uuid": "BBJB1022207280489",
    "game_type": 16,
    "game_code": "BBJ",
    "game_name": "哈希百家樂",
    "room_id": 2,
    "round": 489,
    "sub_round": 0,
    "player_id": 1478285,
    "dealer_id": 0,
    "total_bet": 100000,
    "you_xiao_tou_zhu": 0,
    "you_xiao_ying_fen": 0,
    "total_winlose": 0,
    "bets": [
      0,
      100000,
      0,
      0
    ],
    "prepay": 0,
    "winloses": [
      0,
      0,
      0,
      0
    ],
    "date": "",
    "created_at": "2022-07-28T09:33:04.187482606+08:00",
    "type": 1,
    "status": 1
  },
  "err": ""
}
```