diff --git a/server/imserver_new/cache/cachemgr.go b/server/imserver_new/cache/cachemgr.go index d742b1c4..0dc394a2 100644 --- a/server/imserver_new/cache/cachemgr.go +++ b/server/imserver_new/cache/cachemgr.go @@ -54,7 +54,7 @@ func (this *cacheMgr) internalGetUsers(accountIds []string, cb func(int32, strin subTask.SetFail() return } - if ds.Next() { + for ds.Next() { accountId := ds.GetByName("account_id") u := this.getUser(accountId) if u == nil { @@ -63,6 +63,9 @@ func (this *cacheMgr) internalGetUsers(accountIds []string, cb func(int32, strin u.loadFromDb(ds) this.userHash[u.accountId] = u } + if q5.IsDebug() && ds.NumOfReaded() <= 0 { + f5.GetSysLog().Warning("cacheMgr.internalGetUsers %s not found", keys[i][1]) + } if i + 1 < len(keys) { i++ subTask.Continue() @@ -95,7 +98,6 @@ func (this* cacheMgr) AsyncGetUsersAndFillMFUser(accountIds []string, pbUsers *[ cb(errCode, errMsg) return } - }) } diff --git a/server/imserver_new/cache/user_profile.go b/server/imserver_new/cache/user_profile.go index d8117faa..3f569f9c 100644 --- a/server/imserver_new/cache/user_profile.go +++ b/server/imserver_new/cache/user_profile.go @@ -21,63 +21,31 @@ type userProfile struct { lastSyncTime int64 } -func (this *userProfile) GetAccountId() string { - return this.accountId -} - -func (this *userProfile) GetUserName() string { - return this.name -} - -func (this *userProfile) GetAvatar() string { - return this.avatarUrl -} - -func (this *userProfile) GetAvatarHead() string { - return this.head -} - -func (this *userProfile) GetStar() int32 { - return this.star -} - -func (this *userProfile)GetTotalKills() int32 { - return this.totalKills -} - -func (this *userProfile) GetTotalWinTimes() int32 { - return this.totalWinTimes -} - -func (this *userProfile) GetRank() int32 { - return this.rank -} - -func (this *userProfile) GetOnlineStatus() int32 { - return 0 -} - -func (this *userProfile) GetLastLoginTime() int32 { - return this.lastLoginTime -} - -func (this *userProfile) FillMFUser1(pbUser *cs.MFUser) { +func (this *userProfile) FillMFUser(pbUser *cs.MFUser) { pbUser.AccountId = proto.String(this.accountId) pbUser.Username = proto.String(this.name) pbUser.Avatar = proto.Int32(q5.ToInt32(this.avatarUrl)) pbUser.AvatarHead = proto.Int32(q5.ToInt32(this.head)) pbUser.Rank = proto.Int32(this.rank) - pbUser.OnlineStatus = proto.Int32(0) + if GetPlayerMgr().GetPlayerByAccountId(this.accountId) != nil { + pbUser.OnlineStatus = proto.Int32(1) + } else { + pbUser.OnlineStatus = proto.Int32(0) + } pbUser.LastLoginTime = proto.Int32(this.lastLoginTime) } -func (this *userProfile) FillMFGuildMember1(pbMember *cs.MFGuildMember) { +func (this *userProfile) FillMFGuildMember(pbMember *cs.MFGuildMember) { pbMember.AccountId = proto.String(this.accountId) pbMember.Username = proto.String(this.name) pbMember.Avatar = proto.Int32(q5.ToInt32(this.avatarUrl)) pbMember.AvatarHead = proto.Int32(q5.ToInt32(this.head)) pbMember.Rank = proto.Int32(this.rank) - pbMember.OnlineStatus = proto.Int32(0) + if GetPlayerMgr().GetPlayerByAccountId(this.accountId) != nil { + pbMember.OnlineStatus = proto.Int32(1) + } else { + pbMember.OnlineStatus = proto.Int32(0) + } pbMember.LastLoginTime = proto.Int32(this.lastLoginTime) pbMember.Level = proto.Int32(GetGuildMgr().GetGuildJob(this.accountId)) pbMember.Star = proto.Int32(this.star)