This commit is contained in:
aozhiwei 2024-04-11 17:37:33 +08:00
parent b8e6381687
commit fe14092f0b
2 changed files with 19 additions and 47 deletions

View File

@ -357,28 +357,6 @@ func (this *guildMgr) asyncAcceptApplyTask(task *f5.LockAsyncTask, guild *guild,
}
nowTime := f5.GetApp().GetNowSeconds()
model.GuildMember.Force(targetId, guild.guildId, constant.GuildMemberLevelDefault, nowTime,
/*
f5.GetJsStyleDb().Upsert(
constant.FRIEND_DB,
"t_guild_member",
[][]string{
{"member_id", targetId},
},
[][]string{
{"guild_id", guild.guildId},
{"guild_job", q5.ToString(constant.GuildMemberLevelDefault)},
{"deleted", q5.ToString(0)},
{"join_time", q5.ToString(nowTime)},
},
[][]string{
{"guild_id", guild.guildId},
{"member_id", targetId},
{"guild_job", q5.ToString(constant.GuildMemberLevelDefault)},
{"deleted", q5.ToString(0)},
{"join_time", q5.ToString(nowTime)},
{"createtime", q5.ToString(nowTime)},
{"modifytime", q5.ToString(nowTime)},
},*/
func (err error, lastInsertId int64, rowsAffected int64) {
if err != nil {
task.SetFail()
@ -388,11 +366,8 @@ func (this *guildMgr) asyncAcceptApplyTask(task *f5.LockAsyncTask, guild *guild,
m := newMember()
m.init(guild, constant.GuildMemberLevelDefault, targetId, int32(nowTime))
guild.addMember(m)
this.memberIdHash[targetId] = m
this.asyncSetApplyStatus(
targetId,
guild.guildId,
constant.GUILD_APPLY_STATUS_ACCEPT,
this.addGuildMember(m)
model.GuildApply.SetStatus(guild.guildId, targetId, constant.GUILD_APPLY_STATUS_ACCEPT,
func (err error, lastInsertId int64, rowsAffected int64) {
task.SetSucc()
cb(0, "")
@ -424,10 +399,7 @@ func (this *guildMgr) AsyncRejectApply(accountId string, targetId string,
cb(0, "")
return;
}
this.asyncSetApplyStatus(
targetId,
guild.guildId,
constant.GUILD_APPLY_STATUS_REJECT,
model.GuildApply.SetStatus(guild.guildId, targetId, constant.GUILD_APPLY_STATUS_REJECT,
func (err error, lastInsertId int64, rowsAffected int64) {
cb(0, "")
})
@ -793,22 +765,6 @@ func (this *guildMgr) AsyncUpdateGuild(accountId string, kv map[int32]string, cb
})
}
func (this *guildMgr) asyncSetApplyStatus(accountId string, guildId string, status int32,
cb func(error, int64, int64)) {
f5.GetJsStyleDb().Update(
constant.FRIEND_DB,
"t_guild_apply",
[][]string{
{"status", q5.ToString(status)},
{"modifytime", q5.ToString(f5.GetApp().GetNowSeconds())},
},
[][]string{
{"account_id", accountId},
{"guild_id", guildId},
},
cb)
}
func (this *guildMgr) AsyncGetGuildRank(num int32, cb func(int32, string, []string)) {
guildIds := []string{}
for _, m := range(this.guildRankList) {

View File

@ -36,3 +36,19 @@ func (this *guildApply) Force(guildId string, accountId string,
},
cb)
}
func (this *guildApply) SetStatus(guildId string, accountId string, status int32,
cb func (error, int64, int64)) {
f5.GetJsStyleDb().Update(
constant.FRIEND_DB,
"t_guild_apply",
[][]string{
{"status", q5.ToString(status)},
{"modifytime", q5.ToString(f5.GetApp().GetNowSeconds())},
},
[][]string{
{"account_id", accountId},
{"guild_id", guildId},
},
cb)
}