@@ -0,0 +1,31 @@
|
||||
package dataReport
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestReportEvent(t *testing.T) {
|
||||
reportAppId := "11"
|
||||
// 创建一个广告点击
|
||||
event := &CommonField{
|
||||
UID: "user_123",
|
||||
EventID: GenerateGlobalEventID(),
|
||||
Event: EventTypeAdClick,
|
||||
Channel: "666",
|
||||
AppID: reportAppId,
|
||||
//SID string `json:"sid"` // 会话ID
|
||||
//ClientTS int64 `json:"client_ts"` // 客户端时间戳
|
||||
Device: "Android",
|
||||
DeviceID: "device_12345",
|
||||
UserAgent: "Mozilla/5.0",
|
||||
DeviceBrand: "Huawei",
|
||||
DeviceModel: "Mate 40",
|
||||
IP: "192.168.0.1",
|
||||
}
|
||||
event.Payload = JsonRawMessage(AdClickEvent{
|
||||
AdID: "1286400000000040", // 广告ID
|
||||
})
|
||||
config.ApiUrl = "https://api.shuifeng.cc"
|
||||
list := []*CommonField{event}
|
||||
BatchReport(list)
|
||||
}
|
||||
Reference in New Issue
Block a user