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() { // 客户端日志 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, appChannel, channelId string var snid int32 var createTs int64 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 createTs = p.CreateTime.Unix() appChannel = p.Channel channelId = p.ChannelId } //LogChannelSingleton.WriteLog(&model.ClientLog{ // Data: msg.GetData(), // Platform: platform, // Snid: snid, // Ts: time.Now().Unix(), //}) mq.Write(&model.ClientLogMysql{ Data: msg.GetData(), Platform: platform, Snid: snid, Ts: time.Now().Unix(), CreateTs: createTs, AppChannel: appChannel, ChannelId: channelId, }) return nil }