This commit is contained in:
aozhiwei 2024-04-08 20:40:19 +08:00
parent a376e6a56c
commit 70ee014252
2 changed files with 19 additions and 0 deletions

View File

@ -76,6 +76,22 @@ func (this *guild) isOwner(accountId string) bool {
return this.ownerId == accountId
}
func (this *guild) updateByKv(kv map[int32]string) {
for k, v := range(kv) {
if k == constant.GUILD_UPDATE_FIELD_NOTICE {
this.notice = v
} else if k == constant.GUILD_UPDATE_FIELD_AVATAR {
this.badge = q5.ToInt32(v)
} else if k == constant.GUILD_UPDATE_FIELD_NAME {
this.guildName = v
} else if k == constant.GUILD_UPDATE_FIELD_COND_TYPE {
this.joinCondType = q5.ToInt32(v)
} else if k == constant.GUILD_UPDATE_FIELD_COND_VALUE {
this.joinCondVal = q5.ToInt32(v)
}
}
}
func (this *guild) disband() {
{
f5.GetJsStyleDb().Update(

View File

@ -600,6 +600,7 @@ func (this *guildMgr) AsyncUpdateGuild(accountId string, kv map[int32]string, cb
cb(2, "Insufficient permissions")
return
}
guildName := f5.GetApp().NewGlobalUuid()
if name, ok := kv[constant.GUILD_UPDATE_FIELD_NAME]; ok {
if this.internalGetGuildByGuildName(name) != nil {
cb(4, "Cube name already exists")
@ -610,10 +611,12 @@ func (this *guildMgr) AsyncUpdateGuild(accountId string, kv map[int32]string, cb
return
}
this.addUsingName(name)
guildName = name
}
f5.NewLockAsyncTask([][]string{
{constant.GUILD_ID_LOCK_KEY, guild.guildId},
{constant.GUILD_NAME_LOCK_KEY, guild.guildName},
{constant.GUILD_NAME_LOCK_KEY, guildName},
{constant.GUILD_MEMBER_LOCK_KEY, accountId},
},
func (task *f5.LockAsyncTask) {