This commit is contained in:
aozhiwei 2024-05-24 07:48:25 +08:00
parent 14ec983449
commit d95756afcd

View File

@ -73,6 +73,44 @@ func (this *tgLog) AddTrackLog(
}
}
func (this *tgLog) AddCustomLog(
gameId int32,
accountId string,
distinctId string,
ip string,
eventName string,
prop map[string]interface{}) {
logObj := struct {
AccountId string `json:"#account_id"`
DistinctId string `json:"#distinct_id"`
Type string `json:"#type""`
Time string `json:"#time"`
Ip string `json:"#ip""`
EventName string `json:"#event_name""`
Properties map[string]interface{} `json:"properties"`
}{
AccountId: accountId,
DistinctId: distinctId,
Type: "track",
Time: q5.FormatUnixDateTime(_app.GetRealSeconds(), _app.GetLocation()),
EventName: eventName,
Ip: ip,
Properties: prop,
}
p := new(tgLogMsgNode)
p.gameId = gameId
p.jsonStr = q5.EncodeJson(logObj)
this.msgMutex.Lock()
defer this.msgMutex.Unlock()
if this.botNode != nil {
this.botNode.next = p
this.botNode = p
} else {
this.topNode = p
this.botNode = p
}
}
func (this *tgLog) goSaveToFile() {
var workNode *tgLogMsgNode
for {