修复注册新号bug

This commit is contained in:
huangxiaolei
2022-12-10 22:52:00 +08:00
parent d17f687d74
commit eb26b47b8e
2 changed files with 6 additions and 4 deletions

View File

@@ -33,7 +33,9 @@ func (l *LocalEventManager) LocalEventHandle(localEvent *LocalEvent) {
switch localEvent.EventId {
case LoadLoginUserFromDbFinish:
playerLoginInfo := localEvent.Msg.(*PlayerLoginInfo)
USER_MANAGER.playerMap[playerLoginInfo.Player.PlayerID] = playerLoginInfo.Player
if playerLoginInfo.Player != nil {
USER_MANAGER.playerMap[playerLoginInfo.Player.PlayerID] = playerLoginInfo.Player
}
GAME_MANAGER.OnLoginOk(playerLoginInfo.UserId, playerLoginInfo.Player, playerLoginInfo.ClientSeq)
case CheckUserExistOnRegFromDbFinish:
playerRegInfo := localEvent.Msg.(*PlayerRegInfo)

View File

@@ -147,11 +147,11 @@ func (u *UserManager) OnlineUser(userId uint32, clientSeq uint32) (*model.Player
} else {
go func() {
player = u.loadUserFromDb(userId)
if player == nil {
if player != nil {
u.ChangeUserDbState(player, model.DbNormal)
} else {
logger.LOG.Error("can not find user from db, uid: %v", userId)
return
}
u.ChangeUserDbState(player, model.DbNormal)
LOCAL_EVENT_MANAGER.localEventChan <- &LocalEvent{
EventId: LoadLoginUserFromDbFinish,
Msg: &PlayerLoginInfo{