1
This commit is contained in:
parent
e8383f8b38
commit
e446f3e5ec
@ -373,10 +373,46 @@ func (this *player) CMGuildInfo(hdr *f5.MsgHdr, msg *cs.CMGuildInfo) {
|
||||
|
||||
func (this *player) CMRecommendGuildList(hdr *f5.MsgHdr, msg *cs.CMRecommendGuildList) {
|
||||
rspMsg := new(cs.SMRecommendGuildList)
|
||||
q5.NewSlice(&rspMsg.RecommendGuilds, 0, 50)
|
||||
GetGuildMgr().AsyncGetRecommendGuild(
|
||||
0,
|
||||
func (errCode int32, errMsg string, guildIds []string) {
|
||||
this.SendMsg(rspMsg)
|
||||
if errCode != 0 {
|
||||
this.SendMsg(rspMsg.Err(1, "server internal error"))
|
||||
return
|
||||
}
|
||||
if len(guildIds) <= 0 {
|
||||
this.SendMsg(rspMsg)
|
||||
return
|
||||
}
|
||||
i := 0
|
||||
f5.NewAsyncTask(
|
||||
func (task* f5.AsyncTask) {
|
||||
doNextFunc := func() {
|
||||
if i + 1 < len(guildIds) {
|
||||
i++
|
||||
task.Continue()
|
||||
} else {
|
||||
this.SendMsg(rspMsg)
|
||||
}
|
||||
}
|
||||
guild := GetGuildMgr().GetGuildByGuildId(guildIds[i])
|
||||
if guild == nil {
|
||||
doNextFunc()
|
||||
} else {
|
||||
pbGuild := new(cs.MFGuild)
|
||||
guild.AsyncFillMFGuild(
|
||||
pbGuild,
|
||||
func (errCode int32, errMsg string) {
|
||||
if errCode != 0 {
|
||||
this.SendMsg(rspMsg.Err(1, "server internal error"))
|
||||
return
|
||||
}
|
||||
q5.AppendSlice(&rspMsg.RecommendGuilds, pbGuild)
|
||||
doNextFunc()
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user