This commit is contained in:
aozhiwei 2024-04-11 17:07:57 +08:00
parent 87ced0179a
commit 831d2480fc

View File

@ -75,7 +75,7 @@ func (this *guildMgr) loadGuildMember() {
p := newMember()
p.init(g, guildJob, memberId, joinTime)
g.addMember(p)
this.memberIdHash[memberId] = p
this.addGuildMember(p)
}
},
func (err error) {
@ -203,14 +203,7 @@ func (this *guildMgr) asyncCreateGuildTask(task *f5.LockAsyncTask,
task.SetFail()
panic(fmt.Sprintf("asyncCreateGuildTask:%s", ""))
} else {
g := newGuild()
g.init(guildId, guildName, creatorId, badge, constant.GuildMaxMembers, int32(nowTime))
this.addGuild(g)
m := newMember()
m.init(g, constant.GuildMemberLevelLeader,
creatorId, q5.ToInt32(nowTime))
g.addMember(m)
this.addGuildMember(m)
this.createGuildAndAddOwner(guildId, guildName, creatorId, badge, nowTime)
task.SetSucc()
cb(0, "", guildId)
}
@ -928,6 +921,19 @@ func (this* guildMgr) traverseGuild(cb func(*guild) bool) {
}
}
func (this *guildMgr) createGuildAndAddOwner(guildId string, guildName string, creatorId string,
badge int32, nowTime int64) {
g := newGuild()
g.init(guildId, guildName, creatorId, badge, constant.GuildMaxMembers, int32(nowTime))
this.addGuild(g)
{
m := newMember()
m.init(g, constant.GuildMemberLevelLeader, creatorId, q5.ToInt32(nowTime))
g.addMember(m)
this.addGuildMember(m)
}
}
func (this* guildMgr) addGuild(g *guild) {
this.idHash[g.guildId] = g
this.nameHash[g.guildName] = g