This commit is contained in:
aozhiwei 2024-05-24 07:37:03 +08:00
parent 03df640b48
commit 14ec983449

View File

@ -38,22 +38,25 @@ func (this *tgLog) SetPolyLog(isPolyLog bool) {
func (this *tgLog) AddTrackLog(
gameId int32,
accountId string,
remoteAddr string,
distinctId string,
ip string,
eventName string,
prop map[string]string) {
logObj := struct {
AccountId string `json:"#account_id"`
DistinctId string `json:"#distinct_id"`
Type string `json:"#type""`
Time string `json:"#time"`
EventName string `json:"#event_name""`
Ip string `json:"#ip""`
EventName string `json:"#event_name""`
Properties map[string]string `json:"properties"`
}{
AccountId: accountId,
DistinctId: distinctId,
Type: "track",
Time: q5.FormatUnixDateTime(_app.GetNowSeconds(), _app.GetLocation()),
Time: q5.FormatUnixDateTime(_app.GetRealSeconds(), _app.GetLocation()),
EventName: eventName,
Ip: remoteAddr,
Ip: ip,
Properties: prop,
}
p := new(tgLogMsgNode)
@ -99,7 +102,7 @@ func (this *tgLog) goSaveToFile() {
func (this *tgLog) getLogFile(gameId int32) *os.File {
fileName := fmt.Sprintf(TGLOG_FILENAME,
os.Getpid(),
q5.FormatUnixDateEx(_app.GetNowSeconds(), _app.GetLocation()))
q5.FormatUnixDateEx(_app.GetRealSeconds(), _app.GetLocation()))
logDir := ""
if this.isPolyLog {
logDir = fmt.Sprintf(POLY_TGLOG_ROOT, _app.GetPkgName(), gameId)