This commit is contained in:
aozhiwei 2024-04-04 14:33:41 +08:00
parent 9d80bbf3d4
commit d81a77c3c3

View File

@ -318,6 +318,40 @@ func (this *guildMgr) AsyncApplyJoin(accountId string, guildId string, cb func(i
func (this *guildMgr) asyncAcceptApplyTask(task *f5.AsyncTask, guild *guild,
accountId string, targetId string, cb func(int32, string)) {
if !guild.isOwner(accountId) {
task.SetFail()
cb(1, "")
return
}
if this.internalGetMemberByAccountId(targetId) != nil {
task.SetFail()
cb(1, "")
return
}
nowTime := q5.ToInt32(f5.GetApp().GetNowSeconds())
f5.GetJsStyleDb().Update(
constant.FRIEND_DB,
"t_guild",
[][]string{
{"member_id", accountId},
},
[][]string{
{"guild_id", guild.guildId},
{"deleted", q5.ToString(0)},
{"join_time", q5.ToString(nowTime)},
},
func (err error, lastInsertId int64, rowsAffected int64) {
if err != nil {
task.SetFail()
cb(1, "")
return
}
m := newMember()
m.init(guild, targetId, nowTime)
guild.addMember(m)
this.memberIdHash[targetId] = m
task.SetSucc()
})
}
func (this *guildMgr) AsyncAcceptApply(accountId string, targetId string, cb func(int32, string)) {