This commit is contained in:
aozhiwei 2024-04-04 14:05:11 +08:00
parent fe8befa333
commit e4303e3f02

View File

@ -101,7 +101,7 @@ func (this *guildMgr) GetGuildByGuildName(guildName string) common.Guild {
func (this *guildMgr) internalGetGuildByAccountId(accountId string) *guild { func (this *guildMgr) internalGetGuildByAccountId(accountId string) *guild {
m := this.internalGetMemberByAccountId(accountId) m := this.internalGetMemberByAccountId(accountId)
if m != nil { if m != nil {
return m.guild
} }
return nil return nil
} }
@ -153,8 +153,8 @@ func (this* guildMgr) removeUsingName(name string) {
delete(this.usingNameHash, name) delete(this.usingNameHash, name)
} }
func (this* guildMgr) genMemberLockKey(accountId string) string { func (this* guildMgr) genMemberLockKeys(accountIds []string) []string {
return accountId return accountIds
} }
func (this *guildMgr) asyncCreateGuildTask(task *f5.AsyncTask, accountId string, avatar int32, name string, func (this *guildMgr) asyncCreateGuildTask(task *f5.AsyncTask, accountId string, avatar int32, name string,
@ -240,8 +240,8 @@ func (this *guildMgr) asyncCreateGuildTask(task *f5.AsyncTask, accountId string,
func (this *guildMgr) AsyncCreateGuild(accountId string, avatar int32, name string, func (this *guildMgr) AsyncCreateGuild(accountId string, avatar int32, name string,
cb func(int32, string, int64)) { cb func(int32, string, int64)) {
lockKey := this.genMemberLockKey(accountId) lockKeys := this.genMemberLockKeys([]string{accountId})
f5.GetApp().AsyncLock(lockKey, f5.GetApp().AsyncLock(lockKeys,
f5.NewAsyncTask( f5.NewAsyncTask(
func (task *f5.AsyncTask) { func (task *f5.AsyncTask) {
this.asyncCreateGuildTask(task, accountId, avatar, name, cb) this.asyncCreateGuildTask(task, accountId, avatar, name, cb)
@ -319,8 +319,17 @@ func (this *guildMgr) AsyncApplyJoin(accountId string, guildId string, cb func(i
}) })
} }
func (this *guildMgr) AsyncAcceptApply(string, string, func(int32, string)) { func (this *guildMgr) asyncAcceptApplyTask(task *f5.AsyncTask,
accountId string, targetId string, cb func(int32, string)) {
}
func (this *guildMgr) AsyncAcceptApply(accountId string, targetId string, cb func(int32, string)) {
lockKeys := this.genMemberLockKeys([]string{accountId})
f5.GetApp().AsyncLock(lockKeys,
f5.NewAsyncTask(
func (task *f5.AsyncTask) {
this.asyncAcceptApplyTask(task, accountId, targetId, cb)
}))
} }
func (this *guildMgr) AsyncRejectApply(accountId string, guildId string, func (this *guildMgr) AsyncRejectApply(accountId string, guildId string,