登陆成功或者密码错误时发送日志
This commit is contained in:
parent
76e86c9f06
commit
91afff4451
@ -110,17 +110,21 @@ func (s *LoginService) onLoginOrRegister(iMsg *ipb.InternalMsg, req *pb.C2SUserL
|
|||||||
s.SendServiceMsg(service.TopicEx(iMsg.ServiceName), iMsg.ConnId, userId, int32(pb.MsgId_S2CUserLoginId), rsp)
|
s.SendServiceMsg(service.TopicEx(iMsg.ServiceName), iMsg.ConnId, userId, int32(pb.MsgId_S2CUserLoginId), rsp)
|
||||||
|
|
||||||
if us != nil && us.ID > 0 {
|
if us != nil && us.ID > 0 {
|
||||||
|
loginLog := &user.UserLoginLog{
|
||||||
|
UID: us.ID,
|
||||||
|
LoginIP: req.Ip,
|
||||||
|
LoginTime: time.Now(),
|
||||||
|
DeviceInfo: req.DeviceId,
|
||||||
|
LoginResult: code == pb.ErrCode_OK,
|
||||||
|
FailReason: code.String(),
|
||||||
|
}
|
||||||
switch code {
|
switch code {
|
||||||
case pb.ErrCode_LoginUserOrPwdErr:
|
case pb.ErrCode_LoginUserOrPwdErr, pb.ErrCode_OK:
|
||||||
rpcMsg := ipb.MakeRpcMsg[user.UserLoginLog](rpcName.GetUserAccount, 0, &user.UserLoginLog{
|
rpcMsg := ipb.MakeRpcMsg[user.UserLoginLog](rpcName.LogUserAccountLogin, 0, loginLog)
|
||||||
UID: us.ID,
|
ksync.GoSafe(func() {
|
||||||
LoginIP: us.LastLoginIP,
|
_, _ = s.Call(service.RpcTopicEx(node.Name), timeout, rpcMsg)
|
||||||
LoginTime: time.Now(),
|
}, nil)
|
||||||
DeviceInfo: us.DeviceID,
|
|
||||||
LoginResult: code == pb.ErrCode_OK,
|
|
||||||
FailReason: code.String(),
|
|
||||||
})
|
|
||||||
_, _ = s.Call(service.RpcTopicEx(node.Name), timeout, rpcMsg)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user