This commit is contained in:
aozhiwei 2024-03-30 12:51:31 +08:00
parent 702e9720b1
commit 11b1482cec
3 changed files with 26 additions and 7 deletions

View File

@ -68,7 +68,7 @@ type FriendMgr interface {
} }
type Guild interface { type Guild interface {
GetGuildId() int64 GetGuildId() string
} }
type GuildMember interface { type GuildMember interface {

View File

@ -5,4 +5,19 @@ import (
) )
type guild struct { type guild struct {
guildId string
guildName string
ownerId string
creatorId string
badge int32
notice string
joinCondType int32
joinCondVal int32
maxMemberNum int32
createTime int32
modifyTime int32
}
func (this *guild) GetGuildId() string {
return this.guildId
} }

View File

@ -12,14 +12,15 @@ const (
) )
type guildMgr struct { type guildMgr struct {
/* idHash map[string]*guild
guilds map[int64]*Guild // 公会ID -> 公会 nameHash map[string]*guild
guildLogs map[int64][]*GuildLog // 公会ID -> []公会日志列表 accountIdHash map[string]*guild
userGuilds map[string]int64 // accountId -> 公会ID
loadedFlags int64*/
} }
func (this *guildMgr) Init() { func (this *guildMgr) Init() {
this.idHash = make(map[string]*guild)
this.nameHash = make(map[string]*guild)
this.accountIdHash = make(map[string]*guild)
} }
func (this *guildMgr) UnInit() { func (this *guildMgr) UnInit() {
@ -29,7 +30,10 @@ func (this *guildMgr) isNameTooLong(name string, maxNum int) bool {
return len(name) > maxNum return len(name) > maxNum
} }
func (this *guildMgr) GetGuildByAccountId(string) common.Guild { func (this *guildMgr) GetGuildByAccountId(accountId string) common.Guild {
if guild, ok := this.accountIdHash[accountId]; ok {
return guild
}
return nil return nil
} }