1
This commit is contained in:
parent
d2c335ecce
commit
a2a2038d20
@ -19,12 +19,14 @@ type guildMgr struct {
|
||||
idHash map[string]*guild
|
||||
nameHash map[string]*guild
|
||||
accountIdHash map[string]*guild
|
||||
usingNameHash map[string]int64
|
||||
}
|
||||
|
||||
func (this *guildMgr) Init() {
|
||||
this.idHash = make(map[string]*guild)
|
||||
this.nameHash = make(map[string]*guild)
|
||||
this.accountIdHash = make(map[string]*guild)
|
||||
this.usingNameHash = make(map[string]int64)
|
||||
this.loadFromDB()
|
||||
}
|
||||
|
||||
@ -124,14 +126,37 @@ func (this *guildMgr) GetGuildRank() []common.Guild {
|
||||
return guilds
|
||||
}
|
||||
|
||||
func (this *guildMgr) addUsingName(name string) {
|
||||
this.usingNameHash[name] = f5.GetApp().GetNowSeconds();
|
||||
}
|
||||
|
||||
func (this *guildMgr) isUsingName(name string) bool {
|
||||
if _, ok := this.usingNameHash[name]; ok {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
func (this* guildMgr) removeUsingName(name string) {
|
||||
delete(this.usingNameHash, name)
|
||||
}
|
||||
|
||||
func (this *guildMgr) AsyncCreateGuild(accountId string, avatar int32, name string,
|
||||
cb func(int32, string, int64)) {
|
||||
if this.internalGetGuildByAccountId(accountId) != nil {
|
||||
|
||||
cb(1, "", 0)
|
||||
return
|
||||
}
|
||||
if this.internalGetGuildByGuildName(name) != nil {
|
||||
|
||||
cb(1, "", 0)
|
||||
return
|
||||
}
|
||||
if this.isUsingName(name) {
|
||||
cb(1, "", 0)
|
||||
return
|
||||
}
|
||||
this.addUsingName(name)
|
||||
}
|
||||
|
||||
func (this *guildMgr) AsyncGetApplyList(lastIdx int64, accountId string,
|
||||
|
Loading…
x
Reference in New Issue
Block a user