msdk 的 skan 归因逻辑迁移到 nsdk(Go)需要这两个接口, 对应 PHP 侧 GaoreSDK\Package\Stat 的同名方法: - DeviceAttribution: POST JSON 到 /api/device/attribution, 上报各媒体的设备归因结果(内部推入 kafka)。各媒体上报字段集合 与类型差异较大,PHP 侧直接传关联数组,故请求体以 map 承载而不 收敛成结构体,避免类型转换导致上报内容与 PHP 不一致。 - GetGameAppByGameIdChannel: POST 表单到 /api/game/getGameAppByGameIdChannel,按游戏与渠道取媒体投放 账号配置,腾讯归因查询需要其中的 access_token。 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
80 lines
2.5 KiB
Go
80 lines
2.5 KiB
Go
package stat
|
||
|
||
import (
|
||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
|
||
)
|
||
|
||
// DeviceAttributionReq 设备归因数据上报请求。
|
||
//
|
||
// 各媒体上报的字段集合与类型差异较大(PHP 侧直接传关联数组),
|
||
// 这里以 map 承载而不收敛成结构体,避免类型转换导致上报内容与 PHP 不一致。
|
||
type DeviceAttributionReq struct {
|
||
*requests.JsonRequest
|
||
}
|
||
|
||
type DeviceAttributionResp struct {
|
||
*responses.BaseResponse
|
||
Code int `json:"code"`
|
||
Msg string `json:"msg"`
|
||
}
|
||
|
||
// CreateDeviceAttributionReq 创建设备归因上报请求。
|
||
// 对应 PHP GaoreSDK\Package\Stat::deviceAttribution,POST JSON 到 /api/device/attribution。
|
||
func CreateDeviceAttributionReq(data map[string]any) *DeviceAttributionReq {
|
||
req := &DeviceAttributionReq{JsonRequest: &requests.JsonRequest{}}
|
||
req.InitWithApiInfo(HOST, VERSION, "api/device/attribution")
|
||
req.Method = requests.POST
|
||
for k, v := range data {
|
||
req.JsonParams[k] = v
|
||
}
|
||
return req
|
||
}
|
||
|
||
func CreateDeviceAttributionResp() *DeviceAttributionResp {
|
||
return &DeviceAttributionResp{
|
||
BaseResponse: &responses.BaseResponse{},
|
||
}
|
||
}
|
||
|
||
// GetGameAppByGameIdChannelReq 按游戏与渠道获取媒体投放账号配置。
|
||
type GetGameAppByGameIdChannelReq struct {
|
||
*requests.RpcRequest
|
||
GameId int64 `position:"Body" field:"game_id" json:"game_id"`
|
||
Channel string `position:"Body" field:"channel" json:"channel"`
|
||
}
|
||
|
||
type GetGameAppByGameIdChannelResp struct {
|
||
*responses.BaseResponse
|
||
Code int `json:"code"`
|
||
Msg string `json:"msg"`
|
||
Data GameAppInfo `json:"data"`
|
||
}
|
||
|
||
// GameAppInfo 媒体投放账号配置,腾讯归因查询需要其中的 access_token。
|
||
type GameAppInfo struct {
|
||
AccountId string `json:"account_id"`
|
||
AppId string `json:"app_id"`
|
||
AccessToken string `json:"access_token"`
|
||
}
|
||
|
||
// CreateGetGameAppByGameIdChannelReq 创建媒体投放账号查询请求。
|
||
// 对应 PHP GaoreSDK\Package\Stat::getGameAppByGameIdChannel,
|
||
// POST 表单到 /api/game/getGameAppByGameIdChannel。
|
||
func CreateGetGameAppByGameIdChannelReq(gameId int64, channel string) *GetGameAppByGameIdChannelReq {
|
||
req := &GetGameAppByGameIdChannelReq{
|
||
RpcRequest: &requests.RpcRequest{},
|
||
GameId: gameId,
|
||
Channel: channel,
|
||
}
|
||
req.InitWithApiInfo(HOST, VERSION, "api/game/getGameAppByGameIdChannel")
|
||
req.Method = requests.POST
|
||
return req
|
||
}
|
||
|
||
func CreateGetGameAppByGameIdChannelResp() *GetGameAppByGameIdChannelResp {
|
||
return &GetGameAppByGameIdChannelResp{
|
||
BaseResponse: &responses.BaseResponse{},
|
||
}
|
||
}
|