This commit is contained in:
aozhiwei 2024-04-11 19:10:36 +08:00
parent 8f036bfc22
commit 94cfbe867d
3 changed files with 32 additions and 35 deletions

View File

@ -104,41 +104,13 @@ func (this *guild) updateByKv(kv map[int32]string) {
} }
func (this *guild) disband() { func (this *guild) disband() {
{ model.Guild.Delete(this.guildId,
f5.GetJsStyleDb().Update( func (err error, lastInsertId int64, rowsAffected int64) {
constant.FRIEND_DB, })
"t_guild_member", model.GuildApply.Clear(this.guildId,
[][]string{ func (err error, lastInsertId int64, rowsAffected int64) {
{"deleted", "1"}, })
}, _guildMgr.delGuild(this)
[][]string{
{"guild_id", this.guildId},
},
func (err error, lastInsertId int64, rowsAffected int64) {
})
}
{
f5.GetJsStyleDb().Update(
constant.FRIEND_DB,
"t_guild_apply",
[][]string{
{"deleted", "1"},
},
[][]string{
{"guild_id", this.guildId},
},
func (err error, lastInsertId int64, rowsAffected int64) {
})
}
{
delete(_guildMgr.idHash, this.guildId)
delete(_guildMgr.nameHash, this.guildName)
this.traverseMembers(
func (m *member) bool {
delete(_guildMgr.memberIdHash, m.memberId)
return true
})
}
} }
func (this *guild) AsyncFillMFGuild(pbGuild *cs.MFGuild, cb func(int32, string)) { func (this *guild) AsyncFillMFGuild(pbGuild *cs.MFGuild, cb func(int32, string)) {

View File

@ -887,3 +887,13 @@ func (this *guildMgr) addGuildMember(m *member) {
func (this *guildMgr) delGuildMember(memberId string) { func (this *guildMgr) delGuildMember(memberId string) {
delete(this.memberIdHash, memberId) delete(this.memberIdHash, memberId)
} }
func (this *guildMgr) delGuild(g *guild) {
g.traverseMembers(
func (m *member) bool {
this.delGuildMember(m.memberId)
return true
})
delete(this.idHash, g.guildId)
delete(this.nameHash, g.guildName)
}

View File

@ -52,3 +52,18 @@ func (this *guildApply) SetStatus(guildId string, accountId string, status int32
}, },
cb) cb)
} }
func (this *guildApply) Clear(guildId string,
cb func (error, int64, int64)) {
f5.GetJsStyleDb().Update(
constant.FRIEND_DB,
"t_guild_apply",
[][]string{
{"deleted", "1"},
},
[][]string{
{"guild_id", guildId},
},
func (err error, lastInsertId int64, rowsAffected int64) {
})
}