跳到主要内容

开启游戏

为会员生成游戏启动 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==..."
}
欄位类型必填说明
deviceTypenumber设备类型:0 = PC,1 = 行动裝置
ipaddressstring玩家 IP 地址(僅能带入一个 IP 地址)
langstring游戏界面语言
gameCodestring游戏代码
launchTypenumber启动类型:0 = both,1 = demo,2 = real
lobbyUrlstring游戏结束后返回的大厅 URL(必须使用 https)
usernamestring会员账号(当 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"
}
欄位类型说明
gameLaunchHtmlstring | null游戏启动的 HTML 內容(部分游戏使用,通常为 null)
gameLaunchUrlstring游戏启动 URL(在新窗口或 iframe 中打开)
modestring游戏模式:"real"(真钱模式)或 "demo"(试玩模式)
logUUIDstring请求追蹤 ID,用于问题排查和日誌查询

错误响应

当请求失敗时,会返回对应的错误代码。

错误代码

状态码说明处理建议
5Game is not found游戏不存在、已下线或不支援该币别,请确认 gameCode 是否正确
7Internal server error系统內部错误,请稍后重试或聯繫技术支援
8The User is not exist会员不存在,请先創建会员
11Parameters error请确认请求参数完整且格式正确
19Invalid account账号无效,请检查会员账号
81Branch config not found分支配置未找到,请聯繫技术支援
82Please 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"
}

注意事项

特别注意

  1. ipaddress 使用限制

    • 僅能带入一个 IP 地址
    • 若 launchType 为 1(demo 模式)时,可带入虛拟 IP
  2. username 与 launchType 的关係

    • 当 launchType 为 1(demo 模式)时,username 才允许为空或不带
    • 当 launchType 为 0(both)或 2(real)时,username 必须提供
  3. lobbyUrl 格式要求

    • 若提供 lobbyUrl,网址必须使用 https 协议

一般注意事项

  1. URL 有效期

    • 游戏 URL 通常在 5 分钟內有效
    • 过期后需要重新获取
    • 一个 URL 只能使用一次
  2. 返回处理

    • lobbyUrl 会在玩家关闭游戏时使用
    • 建议设置为游戏大厅页面
  3. 模游玩式

    • 当 launchType 为 2(real)时,可选择游玩正式模式
    • 当 launchType 为 1(demo)时,可选择游玩试玩模式
    • 当 launchType 为 0(both)时,玩家可于游戏畫面选择游玩正式或是试玩模式
    • 游玩试玩模式可不带入玩家账号,有带入可于游戏內跳转到正式模式中
  4. 并发限制

    • 同一会员同时只能开启一个游戏连结(不支援双开)
    • 开启新游戏会自动关闭舊连结

相关 API