webgame-api.md 3.5 KB

WebGame 前端接入接口文档

服务器地址

  • Base URL: https://serverkfhero.3ligame.com/api

1) 角色列表(通用)

请求

  • GET /webGame/getUserRoleList

参数(Query)

参数 类型 必填 说明
uid string 用户ID
channel_id number/string 渠道ID(WebGame 传 25

返回示例

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

2) 登录跳转 URL(WebGame)

请求

  • POST /webgame/loginUrl

参数(JSON Body)

参数 类型 必填 说明
user_id string 用户ID
server_id number/string 区服ID
pid string 平台ID
time number/string 时间戳(秒)
sign string 签名
ext string 透传参数
client string 客户端类型
isAdult number/string 防沉迷标识

返回示例

{
  "code": 1,
  "msg": "success",
  "data": {
    "gameUrl": "https://xxx.xxx.com/webgame/index.html?user_id=...&server_id=...&pid=...&time=...&sign=..."
  }
}

3) 角色查询(WebGame)

请求

  • GET /webgame/roleList

参数(Query)

参数 类型 必填 说明
user_id string 用户ID
pid string 平台ID
server_id number/string 区服ID
time number/string 时间戳(秒)
sign string 签名
role_id string 角色ID(不传则返回该服下该账号所有角色)

返回示例

{
  "code": 1,
  "message": "ok",
  "data": [
    {
      "role_id": "81075519771",
      "name": "encoded_name",
      "lv": 7,
      "sex": "m",
      "vocation": 0,
      "createTime": "2026-04-20 12:00:00",
      "power": 123456
    }
  ]
}

4) 充值下单(WebGame)

请求

  • POST /webgame/createOrder

参数(JSON Body)

参数 类型 必填 说明
user_id string 用户ID
server_id number/string 区服ID
role_id string 角色ID
goods_id string/number 商品ID
goods_name string 商品名
money string/number 金额(元)
extra_info string 透传参数(通常放内部订单号)
time number/string 时间戳(秒)
sign string 签名

返回示例

{
  "code": 1,
  "message": "ok"
}

5) 支付回调(WebGame)

请求

  • POST /webgame/payCallback

参数(JSON Body)

参数 类型 必填 说明
user_id string 用户ID
pid string 平台ID
order_id string 平台订单号
money string/number 金额(元)
time number/string 时间戳(秒)
server_id number/string 区服ID
role_id string 角色ID
extra_info string 透传参数(内部订单号)
sign string 签名

返回示例(成功)

{
  "code": 1,
  "message": "ok"
}

返回示例(失败)

{
  "code": 4,
  "message": "充值失败,请联系客服"
}