1
This commit is contained in:
parent
e4303e3f02
commit
98a20af7c2
@ -36,6 +36,11 @@ const (
|
|||||||
GAME_ID = 2006
|
GAME_ID = 2006
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
MEMBER_LOCK_KEY = "member:"
|
||||||
|
GUILD_LOCK_KEY = "guild:"
|
||||||
|
)
|
||||||
|
|
||||||
// im server chat
|
// im server chat
|
||||||
const (
|
const (
|
||||||
CCBegin = iota
|
CCBegin = iota
|
||||||
|
@ -153,10 +153,6 @@ func (this* guildMgr) removeUsingName(name string) {
|
|||||||
delete(this.usingNameHash, name)
|
delete(this.usingNameHash, name)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this* guildMgr) genMemberLockKeys(accountIds []string) []string {
|
|
||||||
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,
|
||||||
cb func(int32, string, int64)) {
|
cb func(int32, string, int64)) {
|
||||||
if this.internalGetGuildByAccountId(accountId) != nil {
|
if this.internalGetGuildByAccountId(accountId) != nil {
|
||||||
@ -240,8 +236,9 @@ 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)) {
|
||||||
lockKeys := this.genMemberLockKeys([]string{accountId})
|
f5.GetApp().AsyncLock([][]string{
|
||||||
f5.GetApp().AsyncLock(lockKeys,
|
{constant.MEMBER_LOCK_KEY, accountId},
|
||||||
|
},
|
||||||
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)
|
||||||
@ -324,8 +321,10 @@ func (this *guildMgr) asyncAcceptApplyTask(task *f5.AsyncTask,
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *guildMgr) AsyncAcceptApply(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([][]string{
|
||||||
f5.GetApp().AsyncLock(lockKeys,
|
{constant.MEMBER_LOCK_KEY, accountId},
|
||||||
|
{constant.MEMBER_LOCK_KEY, targetId},
|
||||||
|
},
|
||||||
f5.NewAsyncTask(
|
f5.NewAsyncTask(
|
||||||
func (task *f5.AsyncTask) {
|
func (task *f5.AsyncTask) {
|
||||||
this.asyncAcceptApplyTask(task, accountId, targetId, cb)
|
this.asyncAcceptApplyTask(task, accountId, targetId, cb)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user