1
This commit is contained in:
parent
57afd57463
commit
f1bc885898
@ -89,7 +89,7 @@ type GuildMgr interface {
|
||||
GetRecommendGuilds(string) []Guild
|
||||
GetGuildRank() []Guild
|
||||
AsyncCreateGuild(string, string, int32, string, func(int32, string, string))
|
||||
AsyncGetApplyList(int64, string, func(int32, string, int64, []string, []int32))
|
||||
AsyncGetApplyList(int64, string, func(int32, string, int64, []string))
|
||||
AsyncApplyJoin(string, string, func(int32, string))
|
||||
AsyncAcceptApply(string, string, func(int32, string))
|
||||
AsyncRejectApply(string, string, func(int32, string))
|
||||
|
@ -319,7 +319,7 @@ func (this *guildMgr) AsyncCreateGuild(accountId string, sessionId string, avata
|
||||
func (this *guildMgr) AsyncGetApplyList(lastIdx int64, accountId string,
|
||||
cb func(int32, string, int64, []string)) {
|
||||
guild := this.GetGuildByAccountId(accountId)
|
||||
if guild != nil {
|
||||
if guild == nil {
|
||||
cb(0, "", 0, nil)
|
||||
return
|
||||
}
|
||||
@ -327,28 +327,33 @@ func (this *guildMgr) AsyncGetApplyList(lastIdx int64, accountId string,
|
||||
constant.FRIEND_DB,
|
||||
50,
|
||||
0,
|
||||
"SELECT * FROM t_guild_apply",
|
||||
"SELECT * FROM t_guild_apply WHERE 1=1",
|
||||
[]string{},
|
||||
f5.GetDbFilter().Comp(
|
||||
f5.GetDbFilter().GT("idx", q5.ToString(lastIdx)).And(),
|
||||
f5.GetDbFilter().EQ("guild_id", guild.GetGuildId()).And(),
|
||||
f5.GetDbFilter().EQ("account_id", accountId).And(),
|
||||
f5.GetDbFilter().EQ("status", q5.ToString(constant.GUILD_APPLY_STATUS_NONE)),
|
||||
),
|
||||
"",
|
||||
func (err error, pg *f5.Pagination) {
|
||||
var lastSinceId int64
|
||||
accountIds := []string{}
|
||||
if err != nil {
|
||||
cb(500, "", lastSinceId, []string{})
|
||||
cb(500, "", lastSinceId, accountIds)
|
||||
return
|
||||
}
|
||||
if pg.Rows.Next() {
|
||||
idx := q5.ToInt64(pg.Rows.GetByName("idx"))
|
||||
accountId := pg.Rows.GetByName("account_id")
|
||||
if idx > lastSinceId {
|
||||
lastSinceId = idx
|
||||
} else {
|
||||
panic(fmt.Sprintf("AsyncGetApply idx error:%s %s", idx, lastSinceId))
|
||||
}
|
||||
q5.AppendSlice(&accountIds, accountId)
|
||||
}
|
||||
cb(0, "", lastSinceId, accountIds)
|
||||
return
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -426,7 +426,33 @@ func (this *player) CMApplyToGuild(hdr *f5.MsgHdr, msg *cs.CMApplyToGuild) {
|
||||
}
|
||||
|
||||
func (this *player) CMApplyList(hdr *f5.MsgHdr, msg *cs.CMApplyList) {
|
||||
|
||||
GetGuildMgr().AsyncGetApplyList(
|
||||
0,
|
||||
this.GetAccountId(),
|
||||
func (errCode int32, errMsg string, sinceId int64, accountIds []string) {
|
||||
rspMsg := new(cs.SMApplyList)
|
||||
if errCode != 0 {
|
||||
this.SendMsg(rspMsg.Err(1, "internal server error"))
|
||||
return
|
||||
}
|
||||
GetCacheMgr().AsyncGetUsers(
|
||||
accountIds,
|
||||
func (errCode int32, errMsg string) {
|
||||
if errCode != 0 {
|
||||
this.SendMsg(rspMsg.Err(1, "internal server error"))
|
||||
return
|
||||
}
|
||||
for _, accountId := range(accountIds) {
|
||||
userProfile := GetCacheMgr().GetUserProfile(accountId)
|
||||
if userProfile != nil {
|
||||
ele := new(cs.MFGuildMember)
|
||||
q5.AppendSlice(&rspMsg.Members, ele)
|
||||
userProfile.FillMFGuildMember(ele)
|
||||
}
|
||||
}
|
||||
this.SendMsg(rspMsg)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
func (this *player) CMApprove(hdr *f5.MsgHdr, msg *cs.CMApprove) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user