- 修复了当 signer为 nil 时不执行签名逻辑的问题 - 优化了签名处理流程,提高了代码的可读性和性能 - 新增了对 msdk 服务的支持,包括用户归因和设备信息获取功能 - 添加了 md5 加密工具函数和相关测试
142 lines
3.5 KiB
Go
142 lines
3.5 KiB
Go
package msdk
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestClient_GetUserAttr(t *testing.T) {
|
|
client, err := NewClient()
|
|
if err != nil {
|
|
t.Error(err)
|
|
return
|
|
}
|
|
req := CreateGetUserAttrReq("ql83649336", "xxhbbxxl")
|
|
resp, err := client.GetUserAttr(req)
|
|
if err != nil {
|
|
t.Error(err)
|
|
return
|
|
}
|
|
t.Log(resp)
|
|
}
|
|
|
|
func TestGetIdfa(t *testing.T) {
|
|
client, err := NewClient()
|
|
if err != nil {
|
|
t.Error(err)
|
|
return
|
|
}
|
|
req := CreateGetIdfaReq()
|
|
req.ChannelId = 1
|
|
req.GameId = 3706
|
|
req.Ip = "112.23.230.210"
|
|
req.Imei = "00000000-0000-0000-0000-000000000000"
|
|
req.LongId = "daff65f07c7cf84862f4217773e3d613"
|
|
req.SdkVersion = "1.7.2"
|
|
req.Os = "ios"
|
|
req.GameOs = 2
|
|
req.GameSubOs = 0
|
|
req.Ua = "Mozilla/5.0 (iPad; CPU OS 15_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148"
|
|
req.GameSign = "hlhj"
|
|
req.PkgAgentId = "100"
|
|
req.PkgSiteId = "1001"
|
|
req.Network = "Wifi"
|
|
req.Idfv = "53F2A5F7-B1D4-4716-9775-07727C29BC7A"
|
|
req.ScreenResolution = "2360*1640"
|
|
req.System = "15.6.1"
|
|
req.ProcessorModel = "iPad13,16"
|
|
req.BaseBand = ""
|
|
req.Model = "iPad13,16"
|
|
req.Battery = "74"
|
|
req.Oaid = ""
|
|
req.AdInfo = ""
|
|
req.WxPlatform = ""
|
|
req.AdDevice = "{\"bootTimeInSec\":\"1745364499\",\"countryCode\":\"CN\",\"language\":\"zh-Hans-CN\",\"deviceName\":\"1b9018182a49e16ba85bb095f224867c\",\"systemVersion\":\"15.6.1\",\"machine\":\"iPad13,16\",\"carrierInfo\":\"unknown\",\"memory\":\"8000356352\",\"disk\":\"255983177728\",\"sysFileTime\":\"1663537105.729985\",\"model\":\"J407AP\",\"timeZone\":\"28800\",\"mntId\":\"A058368B97B0D073829608AAC13FFA64D9BEFD0FE3E14EDB106F2BABD6DF94B1C2BFC7509CBB683EE5B22D91A19FF67A@/dev/disk0s1s1\",\"deviceInitTime\":\"1663537056.906820124\"}"
|
|
resp, err := client.GetIdfa(req)
|
|
if err != nil {
|
|
t.Error(err)
|
|
return
|
|
}
|
|
t.Log(resp)
|
|
}
|
|
|
|
func TestGetImei(t *testing.T) {
|
|
client, err := NewClient()
|
|
if err != nil {
|
|
t.Error(err)
|
|
return
|
|
}
|
|
req := CreateGetImeiReq()
|
|
req.Uid = 218047048
|
|
req.UserName = "ct939725671"
|
|
req.GameId = 8050
|
|
req.GameSign = "mrwld"
|
|
req.RegTime = 1750939725
|
|
req.Imei = "of5wO5sKWep0OFPt9rWQf6xNJVPg"
|
|
req.ChannelId = 1
|
|
req.AgentId = 100
|
|
req.SiteId = 1001
|
|
req.Ip = "1864204063"
|
|
req.Idfa = "of5wO5sKWep0OFPt9rWQf6xNJVPg"
|
|
req.Logined = 1
|
|
req.MatchType = 1
|
|
req.GameAwemeId = ""
|
|
req.ComeBackUser = 0
|
|
req.FanCode = ""
|
|
req.Network = ""
|
|
req.Idfv = ""
|
|
req.ScreenResolution = ""
|
|
req.System = ""
|
|
req.Electric = ""
|
|
req.ProcessorModel = ""
|
|
req.BaseBand = ""
|
|
req.Model = ""
|
|
req.Battery = ""
|
|
req.Oaid = ""
|
|
req.AdInfo = ""
|
|
req.AdDevice = ""
|
|
req.Ua = "WebSdk GaoreGame/1.3.1"
|
|
req.WxPlatform = ""
|
|
resp, err := client.GetImei(req)
|
|
if err != nil {
|
|
t.Error(err)
|
|
}
|
|
t.Log(resp)
|
|
}
|
|
|
|
func TestSetImei(t *testing.T) {
|
|
client, err := NewClient()
|
|
if err != nil {
|
|
t.Error(err)
|
|
return
|
|
}
|
|
req := CreateSetImeiReq()
|
|
// 基础字段赋值
|
|
req.UserName = "15179405888"
|
|
req.GameId = 6062
|
|
req.GameSign = "hlhj"
|
|
req.ChannelId = 1 // mtype
|
|
req.MatchType = 2
|
|
req.Imei = "96d9acdd57535c92-null"
|
|
req.Idfa = "96d9acdd57535c92-null"
|
|
req.Network = "4G"
|
|
req.Idfv = ""
|
|
req.ScreenResolution = "2132x1080"
|
|
req.System = "11"
|
|
req.ProcessorModel = ""
|
|
req.BaseBand = ""
|
|
req.Model = "PCDM10"
|
|
req.Battery = "45"
|
|
req.Oaid = "B9258E43A5084B43B72D94580C830898343a97328d6fd210b9e23859b1d5e83d_gaore_"
|
|
req.AdInfo = ""
|
|
req.AdDevice = ""
|
|
req.Ua = "Mozilla/5.0 (Linux; Android 11; PCDM10 Build/RP1A.200720.011; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/83.0.4103.106 Mobile Safari/537.36; SHGR GaoreGame/2.3.5"
|
|
req.WxPlatform = ""
|
|
|
|
resp, err := client.SetImei(req)
|
|
if err != nil {
|
|
t.Error(err)
|
|
return
|
|
}
|
|
t.Log(resp)
|
|
}
|