開啟遊戲
為會員生成遊戲啟動 URL。
API 信息
- 端點:
POST /v2/opengame - 認證:Bearer Token
- 加密:請求使用 AES-256-GCM 加密,響應為明文 JSON
請求
請求標頭
POST /v2/opengame HTTP/1.1
Host: api.example.com
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
x-agentid: integratorNBTest04
x-timestamp: 1769746894501
x-nonce: 56ffd5ecd8a3a4457863a0bd7c298fb2
x-signature: c25f8d23704373e8776cce6d9b10f1fde091c34db80d60523c7e04ff30e54633
請求參數
加密前的參數
{
"deviceType": 0,
"ipaddress": "35.200.72.205",
"lang": "en",
"lobbyUrl": "https://example.com",
"gameCode": "VP_230001_1",
"launchType": 1,
"username": "testaccount01"
}
加密後的請求體
{
"cipherText": "G0ZMDELeJwx+7JcIfIFOLJjkSzANPu6krGM2uw==..."
}
| 欄位 | 類型 | 必填 | 說明 |
|---|---|---|---|
deviceType | number | 是 | 設備類型:0 = PC,1 = 行動裝置 |
ipaddress | string | 是 | 玩家 IP 地址(僅能帶入一個 IP 地址) |
lang | string | 是 | 遊戲界面語言 |
gameCode | string | 是 | 遊戲代碼 |
launchType | number | 是 | 啟動類型:0 = both,1 = demo,2 = real |
lobbyUrl | string | 否 | 遊戲結束後返回的大廳 URL(必須使用 https) |
username | string | 否 | 會員帳號(當 launchType 為 1 時允許為空或不帶) |
響應
成功響應
{
"code": 0,
"message": "No error.",
"data": {
"gameLaunchHtml": null,
"gameLaunchUrl": "https://staggp.zzzstkk.com/game/230001/3.55.0?a=integratorNBTest04_VPSysDevTest010&g=230001&p=3UWzoOtmcKcdZbQnEiHwHbBn9i3w4y__R_DuvopsoYemrFfczHqZGciqR5YvDkTn...",
"mode": "real"
},
"logUUID": "23c50208-cd0f-4daa-be3c-f346da188107"
}
響應欄位說明
| 欄位 | 類型 | 說明 |
|---|---|---|
data.gameLaunchHtml | string | null | 遊戲啟動的 HTML 內容(部分遊戲使用,通常為 null) |
data.gameLaunchUrl | string | 遊戲啟動 URL(在新窗口或 iframe 中打開) |
data.mode | string | 遊戲模式:"real"(真錢模式)或 "demo"(試玩模式) |
錯誤響應
當請求失敗時,會返回對應的錯誤代碼。
錯誤代碼
| 狀態碼 | 說明 | 處理建議 |
|---|---|---|
| 5 | Game is not found | 遊戲不存在、已下線或不支援該幣別,請確認 gameCode 是否正確 |
| 7 | Internal server error | 系統內部錯誤,請稍後重試或聯繫技術支援 |
| 8 | The User is not exist | 會員不存在,請先創建會員 |
| 11 | Parameters error | 請確認請求參數完整且格式正確 |
| 19 | Invalid account | 帳號無效,請檢查會員帳號 |
| 81 | Branch config not found | 分支配置未找到,請聯繫技術支援 |
| 82 | Please check siteId is for this player | 請確認 siteId 是否對應該玩家 |
錯誤響應範例
{
"code": 5,
"message": "Game is not found",
"logUUID": "24cdc3b9-9fe8-44de-8391-a96863e46954"
}
{
"code": 8,
"message": "The User is not exist",
"logUUID": "24cdc3b9-9fe8-44de-8391-a96863e46954"
}
注意事項
特別注意
-
ipaddress 使用限制:
- 僅能帶入一個 IP 地址
- 若 launchType 為 1(demo 模式)時,可帶入虛擬 IP
-
username 與 launchType 的關係:
- 當 launchType 為 1(demo 模式)時,username 才允許為空或不帶
- 當 launchType 為 0(both)或 2(real)時,username 必須提供
-
lobbyUrl 格式要求:
- 若提供 lobbyUrl,網址必須使用 https 協議
一般注意事項
-
URL 有效期:
- 遊戲 URL 通常在 5 分鐘內有效
- 過期後需要重新獲取
- 一個 URL 只能使用一次
-
返回處理:
- lobbyUrl 會在玩家關閉遊戲時使用
- 建議設置為遊戲大廳頁面
-
模遊玩式:
- 當 launchType 為 2(real)時,可選擇遊玩正式模式
- 當 launchType 為 1(demo)時,可選擇遊玩試玩模式
- 當 launchType 為 0(both)時,玩家可於遊戲畫面選擇遊玩正式或是試玩模式
- 遊玩試玩模式可不帶入玩家帳號,有帶入可於遊戲內跳轉到正式模式中
-
並發限制:
- 同一會員同時只能開啟一個遊戲連結(不支援雙開)
- 開啟新遊戲會自動關閉舊連結