This commit is contained in:
aozhiwei 2024-04-09 15:46:39 +08:00
parent 7927a484c4
commit 79cd9b8290
3 changed files with 40 additions and 0 deletions

View File

@ -98,6 +98,7 @@ type GuildMgr interface {
AsyncLeave(string, func(int32, string, []string))
AsyncKickout(string, string, func(int32, string))
AsyncDisband(string, func(int32, string, []string))
AsyncSetGuildJob(string, string, int32, func(int32, string))
AsyncSearch(string, string, func(int32, string))
AsyncGetGuildLogs(string, string, func(int32, string))
AsyncUpdateGuild(string, map[int32]string, func(int32, string))

View File

@ -537,6 +537,33 @@ func (this *guildMgr) AsyncLeave(accountId string, cb func(int32, string, []stri
})
}
func (this *guildMgr) AsyncSetGuildJob(accountId string, targetId string, guildJob int32,
cb func(int32, string)) {
guild := this.internalGetGuildByAccountId(accountId)
if guild == nil {
cb(0, "")
return;
}
if !guild.isOwner(accountId) {
cb(0, "")
return;
}
if guild.getMember(targetId) == nil {
cb(0, "")
return;
}
f5.NewLockAsyncTask(
[][]string{
{constant.GUILD_ID_LOCK_KEY, guild.guildId},
{constant.GUILD_NAME_LOCK_KEY, guild.guildName},
{constant.GUILD_MEMBER_LOCK_KEY, accountId},
{constant.GUILD_MEMBER_LOCK_KEY, targetId},
},
func (task *f5.LockAsyncTask) {
})
}
func (this *guildMgr) AsyncKickout(accountId string, targetId string, cb func(int32, string)) {
guild := this.internalGetGuildByAccountId(accountId)
if guild == nil {

View File

@ -511,6 +511,18 @@ func (this *player) CMDismissMember(hdr *f5.MsgHdr, msg *cs.CMDismissMember) {
}
func (this *player) CMSetMemberLevel(hdr *f5.MsgHdr, msg *cs.CMSetMemberLevel) {
rspMsg := new(cs.SMSetMemberLevel)
GetGuildMgr().AsyncSetGuildJob(
this.GetAccountId(),
msg.GetMemberAccountId(),
msg.GetMemberLevel(),
func (errCode int32, errMsg string) {
if errCode != 0 {
this.SendMsg(rspMsg.Err(errCode, errMsg))
return
}
this.SendMsg(rspMsg)
})
}
func (this *player) CMDisband(hdr *f5.MsgHdr, msg *cs.CMDisband) {