修改bug,移除部分调试日志

This commit is contained in:
liuxiaobo 2025-06-05 00:05:09 +08:00
parent 7cba557a68
commit 2ea165d1b9
4 changed files with 6 additions and 6 deletions

View File

@ -59,14 +59,13 @@ func (s *TableOp[T]) findByRedis(id uint) *T {
if len(maps) == 0 { if len(maps) == 0 {
return nil return nil
} }
var result resultT[T]
us, err := serialization.MapToStruct[T](maps) us, err := serialization.MapToStruct[T](maps)
if err != nil { if err != nil {
log.ErrorF("serialization map to struct err: %v", err) log.ErrorF("serialization map to struct err: %v", err)
return nil return nil
} }
log.DebugF("findByRedis redis-key:%v result:%v", s.redisKey(id), us) //log.DebugF("findByRedis redis-key:%v result:%v", s.redisKey(id), us)
return &result.ret return us
} }
func (s *TableOp[T]) writeRedis(id uint, t *T) { func (s *TableOp[T]) writeRedis(id uint, t *T) {

View File

@ -42,7 +42,7 @@ func (s *UserAccountOp) GetUserAccount(username string) (*user.UserAccount, pb.E
us := &user.UserAccount{} us := &user.UserAccount{}
err = s.db.Where("username = ?", username).First(us).Error err = s.db.Where("username = ?", username).First(us).Error
if err != nil { if err != nil {
log.ErrorF("find user:%v err:%v", username, err) log.DebugF("find user:%v err:%v", username, err)
return nil, pb.ErrCode_SystemErr return nil, pb.ErrCode_SystemErr
} }
// 从db中查到后写入redis并建立索引 // 从db中查到后写入redis并建立索引

View File

@ -44,7 +44,7 @@ func operationDb[T any](iMsg *ipb.InternalMsg, operation func(table *T) (*T, pb.
log.ErrorF("error marshalling user account %v", err) log.ErrorF("error marshalling user account %v", err)
return return
} }
log.DebugF("iMsg.Msg:%v", string(iMsg.Msg)) //log.DebugF("iMsg.Msg:%v", string(iMsg.Msg))
return return
} }

View File

@ -48,7 +48,7 @@ func (s *LoginService) checkLoginOrRegister(req *pb.C2SUserLogin) (us *user.User
return nil, pb.ErrCode_SystemErr, node return nil, pb.ErrCode_SystemErr, node
} }
_ = json.Unmarshal(rspMsg.Msg, us) _ = json.Unmarshal(rspMsg.Msg, us)
log.DebugF("收到rcp:%v返回数据:%v", rpcName.GetUserAccount, string(rspMsg.Msg)) //log.DebugF("收到rpc:%v返回数据:%v", rpcName.GetUserAccount, string(rspMsg.Msg))
if us.ID == 0 { if us.ID == 0 {
// 没有帐号,创建帐号 // 没有帐号,创建帐号
us = &user.UserAccount{ us = &user.UserAccount{
@ -58,6 +58,7 @@ func (s *LoginService) checkLoginOrRegister(req *pb.C2SUserLogin) (us *user.User
LastLoginIP: req.Ip, LastLoginIP: req.Ip,
LastLoginTime: time.Now(), LastLoginTime: time.Now(),
RegisterIP: req.Ip, RegisterIP: req.Ip,
RegisterTime: time.Now(),
} }
rpcMsg = ipb.MakeRpcMsg[user.UserAccount](rpcName.CreateUserAccount, 0, us) rpcMsg = ipb.MakeRpcMsg[user.UserAccount](rpcName.CreateUserAccount, 0, us)
rspMsg, err = s.Call(service.RpcTopicEx(node.Name), timeout, rpcMsg) rspMsg, err = s.Call(service.RpcTopicEx(node.Name), timeout, rpcMsg)