219 lines
8.6 KiB
Go
219 lines
8.6 KiB
Go
|
package msdk
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
||
|
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
|
||
|
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/utils"
|
||
|
"time"
|
||
|
)
|
||
|
|
||
|
const msdkKey = "msdk@gaore.com#!!"
|
||
|
|
||
|
type GetIdfaReq struct {
|
||
|
*requests.RpcRequest
|
||
|
ChannelId int `position:"Query" field:"mtype"`
|
||
|
GameId int `position:"Query" field:"game_id"`
|
||
|
GameSign string `position:"Query" field:"game_sign"`
|
||
|
Ip string `position:"Query" field:"ip"`
|
||
|
Imei string `position:"Query" field:"imei"`
|
||
|
Idfa string `position:"Query" field:"idfa"`
|
||
|
Idfv string `position:"Query" field:"idfv"`
|
||
|
LongId string `position:"Query" field:"long_id"`
|
||
|
SdkVersion string `position:"Query" field:"version"`
|
||
|
Os string `position:"Query" field:"os"`
|
||
|
GameOs int `position:"Query" field:"game_os"`
|
||
|
GameSubOs int `position:"Query" field:"game_sub_os"`
|
||
|
UserName string `position:"Query" field:"user_name"`
|
||
|
Ua string `position:"Query" field:"ua"`
|
||
|
LiveCode string `position:"Query" field:"live_code"`
|
||
|
AdDevice string `position:"Query" field:"ad_device"`
|
||
|
PkgAgentId string `position:"Query" field:"pkg_agent_id"`
|
||
|
PkgSiteId string `position:"Query" field:"pkg_site_id"`
|
||
|
Network string `position:"Query" field:"network"`
|
||
|
ScreenResolution string `position:"Query" field:"screen_resolution"`
|
||
|
System string `position:"Query" field:"system"`
|
||
|
Electric string `position:"Query" field:"electric"`
|
||
|
ProcessorModel string `position:"Query" field:"processor_model"`
|
||
|
BaseBand string `position:"Query" field:"baseband"`
|
||
|
Model string `position:"Query" field:"model"`
|
||
|
Battery string `position:"Query" field:"battery"`
|
||
|
Oaid string `position:"Query" field:"oaid"`
|
||
|
AdInfo string `position:"Query" field:"adinfo"`
|
||
|
WxPlatform string `position:"Query" field:"wx_platform"`
|
||
|
}
|
||
|
|
||
|
type GetIdfaResp struct {
|
||
|
*responses.BaseResponse
|
||
|
GameId int `json:"game_id"`
|
||
|
AgentId int `json:"agent_id"`
|
||
|
SiteId int `json:"site_id"`
|
||
|
GameAwemeId string `json:"game_aweme_id"`
|
||
|
LongId string `json:"long_id"`
|
||
|
DeviceId string `json:"device_id"`
|
||
|
Exists bool `json:"exists"`
|
||
|
FromAd bool `json:"from_ad"`
|
||
|
MatchType int `json:"match_type"`
|
||
|
ClickId string `json:"click_id,omitempty"` // 非必要字段,使用 omitempty 忽略空值
|
||
|
MatchTrace string `json:"match_trace,omitempty"` // 非必要字段
|
||
|
RegTime int64 `json:"reg_time"`
|
||
|
}
|
||
|
|
||
|
func CreateGetIdfaReq() *GetIdfaReq {
|
||
|
req := &GetIdfaReq{
|
||
|
RpcRequest: &requests.RpcRequest{},
|
||
|
}
|
||
|
req.InitWithApiInfo(HOST, VERSION, "/getIdfa.php")
|
||
|
req.Method = requests.GET
|
||
|
return req
|
||
|
}
|
||
|
|
||
|
type GetUserAttrReq struct {
|
||
|
*requests.RpcRequest
|
||
|
UserName string `position:"Query" field:"user_name"`
|
||
|
GameSign string `position:"Query" field:"game_sign"`
|
||
|
Ts int64 `position:"Query" field:"ts"`
|
||
|
Sign string `position:"Query" field:"sign"`
|
||
|
}
|
||
|
|
||
|
type GetUserAttrResp struct {
|
||
|
*responses.BaseResponse
|
||
|
Code int `json:"code"`
|
||
|
Msg string `json:"msg"`
|
||
|
Data struct {
|
||
|
Uid int `json:"uid"`
|
||
|
UserName string `json:"user_name"`
|
||
|
RegTime int `json:"reg_time"` // 假设注册时间是时间戳
|
||
|
GameID int `json:"game_id"`
|
||
|
RegIP string `json:"reg_ip"`
|
||
|
AgentId int `json:"agent_id"`
|
||
|
SiteId int `json:"site_id"`
|
||
|
Imei string `json:"imei"`
|
||
|
Oaid string `json:"oaid"`
|
||
|
LongId string `json:"long_id"`
|
||
|
PromotionId string `json:"promotion_id"`
|
||
|
Mid3 string `json:"mid3"`
|
||
|
} `json:"data"`
|
||
|
}
|
||
|
|
||
|
func CreateGetUserAttrReq(userName, gameSign string) *GetUserAttrReq {
|
||
|
req := &GetUserAttrReq{
|
||
|
RpcRequest: &requests.RpcRequest{},
|
||
|
}
|
||
|
req.UserName = userName
|
||
|
req.GameSign = gameSign
|
||
|
req.Ts = time.Now().Unix()
|
||
|
req.Sign = utils.Md5(fmt.Sprintf("%d%s", req.Ts, msdkKey))
|
||
|
req.InitWithApiInfo(HOST, VERSION, "/getUserAttr.php")
|
||
|
req.Method = requests.GET
|
||
|
return req
|
||
|
}
|
||
|
|
||
|
type GetImeiReq struct {
|
||
|
*requests.RpcRequest
|
||
|
Uid int `position:"Query" field:"uid"`
|
||
|
UserName string `position:"Query" field:"user_name"`
|
||
|
GameId int `position:"Query" field:"game_id"`
|
||
|
GameSign string `position:"Query" field:"game_sign"`
|
||
|
RegTime int64 `position:"Query" field:"reg_time"`
|
||
|
Imei string `position:"Query" field:"imei"`
|
||
|
ChannelId int `position:"Query" field:"mtype"`
|
||
|
AgentId int `position:"Query" field:"agent_id"`
|
||
|
SiteId int `position:"Query" field:"site_id"`
|
||
|
Ip string `position:"Query" field:"ip"`
|
||
|
UserIp string `position:"Query" field:"user_ip"`
|
||
|
Idfa string `position:"Query" field:"idfa"`
|
||
|
Logined int `position:"Query" field:"logined"`
|
||
|
MatchType int `position:"Query" field:"match_type"`
|
||
|
GameAwemeId string `position:"Query" field:"game_aweme_id"`
|
||
|
ComeBackUser int `position:"Query" field:"come_back_user"` //回流用户标识 1=>回流用户
|
||
|
LpReg int `position:"Query" field:"lp_reg"` // 落地页注册用户标识
|
||
|
FanCode string `position:"Query" field:"fan_code"` // 粉丝码
|
||
|
Network string `position:"Query" field:"network"`
|
||
|
Idfv string `position:"Query" field:"idfv"`
|
||
|
ScreenResolution string `position:"Query" field:"screen_resolution"`
|
||
|
System string `position:"Query" field:"system"`
|
||
|
Electric string `position:"Query" field:"electric"`
|
||
|
ProcessorModel string `position:"Query" field:"processor_model"`
|
||
|
BaseBand string `position:"Query" field:"baseband"`
|
||
|
Model string `position:"Query" field:"model"`
|
||
|
Battery string `position:"Query" field:"battery"`
|
||
|
Oaid string `position:"Query" field:"oaid"`
|
||
|
AdInfo string `position:"Query" field:"adinfo"`
|
||
|
AdDevice string `position:"Query" field:"ad_device"`
|
||
|
Ua string `position:"Query" field:"ua"`
|
||
|
WxPlatform string `position:"Query" field:"wx_platform"`
|
||
|
}
|
||
|
|
||
|
type GetImeiResp struct {
|
||
|
*responses.BaseResponse
|
||
|
Uid string `json:"uid"`
|
||
|
UserName string `json:"user_name"`
|
||
|
Openid string `json:"openid"`
|
||
|
ChannelId string `json:"mtype"`
|
||
|
Logined int `json:"logined"`
|
||
|
GameId string `json:"game_id"`
|
||
|
GameSign string `json:"game_sign"`
|
||
|
MatchType int `json:"match_type"`
|
||
|
RegTime int64 `json:"reg_time"` // 原始时间戳字符串
|
||
|
Imei string `json:"imei"`
|
||
|
Oaid string `json:"oaid"`
|
||
|
Idfa string `json:"idfa"`
|
||
|
Ip int64 `json:"ip"`
|
||
|
UserIp string `json:"user_ip"`
|
||
|
Ua string `json:"ua"`
|
||
|
Media string `json:"media"`
|
||
|
AgentId int `json:"agent_id"`
|
||
|
SiteId int `json:"site_id"`
|
||
|
AdInfo string `json:"adinfo"`
|
||
|
GameAwemeId string `json:"game_aweme_id"`
|
||
|
}
|
||
|
|
||
|
func CreateGetImeiReq() *GetImeiReq {
|
||
|
req := &GetImeiReq{
|
||
|
RpcRequest: &requests.RpcRequest{},
|
||
|
}
|
||
|
req.InitWithApiInfo(HOST, VERSION, "/getImei.php")
|
||
|
req.Method = requests.GET
|
||
|
return req
|
||
|
}
|
||
|
|
||
|
type SetImeiReq struct {
|
||
|
*requests.RpcRequest
|
||
|
UserName string `position:"Query" field:"user_name"`
|
||
|
GameId int `position:"Query" field:"game_id"`
|
||
|
Imei string `position:"Query" field:"imei"`
|
||
|
Idfa string `position:"Query" field:"idfa"`
|
||
|
GameSign string `position:"Query" field:"game_sign"`
|
||
|
ChannelId int `position:"Query" field:"mtype"`
|
||
|
MatchType int `position:"Query" field:"match_type"`
|
||
|
Network string `position:"Query" field:"network"`
|
||
|
Idfv string `position:"Query" field:"idfv"`
|
||
|
ScreenResolution string `position:"Query" field:"screen_resolution"`
|
||
|
System string `position:"Query" field:"system"` // 可能为系统版本号字符串
|
||
|
ProcessorModel string `position:"Query" field:"processor_model"`
|
||
|
BaseBand string `position:"Query" field:"baseband"`
|
||
|
Model string `position:"Query" field:"model"`
|
||
|
Battery string `position:"Query" field:"battery"`
|
||
|
Oaid string `position:"Query" field:"oaid"`
|
||
|
AdInfo string `position:"Query" field:"adinfo"`
|
||
|
AdDevice string `position:"Query" field:"ad_device"`
|
||
|
Ua string `position:"Query" field:"ua"`
|
||
|
WxPlatform string `position:"Query" field:"wx_platform"`
|
||
|
}
|
||
|
|
||
|
type SetImeiResp struct {
|
||
|
*responses.BaseResponse
|
||
|
Code int `json:"code"`
|
||
|
Msg string `json:"msg"`
|
||
|
}
|
||
|
|
||
|
func CreateSetImeiReq() *SetImeiReq {
|
||
|
req := &SetImeiReq{
|
||
|
RpcRequest: &requests.RpcRequest{},
|
||
|
}
|
||
|
req.InitWithApiInfo(HOST, VERSION, "/setImei.php")
|
||
|
req.Method = requests.GET
|
||
|
return req
|
||
|
}
|