Combo Game 接口
获取游戏列表
商户需要从 Combo Game 获取游戏列表及游戏信息时由商户发起调用
不需要通过接口获取游戏列表信息的商户无需使用此接口
请求格式
请求地址: {COMBO_GAME_API_HOST}/v1/game/list
请求方式: POST
编码格式: Content-Type: application/json;charset=UTF-8
接口域名 COMBO_GAME_API_HOST 请联系商务获取
| 参数 | 类型 | 说明 |
|---|---|---|
| appId | int | 商户 App ID |
| ts | long | 当前时间戳毫秒,允许不超过 60 秒时差 |
| sign | string | MD5 小写字符串 |
{
"appId": 12345678,
"ts": 1750151429551,
"sign": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}签名算法
sign = MD5(appId + ts + appKey)
示例代码
public static String sign(int appId, long ts, String appKey) {
try {
MessageDigest digest = MessageDigest.getInstance("MD5");
String sourceString = String.format(Locale.CHINA, "%d%d%s", appId, ts, appKey);
return bytesToHex(digest.digest(sourceString.getBytes(StandardCharsets.UTF_8)));
} catch (Exception e) {
System.out.println("加密失败");
}
return null;
}
private static final byte[] HEX_ARRAY = "0123456789abcdef".getBytes(StandardCharsets.US_ASCII);
public static String bytesToHex(byte[] bytes) {
byte[] hexChars = new byte[bytes.length * 2];
for (int j = 0; j < bytes.length; j++) {
int v = bytes[j] & 0xFF;
hexChars[j * 2] = HEX_ARRAY[v >>> 4];
hexChars[j * 2 + 1] = HEX_ARRAY[v & 0x0F];
}
return new String(hexChars, StandardCharsets.UTF_8);
}h := md5.New()
h.Write([]byte(fmt.Sprintf("%d%d%s", appId, ts, appKey)))
sign := hex.EncodeToString(h.Sum(nil))返回格式
编码格式: Content-Type: application/json;charset=UTF-8
| 字段 | 类型 | 含义 | 说明 |
|---|---|---|---|
| code | int | 错误码 | 详见错误码页 |
| msg | string | 错误信息 | 成功时为 OK |
| data | object | ||
| data.list | array | 游戏列表 | |
| data.list[i].id | int | 游戏 ID | |
| data.list[i].name | string | 游戏名称 | |
| data.list[i].icon | string | 游戏图标 | |
| data.list[i].type | int | 游戏类型 | 目前仅有 type=1 一种类型,未来会有更多类型 |
| data.list[i].screenOrientation | int | 游戏支持的屏幕方向 | 0 横竖屏,1 竖屏,2 横屏 |
| data.list[i].safeWidth | int | 游戏支持的最小屏幕宽度 | 单位为像素 |
| data.list[i].safeHeight | int | 游戏支持的最小屏幕高度 | 单位为像素 |
| data.list[i].url | string | 游戏 H5 URL | 未联系商务配置该 App 的该游戏时为 null |
| data.list[i].zipUrl | string | 游戏包 Zip URL | 未联系商务配置该 App 的该游戏时为 null,仅对需要 zip 接入的商户返回该字段 |
| data.list[i].version | string | 游戏版本号 | 未联系商务配置该 App 的该游戏时为 null,格式为 x.x.x,例如 1.0.12 |
| data.list[i].enabled | boolean | 游戏是否启用 | 未联系商务配置该 App 的该游戏时为 false,游戏维护时也为 false |
{
"code": 0,
"msg": "OK",
"data": {
"list": [
{
"id": 1001,
"name": "Greedy Box",
"icon": "https://xxx.com/xxx.png",
"type": 1,
"screenOrientation": 0,
"safeWidth": 750,
"safeHeight": 750,
"url": "https://xxx.com/xxx/index.html",
"zipUrl": "https://xxx.com/xxx/xxx.zip",
"version": "1.0.9",
"enabled": true
}
]
}
}