---
# System prepended metadata

title: 哈希足球

---

# 哈希足球

## 定義表

下注, 輸贏, 籌碼限額 ...
```
  [進球, 防守, 進球左,進球中,進球右,防守左,防守中,防守右,]
```
  

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

### RoomStatus
请求参数:

    {
      "svr": "football",              // <string> 游戏名
      "route": "football.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": {
    "9": {
      "id": 9,
      "name": "B109",
      "gametype_name": "區塊足球",
      "from_wallet": "TRCJhQw5u4F3wZ1PkY199p3jm2XN4WjKYR",
      "to_wallet": "TCTfPcF1wTRDK1qFAb7w2zGjF11WE9v8DA",
      "bet_level": [
        5000000,
        10000000,
        20000000,
        50000000,
        100000000,
        250000000
      ],
      "player_bet_upper_limit": [
        500000000,
        500000000,
        500000000,
        500000000,
        500000000,
        500000000,
        500000000,
        500000000
      ],
      "player_bet_lower_limit": [
        5000000,
        5000000,
        5000000,
        5000000,
        5000000,
        5000000,
        5000000,
        5000000
      ],
      "area_bet_upper_limit": [
        20000000000,
        20000000000,
        20000000000,
        20000000000,
        20000000000,
        20000000000,
        20000000000,
        20000000000
      ]
    }
  },
  "err": null
}
``` 
    
### JoinGame
    
请求参数:
 ```
{
  "svr": "football",
  "route": "football.joinGame",
  "args": {
  "room_id":9
      },
  "cbId": 3
    }
