This commit is contained in:
aozhiwei 2024-04-11 15:46:28 +08:00
parent 22aad31c74
commit 87ced0179a

View File

@ -185,32 +185,32 @@ func (this *guildMgr) asyncCreateGuildTask(task *f5.LockAsyncTask,
nowTime := f5.GetApp().GetNowSeconds()
model.Guild.New(guildId, guildName, creatorId, badge, nowTime,
func (err error, lastInsertId int64, rowsAffected int64) {
defer this.removeUsingName(guildName)
if err != nil {
this.removeUsingName(guildName)
task.SetFail()
cb(500, "server internal error", "")
return
}
model.GuildMember.Force(creatorId, guildId, constant.GuildMemberLevelLeader, nowTime,
func (err error, lastInsertId int64, rowsAffected int64) {
defer this.removeUsingName(guildName)
if err != nil {
task.SetFail()
cb(500, "server internal error", "")
return
}
g := newGuild()
g.init(guildId, guildName, creatorId, badge, constant.GuildMaxMembers, int32(nowTime))
this.addGuild(g)
oldGuild := this.internalGetGuildByAccountId(creatorId)
if oldGuild != nil {
if this.internalGetGuildByAccountId(creatorId) != nil {
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.memberIdHash[creatorId] = m
this.addGuildMember(m)
task.SetSucc()
cb(0, "", guildId)
}
@ -932,3 +932,7 @@ func (this* guildMgr) addGuild(g *guild) {
this.idHash[g.guildId] = g
this.nameHash[g.guildName] = g
}
func (this* guildMgr) addGuildMember(m *member) {
this.memberIdHash[m.memberId] = m
}