1
This commit is contained in:
parent
bfce47f8cc
commit
63896afdb6
@ -88,7 +88,7 @@ type GuildMgr interface {
|
||||
|
||||
AsyncCreateGuild(string, string, int32, string, func(int32, string, string))
|
||||
AsyncGetApplyList(int64, string, func(int32, string, int64, []string))
|
||||
AsyncApplyJoin(string, string, func(int32, string))
|
||||
AsyncApplyJoin(string, string, func(int32, string, Guild))
|
||||
AsyncAcceptApply(string, string, func(int32, string, string, string))
|
||||
AsyncRejectApply(string, string, func(int32, string))
|
||||
AsyncGetGuildRank(int32, func(int32, string, []string))
|
||||
|
@ -321,14 +321,14 @@ func (this *guildMgr) AsyncGetApplyList(lastIdx int64, accountId string,
|
||||
})
|
||||
}
|
||||
|
||||
func (this *guildMgr) AsyncApplyJoin(accountId string, guildId string, cb func(int32, string)) {
|
||||
func (this *guildMgr) AsyncApplyJoin(accountId string, guildId string, cb func(int32, string, common.Guild)) {
|
||||
if this.internalGetGuildByAccountId(accountId) != nil {
|
||||
cb(0, "")
|
||||
cb(0, "", nil)
|
||||
return
|
||||
}
|
||||
guild := this.internalGetGuildByGuildId(guildId)
|
||||
if guild == nil {
|
||||
cb(0, "")
|
||||
cb(0, "", nil)
|
||||
return
|
||||
}
|
||||
nowTime := f5.GetApp().GetNowSeconds()
|
||||
@ -341,19 +341,19 @@ func (this *guildMgr) AsyncApplyJoin(accountId string, guildId string, cb func(i
|
||||
model.GuildApply.SetStatus(guild.guildId, accountId, constant.GUILD_APPLY_STATUS_ACCEPT,
|
||||
func (err error, lastInsertId int64, rowsAffected int64) {
|
||||
GetDbLogMgr().GuildAccpetApply(guild.guildId, accountId, accountId)
|
||||
cb(0, "")
|
||||
return
|
||||
})
|
||||
cb(0, "", guild)
|
||||
} else {
|
||||
model.GuildApply.Force(
|
||||
guildId,
|
||||
accountId,
|
||||
func (err error, lastInsertId int64, rowsAffected int64) {
|
||||
if err != nil {
|
||||
cb(500, "server internal error")
|
||||
cb(500, "server internal error", nil)
|
||||
return
|
||||
}
|
||||
cb(0, "")
|
||||
cb(0, "", nil)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -506,12 +506,30 @@ func (this *player) CMApplyToGuild(hdr *f5.MsgHdr, msg *cs.CMApplyToGuild) {
|
||||
GetGuildMgr().AsyncApplyJoin(
|
||||
this.GetAccountId(),
|
||||
q5.ToString(msg.GetGuildId()),
|
||||
func (errCode int32, errMsg string) {
|
||||
func (errCode int32, errMsg string, okGuild common.Guild) {
|
||||
if errCode != 0 {
|
||||
this.SendMsg(rspMsg.Err(errCode, errMsg))
|
||||
return
|
||||
}
|
||||
this.SendMsg(rspMsg)
|
||||
if okGuild != nil {
|
||||
pbGuilds := []*cs.MFGuildMember{}
|
||||
GetCacheMgr().AsyncGetUsersAndFillMFGuildMember(
|
||||
[]string{
|
||||
this.GetAccountId(),
|
||||
},
|
||||
&pbGuilds,
|
||||
func (errCode int32, errMsg string) {
|
||||
if errCode == 0 && len(pbGuilds) > 0 {
|
||||
notifyMsg := new(cs.SMApproveJoinGuildNotify)
|
||||
notifyMsg.GuildId = proto.Int64(q5.ToInt64(okGuild.GetGuildId()))
|
||||
notifyMsg.Name = proto.String(okGuild.GetGuildName())
|
||||
notifyMsg.AccountId = proto.String(pbGuilds[0].GetAccountId())
|
||||
notifyMsg.Username = proto.String(pbGuilds[0].GetUsername())
|
||||
GetGuildMgr().NotifyGuildMsg(q5.ToString(msg.GetGuildId()), notifyMsg)
|
||||
}
|
||||
})
|
||||
}
|
||||
return
|
||||
})
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user