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))
|
AsyncCreateGuild(string, string, int32, string, func(int32, string, string))
|
||||||
AsyncGetApplyList(int64, string, func(int32, string, int64, []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))
|
AsyncAcceptApply(string, string, func(int32, string, string, string))
|
||||||
AsyncRejectApply(string, string, func(int32, string))
|
AsyncRejectApply(string, string, func(int32, string))
|
||||||
AsyncGetGuildRank(int32, func(int32, string, []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 {
|
if this.internalGetGuildByAccountId(accountId) != nil {
|
||||||
cb(0, "")
|
cb(0, "", nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
guild := this.internalGetGuildByGuildId(guildId)
|
guild := this.internalGetGuildByGuildId(guildId)
|
||||||
if guild == nil {
|
if guild == nil {
|
||||||
cb(0, "")
|
cb(0, "", nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
nowTime := f5.GetApp().GetNowSeconds()
|
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,
|
model.GuildApply.SetStatus(guild.guildId, accountId, constant.GUILD_APPLY_STATUS_ACCEPT,
|
||||||
func (err error, lastInsertId int64, rowsAffected int64) {
|
func (err error, lastInsertId int64, rowsAffected int64) {
|
||||||
GetDbLogMgr().GuildAccpetApply(guild.guildId, accountId, accountId)
|
GetDbLogMgr().GuildAccpetApply(guild.guildId, accountId, accountId)
|
||||||
cb(0, "")
|
|
||||||
return
|
return
|
||||||
})
|
})
|
||||||
|
cb(0, "", guild)
|
||||||
} else {
|
} else {
|
||||||
model.GuildApply.Force(
|
model.GuildApply.Force(
|
||||||
guildId,
|
guildId,
|
||||||
accountId,
|
accountId,
|
||||||
func (err error, lastInsertId int64, rowsAffected int64) {
|
func (err error, lastInsertId int64, rowsAffected int64) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
cb(500, "server internal error")
|
cb(500, "server internal error", nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
cb(0, "")
|
cb(0, "", nil)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -506,12 +506,30 @@ func (this *player) CMApplyToGuild(hdr *f5.MsgHdr, msg *cs.CMApplyToGuild) {
|
|||||||
GetGuildMgr().AsyncApplyJoin(
|
GetGuildMgr().AsyncApplyJoin(
|
||||||
this.GetAccountId(),
|
this.GetAccountId(),
|
||||||
q5.ToString(msg.GetGuildId()),
|
q5.ToString(msg.GetGuildId()),
|
||||||
func (errCode int32, errMsg string) {
|
func (errCode int32, errMsg string, okGuild common.Guild) {
|
||||||
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)
|
||||||
|
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
|
return
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user