1
This commit is contained in:
parent
dfe96fcd1f
commit
62eae3d17d
@ -91,7 +91,7 @@ type GuildMgr interface {
|
|||||||
AsyncGetGuildRank(int32, func(int32, string, []string))
|
AsyncGetGuildRank(int32, func(int32, string, []string))
|
||||||
AsyncGetRecommendGuild(int32, func(int32, string, []string))
|
AsyncGetRecommendGuild(int32, func(int32, string, []string))
|
||||||
|
|
||||||
AsyncLeave(string, func(int32, string, []string))
|
AsyncLeave(string, func(int32, string, string, string, []string))
|
||||||
AsyncKickout(string, string, func(int32, string, string, string))
|
AsyncKickout(string, string, func(int32, string, string, string))
|
||||||
AsyncDisband(string, func(int32, string, []string))
|
AsyncDisband(string, func(int32, string, []string))
|
||||||
AsyncSetGuildJob(string, string, int32, func(int32, string, string, string))
|
AsyncSetGuildJob(string, string, int32, func(int32, string, string, string))
|
||||||
|
@ -408,13 +408,14 @@ func (this *guildMgr) AsyncRejectApply(accountId string, targetId string,
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *guildMgr) AsyncLeave(accountId string, cb func(int32, string, []string)) {
|
func (this *guildMgr) AsyncLeave(accountId string,
|
||||||
|
cb func(int32, string, string, string, []string)) {
|
||||||
members := []string{}
|
members := []string{}
|
||||||
keys := [][]string{}
|
keys := [][]string{}
|
||||||
{
|
{
|
||||||
guild := this.internalGetGuildByAccountId(accountId)
|
guild := this.internalGetGuildByAccountId(accountId)
|
||||||
if guild == nil {
|
if guild == nil {
|
||||||
cb(0, "", members)
|
cb(0, "", "", "", members)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
keys = [][]string{
|
keys = [][]string{
|
||||||
@ -435,18 +436,18 @@ func (this *guildMgr) AsyncLeave(accountId string, cb func(int32, string, []stri
|
|||||||
members := []string{}
|
members := []string{}
|
||||||
if guild == nil {
|
if guild == nil {
|
||||||
task.SetSucc()
|
task.SetSucc()
|
||||||
cb(0, "", members)
|
cb(0, "", guild.guildId, guild.guildName, members)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
guild.asyncLeave(accountId,
|
guild.asyncLeave(accountId,
|
||||||
func (errCode int32, errMsg string) {
|
func (errCode int32, errMsg string) {
|
||||||
if errCode != 0 {
|
if errCode != 0 {
|
||||||
task.SetFail()
|
task.SetFail()
|
||||||
cb(errCode, errMsg, members)
|
cb(errCode, errMsg, guild.guildId, guild.guildName, members)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
task.SetSucc()
|
task.SetSucc()
|
||||||
cb(0, "", members)
|
cb(0, "", guild.guildId, guild.guildName, members)
|
||||||
return
|
return
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -560,12 +560,32 @@ func (this *player) CMLeaveGuild(hdr *f5.MsgHdr, msg *cs.CMLeaveGuild) {
|
|||||||
rspMsg := new(cs.SMLeaveGuild)
|
rspMsg := new(cs.SMLeaveGuild)
|
||||||
GetGuildMgr().AsyncLeave(
|
GetGuildMgr().AsyncLeave(
|
||||||
this.GetAccountId(),
|
this.GetAccountId(),
|
||||||
func (errCode int32, errMsg string, members []string) {
|
func (errCode int32, errMsg string, guildId string, guildName string, members []string) {
|
||||||
if errCode != 0 {
|
if errCode != 0 {
|
||||||
this.SendMsg(rspMsg.Err(errCode, errMsg))
|
this.SendMsg(rspMsg.Err(errCode, errMsg))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.SendMsg(rspMsg)
|
this.SendMsg(rspMsg)
|
||||||
|
{
|
||||||
|
{
|
||||||
|
pbGuilds := []*cs.MFGuildMember{}
|
||||||
|
GetCacheMgr().AsyncGetUsersAndFillMFGuildMember(
|
||||||
|
[]string{
|
||||||
|
this.GetAccountId(),
|
||||||
|
},
|
||||||
|
&pbGuilds,
|
||||||
|
func (errCode int32, errMsg string) {
|
||||||
|
if errCode == 0 && len(pbGuilds) > 0 {
|
||||||
|
notifyMsg := new(cs.SMLeaveGuildNotify)
|
||||||
|
notifyMsg.GuildId = proto.Int64(q5.ToInt64(guildId))
|
||||||
|
notifyMsg.Name = proto.String(guildName)
|
||||||
|
notifyMsg.AccountId = proto.String(pbGuilds[0].GetAccountId())
|
||||||
|
notifyMsg.Username = proto.String(pbGuilds[0].GetUsername())
|
||||||
|
GetGuildMgr().NotifyGuildMsg(guildId, notifyMsg)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user