diff --git a/model/loginlog.go b/model/loginlog.go index 6d3ef96..1f0b824 100644 --- a/model/loginlog.go +++ b/model/loginlog.go @@ -103,6 +103,7 @@ func NewLoginLog(snId, logType int32, tel, ip, platform, channel, promoter, pack type LoginErrorLog struct { TypeId int32 + Ts int64 } //func InsertLoginLogs(logs ...*LoginLog) (err error) { diff --git a/worldsrv/action_login.go b/worldsrv/action_login.go index bf5d3d4..ac98c49 100644 --- a/worldsrv/action_login.go +++ b/worldsrv/action_login.go @@ -63,10 +63,13 @@ func (this *CSLoginHandler) Process(s *netlib.Session, packetid int, data interf proto.SetDefaults(sclogin) common.SendToGate(sid, int(login_proto.LoginPacketID_PACKET_SC_LOGIN), sclogin, s) logger.Logger.Trace("CSLoginHandler Process send ", sclogin) - log := &model.LoginErrorLog{ - TypeId: int32(code.Enum().Number()), + if code != login_proto.OpResultCode_OPRC_Sucess { + log := &model.LoginErrorLog{ + TypeId: int32(code.Enum().Number()), + Ts: time.Now().Unix(), + } + mq.Write(log) } - mq.Write(log) } sendSCDisconnect := func(code int32) { diff --git a/worldsrv/task_login.go b/worldsrv/task_login.go index 509279f..4abab69 100644 --- a/worldsrv/task_login.go +++ b/worldsrv/task_login.go @@ -433,8 +433,11 @@ func SCLogin(s *netlib.Session, sid int64, csLogin *login_proto.CSLogin, acc *mo proto.SetDefaults(sclogin) common.SendToGate(sid, int(login_proto.LoginPacketID_PACKET_SC_LOGIN), sclogin, s) logger.Logger.Tracef("SCLogin %v", sclogin) - log := &model.LoginErrorLog{ - TypeId: int32(code.Enum().Number()), + if code != login_proto.OpResultCode_OPRC_Sucess { + log := &model.LoginErrorLog{ + TypeId: int32(code.Enum().Number()), + Ts: time.Now().Unix(), + } + mq.Write(log) } - mq.Write(log) }