diff --git a/server/imserver/friend/friendmgr.go b/server/imserver/friend/friendmgr.go index 246fbb60..39a4b56f 100644 --- a/server/imserver/friend/friendmgr.go +++ b/server/imserver/friend/friendmgr.go @@ -325,8 +325,25 @@ func (this *friendMgr) AsyncRemoveBlack(senderId string, targetId string, cb fun }) } -func (this *friendMgr) AsyncHasApply(string, func(int32, string, int32)) { - +func (this *friendMgr) AsyncHasApply(accountId string, cb func(int32, string, int32)) { + f5.GetJsStyleDb().OrmSelectOne( + constant.FRIEND_DB, + "t_friend_apply", + [][]string{ + {"target_id", accountId}, + {"status", q5.ToString(constant.FRIEND_APPLY_STATUS_NONE)}, + }, + func (err error, ds *f5.DataSet) { + if err != nil { + cb(500, "", 0) + return + } + if ds.Next() { + cb(0, "", 1) + } else { + cb(0, "", 0) + } + }) } func (this *friendMgr) addFriendShip(accountId1 string, accountId2 string, addTime int32) { diff --git a/server/imserver/guild/guildmgr.go b/server/imserver/guild/guildmgr.go index bf391dc1..4eb38971 100644 --- a/server/imserver/guild/guildmgr.go +++ b/server/imserver/guild/guildmgr.go @@ -813,8 +813,30 @@ func (this *guildMgr) AsyncGetRecommendGuild(num int32, cb func(int32, string, [ cb(0, "", guildIds) } -func (this *guildMgr) AsyncHasApply(string, func(int32, string, int32)) { - +func (this *guildMgr) AsyncHasApply(accountId string, cb func(int32, string, int32)) { + guild := this.GetGuildByAccountId(accountId) + if guild == nil { + cb(0, "", 0) + return + } + f5.GetJsStyleDb().OrmSelectOne( + constant.FRIEND_DB, + "t_guild_apply", + [][]string{ + {"guild_id", guild.GetGuildId()}, + {"status", q5.ToString(constant.GUILD_APPLY_STATUS_NONE)}, + }, + func (err error, ds *f5.DataSet) { + if err != nil { + cb(500, "", 0) + return + } + if ds.Next() { + cb(0, "", 1) + } else { + cb(0, "", 0) + } + }) } func (this *guildMgr) rearrangement() {