1
This commit is contained in:
parent
c0f30140a2
commit
c9ca10939a
21
server/imserver_new/cache/cachemgr.go
vendored
21
server/imserver_new/cache/cachemgr.go
vendored
@ -98,10 +98,19 @@ func (this* cacheMgr) AsyncGetUsersAndFillMFUser(accountIds []string, pbUsers *[
|
|||||||
cb(errCode, errMsg)
|
cb(errCode, errMsg)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
for _, accountId := range(accountIds) {
|
||||||
|
u := this.getUser(accountId)
|
||||||
|
if u != nil {
|
||||||
|
pbUser := new(cs.MFUser)
|
||||||
|
u.fillMFUser(pbUser)
|
||||||
|
q5.AppendSlice(pbUsers, pbUser)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cb(0, "")
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this* cacheMgr) AsyncGetUsersAndFillMFGuildMember(accountIds []string, pbUsers *[]*cs.MFGuildMember,
|
func (this* cacheMgr) AsyncGetUsersAndFillMFGuildMember(accountIds []string, pbMembers *[]*cs.MFGuildMember,
|
||||||
cb func(int32, string)) {
|
cb func(int32, string)) {
|
||||||
this.internalGetUsers(
|
this.internalGetUsers(
|
||||||
accountIds,
|
accountIds,
|
||||||
@ -110,7 +119,15 @@ func (this* cacheMgr) AsyncGetUsersAndFillMFGuildMember(accountIds []string, pbU
|
|||||||
cb(errCode, errMsg)
|
cb(errCode, errMsg)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
for _, accountId := range(accountIds) {
|
||||||
|
u := this.getUser(accountId)
|
||||||
|
if u != nil {
|
||||||
|
pbMember := new(cs.MFGuildMember)
|
||||||
|
u.fillMFGuildMember(pbMember)
|
||||||
|
q5.AppendSlice(pbMembers, pbMember)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cb(0, "")
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
21
server/imserver_new/cache/user_profile.go
vendored
21
server/imserver_new/cache/user_profile.go
vendored
@ -21,21 +21,30 @@ type userProfile struct {
|
|||||||
lastSyncTime int64
|
lastSyncTime int64
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *userProfile) FillMFUser(pbUser *cs.MFUser) {
|
func (this *userProfile) fillMFUser(pbUser *cs.MFUser) {
|
||||||
pbUser.AccountId = proto.String(this.accountId)
|
pbUser.AccountId = proto.String(this.accountId)
|
||||||
pbUser.Username = proto.String(this.name)
|
pbUser.Username = proto.String(this.name)
|
||||||
pbUser.Avatar = proto.Int32(q5.ToInt32(this.avatarUrl))
|
pbUser.Avatar = proto.Int32(q5.ToInt32(this.avatarUrl))
|
||||||
pbUser.AvatarHead = proto.Int32(q5.ToInt32(this.head))
|
pbUser.AvatarHead = proto.Int32(q5.ToInt32(this.head))
|
||||||
|
{
|
||||||
|
guild := GetGuildMgr().GetGuildByAccountId(this.accountId)
|
||||||
|
if guild != nil {
|
||||||
|
pbUser.GuildId = proto.Int64(q5.ToInt64(guild.GetGuildId()))
|
||||||
|
pbUser.GuildName = proto.String(guild.GetGuildName())
|
||||||
|
}
|
||||||
|
}
|
||||||
pbUser.Rank = proto.Int32(this.rank)
|
pbUser.Rank = proto.Int32(this.rank)
|
||||||
if GetPlayerMgr().GetPlayerByAccountId(this.accountId) != nil {
|
{
|
||||||
pbUser.OnlineStatus = proto.Int32(1)
|
if GetPlayerMgr().GetPlayerByAccountId(this.accountId) != nil {
|
||||||
} else {
|
pbUser.OnlineStatus = proto.Int32(1)
|
||||||
pbUser.OnlineStatus = proto.Int32(0)
|
} else {
|
||||||
|
pbUser.OnlineStatus = proto.Int32(0)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
pbUser.LastLoginTime = proto.Int32(this.lastLoginTime)
|
pbUser.LastLoginTime = proto.Int32(this.lastLoginTime)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *userProfile) FillMFGuildMember(pbMember *cs.MFGuildMember) {
|
func (this *userProfile) fillMFGuildMember(pbMember *cs.MFGuildMember) {
|
||||||
pbMember.AccountId = proto.String(this.accountId)
|
pbMember.AccountId = proto.String(this.accountId)
|
||||||
pbMember.Username = proto.String(this.name)
|
pbMember.Username = proto.String(this.name)
|
||||||
pbMember.Avatar = proto.Int32(q5.ToInt32(this.avatarUrl))
|
pbMember.Avatar = proto.Int32(q5.ToInt32(this.avatarUrl))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user