webGameApi.md 5.2 KB

WebGame 渠道 API 文档

渠道信息

  • 渠道ID: 25
  • 渠道名称: WebGame
  • 服务器地址: https://serverkfhero.3ligame.com/api

1. 账号登录(WebGame)

接口地址

  • POST https://serverkfhero.3ligame.com/api/thirdLogin

请求参数(JSON Body)

参数 类型 必填 说明
channel_id number/string 固定传 25
uid string 用户ID
token string 登录凭证(当前不校验)
device_no string 设备号
reg_device string 注册设备信息
device_type string 设备类型
device_model string 设备型号
device_version string 设备版本
system_version string 系统版本
platform string 平台ID(落库用,可不传)

请求示例

POST https://serverkfhero.3ligame.com/api/thirdLogin
Content-Type: application/json

{
  "channel_id": 25,
  "uid": "test%401234",
  "token": "any_token"
}

响应示例

{
  "code": 1,
  "msg": "success",
  "data": {
    "uid": "test@1234",
    "platform": "unknown"
  }
}

2. 获取游戏 URL(getGameUrl)

接口地址

  • POST https://serverkfhero.3ligame.com/api/webgame/gameUrl

请求参数(JSON Body)

参数 类型 必填 说明
uid string 用户ID
platform string 平台ID
time number/string 时间戳
back_url string 登录失败跳转 URL
type string 登录类型:web / pc
gkey string 游戏名缩写
skey string 区服ID
is_adult string/number 防沉迷标识
exts string 透传参数
device_no string 设备号
reg_device string 注册设备信息
device_type string 设备类型
device_model string 设备型号
device_version string 设备版本
system_version string 系统版本

请求示例

POST https://serverkfhero.3ligame.com/api/webgame/gameUrl
Content-Type: application/json

{
  "uid": "test%401234",
  "platform": "4399",
  "time": 1710000000,
  "back_url": "https://www.example.com/back",
  "type": "web",
  "exts": "a=1&b=2"
}

响应示例

{
  "code": 1,
  "msg": "success",
  "data": {
    "gameUrl": "https://.../login.html?uid=test%401234&platform=4399&time=1710000000&back_url=https%3A%2F%2Fwww.example.com%2Fback&type=web&exts=a%3D1%26b%3D2&sign=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
  }
}

3. WebGame 权限校验(客户端仅传 sign)

接口地址

  • GET/POST https://serverkfhero.3ligame.com/api/webgame/auth

请求参数

参数 类型 必填 说明
sign string gameUrl 上取到的 sign

请求示例

GET https://serverkfhero.3ligame.com/api/webgame/auth?sign=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

响应示例(成功)

{
  "code": 1,
  "msg": "success",
  "data": {
    "uid": "test@1234",
    "platform": "4399",
    "time": "1710000000",
    "gkey": "cssg",
    "skey": "1",
    "is_adult": "1",
    "exts": "a=1&b=2"
  }
}

响应示例(失败)

{
  "code": 0,
  "msg": "签名无效或已过期",
  "data": null
}

4. 支付回调接口(WebGame)

接口地址

  • GET/POST https://serverkfhero.3ligame.com/api/callback

请求参数(Body 或 Query 均可,建议 POST Body)

参数 类型 必填 说明
channel_id number/string 固定传 25
id string 渠道侧支付单号
user_id string 渠道侧用户ID(当前逻辑不参与验签)
game_order string 我方订单号(用于发货)
status string 支付状态,需为 completed 才会发货
amount string/number 支付金额(元)
sign string 支付回调签名

请求示例

POST https://serverkfhero.3ligame.com/api/callback?channel_id=25
Content-Type: application/json

{
  "id": "pay_123",
  "user_id": "u_1",
  "game_order": "CP202601010101010001",
  "status": "completed",
  "amount": "6.00",
  "sign": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}

响应示例

{
  "code": 1,
  "msg": "发货成功",
  "data": {}
}

5. 角色查询(getUserRoleList)

接口地址

  • GET https://serverkfhero.3ligame.com/api/getUserRoleList

请求参数(Query)

参数 类型 必填 说明
uid string 用户ID
channel_id number/string 渠道ID(不传默认 1;WebGame 建议传 25

请求示例

GET https://serverkfhero.3ligame.com/api/getUserRoleList?uid=test%401234&channel_id=25

响应示例(成功)

{
  "code": 1,
  "msg": "请求成功",
  "data": [
    {
      "roleId": "10001",
      "roleName": "张三",
      "zhandouli": 123456,
      "serverName": "S1",
      "serverId": 1,
      "createTime": "2026-04-20 12:00:00"
    }
  ]
}

响应示例(无角色)

{
  "code": 1,
  "msg": "请求成功",
  "data": []
}