游戏关键行为上报
备注
此部分功能可选接入,请根据游戏内容与平台人员沟通是否需要接入这些功能。
游戏方服务端主动上报玩家升级、过关行为,以供平台运营需要。需要尽量做到实时上报。
游戏行为上报
请求地址
https://youxi.xunlei.com/api/gamebox/v1/data/report
请求体概述
- HTTP 请求方法:
POST
- HTTP 请求标头:
Content-Type: application/json
请求参数说明
参数名 | 类型 | 说明 | 示例 |
---|---|---|---|
report_type | string | 上报类型,固定为"GameAction" | |
game_action_payload | object | 详见下面GameActionPayload类型参数说明 | |
platform | string | 平台类型标识,固定为gamebox | |
user_id | int64 | 平台用户id,登陆时有传给游戏方 |
GameActionPayload类型参数说明
参数名 | 类型 | 说明 | 示例 |
---|---|---|---|
event | string | 事件类型,上报升级事件取"LevelUp", 上报过关事件取"ClearStage" | |
game_id | string | 平台游戏 ID | test |
info | object | 事件详细信息,详见下面Info类型参数说明 | |
timestamp | int64 | 发生关键行为的时间戳 | 1745756612 |
Info类型参数说明
参数名 | 类型 | 说明 | 示例 |
---|---|---|---|
role_id | string | 玩家角色 ID,必填 | |
role_name | string | 玩家角色名称 | |
server_id | string | 区服 ID | |
server_name | string | 区服名称 | |
stage | int | 本次过关的关卡,若事件类型为"ClearStage"时必填 | 55 |
original_stage | int | 原本所在的关卡,若事件类型为"ClearStage"时必填 | 50 |
level | int | 本次升级的等级,若事件类型为"LevelUp"时必填 | 55 |
original_level | int | 原本所在的等级,若事件类型为"LevelUp"时必填 | 55 |
升级上报请求示例
curl --location 'https://youxi.xunlei.com/api/gamebox/v1/data/report?platform=gamebox' \
--header 'Content-Type: application/json' \
--data '{
"report_type": "GameAction",
"game_action_payload": {
"event": "LevelUp",
"game_id": "test",
"info":{
"role_id":"test2",
"level":55 ,
"original_level":50,
},
"timestamp": 1745756612
},
"platform": "gamebox",
"user_id":1234567
}'
过关上报请求示例
curl --location 'https://youxi.xunlei.com/api/gamebox/v1/data/report?platform=gamebox' \
--header 'Content-Type: application/json' \
--data '{
"report_type": "GameAction",
"game_action_payload": {
"event": "ClearStage",
"game_id": "test",
"info":{
"role_id":"test2",
"stage":55,
"original_stage":50,
},
"timestamp": 1745756612
},
"platform": "gamebox",
"user_id":1234567
}'
响应示例
{
"code": 0,
"message": "ok"
}
响应参数说明
参数 | 类型 | 说明 |
---|---|---|
code | int32 | 业务码 |
message | string | 业务信息 |