This commit is contained in:
aozhiwei 2023-09-09 10:02:04 +08:00
parent 9adb078831
commit 72619df2c1

View File

@ -24,7 +24,7 @@ type tgLog struct {
func (this *tgLog) init() { func (this *tgLog) init() {
this.chGoSaveExit = make(chan int) this.chGoSaveExit = make(chan int)
//go this.goSaveToFile() go this.goSaveToFile()
} }
func (this *tgLog) unInit() { func (this *tgLog) unInit() {
@ -41,10 +41,9 @@ func (this *tgLog) AddTrackLog(
remoteAddr string, remoteAddr string,
logClass1 int32, logClass1 int32,
logClass2 int32, logClass2 int32,
//prop *q5.XObject) { prop map[string]string) {
) { eventName := fmt.Sprintf("event_%d_%d", logClass1, logClass2)
//eventName := fmt.Sprintf("event_%d_%d", logClass1, logClass2) this.AddTrackLogEx(gameId, accountId, remoteAddr, eventName, prop)
//this.AddTrackLogEx(gameId, accountId, remoteAddr, eventName, prop)
} }
func (this *tgLog) AddTrackLogEx( func (this *tgLog) AddTrackLogEx(
@ -52,20 +51,25 @@ func (this *tgLog) AddTrackLogEx(
accountId string, accountId string,
remoteAddr string, remoteAddr string,
eventName string, eventName string,
//prop *q5.XObject) { prop map[string]string) {
) { logObj := struct {
/*xobj := q5.NewMxoObject() AccountId string `json:"#account_id"`
xobj.SetXValue("#account_id", q5.NewXString(accountId)) Type string `json:"#type""`
xobj.SetXValue("#type", q5.NewXString("track")) Time string `json:"#time"`
xobj.SetXValue("#time", q5.NewXString(time.Now().Format("2006-01-02 15:04:05"))) EventName string `json:"#event_name""`
xobj.SetXValue("#event_name", q5.NewXString(eventName)) Ip string `json:"#ip""`
xobj.SetXValue("#ip", q5.NewXString(remoteAddr)) Properties map[string]string `json:"properties"`
} {
xobj.SetXObject("properties", prop) AccountId: accountId,
Type: "track",
Time: time.Now().Format("2006-01-02 15:04:05"),
EventName: eventName,
Ip: remoteAddr,
Properties: prop,
}
p := new(tgLogMsgNode) p := new(tgLogMsgNode)
p.gameId = gameId p.gameId = gameId
p.jsonStr = xobj.ToJsonStr() p.jsonStr = q5.EncodeJson(logObj)
this.msgMutex.Lock() this.msgMutex.Lock()
defer this.msgMutex.Unlock() defer this.msgMutex.Unlock()
if this.botNode != nil { if this.botNode != nil {
@ -75,7 +79,6 @@ func (this *tgLog) AddTrackLogEx(
this.topNode = p this.topNode = p
this.botNode = p this.botNode = p
} }
*/
} }
func (this *tgLog) goSaveToFile() { func (this *tgLog) goSaveToFile() {