```
返回数据:
```
{
  "svr": "",
  "route": "",
  "cbId": 3,
  "args": {
    "info": {
      "id": 9,
      "name": "B109",
      "gametype_name": "區塊足球",
      "from_wallet": "TRCJhQw5u4F3wZ1PkY199p3jm2XN4WjKYR",
      "to_wallet": "TCTfPcF1wTRDK1qFAb7w2zGjF11WE9v8DA",
      "bet_level": [
        5000000,
        10000000,
        20000000,
        50000000,
        100000000,
        250000000
      ],
      "player_bet_upper_limit": [
        500000000,
        500000000,
        500000000,
        500000000,
        500000000,
        500000000,
        500000000,
        500000000
      ],
      "player_bet_lower_limit": [
        5000000,
        5000000,
        5000000,
        5000000,
        5000000,
        5000000,
        5000000,
        5000000
      ],
      "area_bet_upper_limit": [
        20000000000,
        20000000000,
        20000000000,
        20000000000,
        20000000000,
        20000000000,
        20000000000,
        20000000000
      ]
    },
    "self": {
      "id": 6241759,
      "nickname": "ktest08"
    },
    "code": "",
    ("code_index": 0,   //忽略)
    "player_count": 1,
    "history": {
      "history": [
        [
          -1,     // 進球
          1,      // 防守
          -1,     // 進球左
          -1,     // 進球中
          -1,     // 進球右
          1,      // 防守左
          -1,     // 防守中
          -1,     // 防守右
          0       // Abandon   
        ],
        [
          1,
          -1,
          -1,
          1,
          -1,
          -1,
          -1,
          -1,
          0
        ],
        [
          1,
          -1,
          -1,
          1,
          -1,
          -1,
          -1,
          -1,
          0
        ],
        [
          1,
          -1,
          -1,
          -1,
          1,
          -1,
          -1,
          -1,
          0
        ],=
      ],
      "win_ratio": [
        55, 進球
        45  防守
      ],
      "good_road": 0,
      "good_road_name": "沒有"
    },
    "room_chips": [
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0
    ],
    "bets": [
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0
    ],
    "room_remain_chips": [
      20000000000,
      20000000000,
      20000000000,
      20000000000,
      20000000000,
      20000000000,
      20000000000,
      20000000000
    ],
    "round_uuid": "BFBB1092208290810",
    "bet_ratio": [
      0, 進球
      0, 防守
    ]
  },
  "err": null
}
```
### Leave

请求参数:
```
   {
      "svr": "football",
      "route": "football.leave",
      "args": {},
      "cbId": 3
    }
```

返回数据:

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

请求参数:
```
 {
  "svr": "football",
  "route": "football.bet",
  "args": {
      "bets":[0,10000000,0,0,0,10000000,0,0], //進球,防守,進球左,進球中,進球右,防守左,防守中,防守右
      "room_id":9
  },
  "cbId": 3
}
```

返回数据:
```
{
  "svr": "",
  "route": "",
  "cbId": 3,
  "args": {
    "room_id": 9,
    "room_chips": [
      0,
      10000000,
      10000000,
      10000000,
      10000000,
      10000000,
      10000000,
      0
    ],
    "room_remain_chips": [
      20010000000,
      19990000000,
      19990000000,
      19990000000,
      19990000000,
      19990000000,
      19990000000,
      20000000000
    ],
    "my_bets": [
      0,
      10000000,
      10000000,
      10000000,
      10000000,
      10000000,
      10000000,
      0
    ],
    "before_balance": 686880000,
    "after_balance": 626880000,
    "bet_ratio": [
      0,
      100
    ]
  },
  "err": null
}
```

## server -> client

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

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

### RestStageMid

推送时间: 中途加入休息阶段
route:"football.restStageMid"

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

推送时间: 下注阶段开始
route:"football.restStage"

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

### BetStageMid

推送时间: 中途加入下注阶段
route:"football.restStageMid"

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

推送时间: 開始取得哈希
route:"football.restStage"

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

推送时间: 中途加入取哈希阶段
route:"football.restStageMid"

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

### SettleStage


```
返回數據:

{"svr":"",
"route":"football.settleStage",
"cbId":0,
"args":{
"cd":23,
"cd_max":23,
"msg":"結算階段",
"block_hash":"00000000019dfed575719b2b87f2cf688fe99285c192b3bde20a225cfba45d1e",
"block_number":27131605,
"block_tx_id":"c07c7e14d7be5815396198699984cdd3cb1ce33cbe0de5a4bdb32e46fac7adfb",
"code":"e",  末一碼
("code_index":0, //忽略)
"win_area":[
     -1,
     1,
     -1,
     -1,
     -1,
     -1,
     -1,
     1
 ],
"win_ratio":[
     47,
     53
   ]
},
"err":null
}
```


### SettleStageMid

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

返回數據:
```
{
  "svr": "",
  "route": "football.settleStageMid",
  "cbId": 0,
  "args": {
    "cd": 16,
    "cd_max": 23,
    "msg": "结算完成",
    "block_hash": "00000000019dfd2e35b5e63ab4ef700d66430b76d6f6859e0250b8af7efd3012",
    "block_number": 27131182,
    "block_tx_id": "dfdcd2930be9e6ffee10941637c711a8bec0b366a44483c6c14cf48a8815a851",
    "code": "2",  末一碼
    ("code_index": 0,  //忽略)
    "win_area": [
      1,
      -1,
      -1,
      1,
      -1,
      -1,
      -1,
      -1
    ],
    "win_ratio": [
      51, 進球
      49, 防守
    ]
  },
  "err": null
}
```
### RoomPlayerCounter

推送时间: 每n秒同步給房內玩家
route: "football.roomPlayerCounter"

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


### ChangeStage

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

返回數據:

```
{
  "svr": "",
  "route": "football.changeStage",
  "cbId": 0,
  "args": {
    "id": 9,
    "stage": 1,
    "stage_name": "下注階段",
    "cd": 13,
    "cd_max": 30,
    "history": {
      "history": [
        [
          1,
          -1,
          1,
          -1,
          -1,
          -1,
          -1,
          -1,
          0
        ],
        [
          1,
          -1,
          -1,
          1,
          -1,
          -1,
          -1,
          -1,
          0
        ],
        [
          -1,
          1,
          -1,
          -1,
          -1,
          -1,
          1,
          -1,
          0
        ],
        [
          1,
          -1,
          -1,
          1,
          -1,
          -1,
          -1,
          -1,
          0
        ],
        [
          -1,
          1,
          -1,
          -1,
          -1,
          -1,
          -1,
          1,
          0
        ],
        [
          1,
          -1,
          -1,
          -1,
          1,
          -1,
          -1,
          -1,
          0
        ],
       ],
      "win_ratio": [
        48,
        52
      ],
      "good_road": 2,
      "good_road_name": "單跳"  
    },
    "player_count": 1, 人數
    "bets": [
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0
    ]
  },
  "err": null
}
```

### SettleReport

返回數據:

```
{
  "svr":"",
  "route":"football.settleReport",
  "cbId":0,
  "args":{
  "id":"BFBB1092208290884-08455549",
  "round_uuid":"BFBB1092208290884",
  "game_type":19,
  "game_code":"BFB",
  "game_name":"區塊足球",
  "room_id":9,
  "round":884,
  "sub_round":0,
  "player_id":8455549,
  "dealer_id":0,
  "total_bet":300000000,
  "you_xiao_tou_zhu":326000000,
  "you_xiao_ying_fen":0,
  "total_winlose":246000000,
  "bets"[
          200000000,
          0,
          20000000,
          20000000,
          20000000,
          20000000,
          20000000,
          0
    ],
 "prepay":0,
 "winloses":
[
        190000000,
        0,
        136000000,
       -20000000,
       -20000000,
       -20000000,
       -20000000,
        0
],

"date":"",
"created_at":"2022-0829T15:39:05.199310721+08:00",
"type":1,
"status":1,
"currency":"TWD"},
"err":null
}
```