1
This commit is contained in:
parent
819b2973c4
commit
305123c493
@ -590,8 +590,52 @@ func (this *guildMgr) AsyncGetGuildLogs(string, string, func(int32, string)) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *guildMgr) AsyncUpdateGuild(string, map[int32]string, func(int32, string)) {
|
func (this *guildMgr) AsyncUpdateGuild(accountId string, kv map[int32]string, cb func(int32, string)) {
|
||||||
|
guild := this.internalGetGuildByAccountId(accountId)
|
||||||
|
if guild == nil {
|
||||||
|
cb(1, "You don't have a cube yet")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if !guild.isOwner(accountId) {
|
||||||
|
cb(2, "Insufficient permissions")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
f5.NewLockAsyncTask([][]string{
|
||||||
|
{constant.GUILD_ID_LOCK_KEY, guild.guildId},
|
||||||
|
{constant.GUILD_NAME_LOCK_KEY, guild.guildName},
|
||||||
|
{constant.GUILD_MEMBER_LOCK_KEY, accountId},
|
||||||
|
},
|
||||||
|
func (task *f5.LockAsyncTask) {
|
||||||
|
fields := [][]string{}
|
||||||
|
for k, v := range(kv) {
|
||||||
|
if k == constant.GUILD_UPDATE_FIELD_NOTICE {
|
||||||
|
q5.AppendSlice(&fields, []string{"notice", v})
|
||||||
|
} else if k == constant.GUILD_UPDATE_FIELD_AVATAR {
|
||||||
|
q5.AppendSlice(&fields, []string{"badge", v})
|
||||||
|
} else if k == constant.GUILD_UPDATE_FIELD_NAME {
|
||||||
|
q5.AppendSlice(&fields, []string{"guild_name", v})
|
||||||
|
} else if k == constant.GUILD_UPDATE_FIELD_COND_TYPE {
|
||||||
|
q5.AppendSlice(&fields, []string{"join_cond_type", v})
|
||||||
|
} else if k == constant.GUILD_UPDATE_FIELD_COND_VALUE {
|
||||||
|
q5.AppendSlice(&fields, []string{"join_cond_value", v})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if len(fields) <= 0 {
|
||||||
|
task.SetSucc()
|
||||||
|
cb(0, "")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
f5.GetJsStyleDb().Update(
|
||||||
|
constant.FRIEND_DB,
|
||||||
|
"t_guild",
|
||||||
|
[][]string{
|
||||||
|
{"guild_id", guild.guildId},
|
||||||
|
},
|
||||||
|
fields,
|
||||||
|
func (err error, lastInsertId int64, rowsAffected int64) {
|
||||||
|
|
||||||
|
})
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *guildMgr) asyncSetApplyStatus(accountId string, guildId string, status int32,
|
func (this *guildMgr) asyncSetApplyStatus(accountId string, guildId string, status int32,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user