package main import ( "time" "mongo.games.com/goserver/core/logger" "mongo.games.com/goserver/core/netlib" "mongo.games.com/game/common" "mongo.games.com/game/model" "mongo.games.com/game/mq" "mongo.games.com/game/protocol/player" ) func init() { LogChannelSingleton.RegisterLogCName(mq.BackClientLog, &model.ClientLogMysql{}) // 客户端日志 netlib.Register(int(player.PlayerPacketID_PACKET_CS_CLIENT_LOG), player.CSClientLog{}, CSClientLog) } func CSClientLog(s *netlib.Session, packetid int, pack interface{}) error { logger.Logger.Trace("receive CSClientLog ", pack) msg, ok := pack.(*player.CSClientLog) if !ok { return nil } var platform string var snid int32 var p *model.PlayerData if s != nil { var pdi = s.GetAttribute(common.ClientSessionAttribute_PlayerData) if pdi != nil { pd, ok := pdi.(*model.PlayerData) if ok { p = pd } } } if p != nil { platform = p.Platform snid = p.SnId } //LogChannelSingleton.WriteLog(&model.ClientLog{ // Data: msg.GetData(), // Platform: platform, // Snid: snid, // Ts: time.Now().Unix(), //}) LogChannelSingleton.WriteLog(&model.ClientLogMysql{ Data: msg.GetData(), Platform: platform, Snid: snid, Ts: time.Now().Unix(), }) return nil }