diff --git a/server/imserver_new/friend/friendmgr.go b/server/imserver_new/friend/friendmgr.go index 7a7d9cf9..51293aa0 100644 --- a/server/imserver_new/friend/friendmgr.go +++ b/server/imserver_new/friend/friendmgr.go @@ -159,7 +159,8 @@ func (this *friendMgr) getBlacks(accountId string) *map[string]int32 { return nil } -func (this *friendMgr) AsyncGetApplyList(lastIdx int64, accountId string, cb func(int32, string, int64, []string)) { +func (this *friendMgr) AsyncGetApplyList(lastIdx int64, accountId string, + cb func(int32, string, int64, []string)) { f5.GetJsStyleDb().PageQuery( constant.FRIEND_DB, 50, diff --git a/server/imserver_new/guild/guildmgr.go b/server/imserver_new/guild/guildmgr.go index aa531583..81ffe524 100644 --- a/server/imserver_new/guild/guildmgr.go +++ b/server/imserver_new/guild/guildmgr.go @@ -1,7 +1,11 @@ package guild import ( + "q5" + "f5" "main/common" + "main/constant" + "fmt" ) const ( @@ -51,8 +55,34 @@ func (this *guildMgr) AsyncCreateGuild(string, string, func(int32, string, int64 } -func (this *guildMgr) AsyncGetApplyList(int64, string, func(int32, string, int64, []string)) { - +func (this *guildMgr) AsyncGetApplyList(lastIdx int64, accountId string, + cb func(int32, string, int64, []string)) { + f5.GetJsStyleDb().PageQuery( + constant.FRIEND_DB, + 50, + 0, + "SELECT * FROM t_guild_apply", + []string{}, + f5.GetDbFilter().Comp( + f5.GetDbFilter().GT("idx", q5.ToString(lastIdx)).And(), + f5.GetDbFilter().EQ("account_id", accountId).And(), + f5.GetDbFilter().EQ("status", "0"), + ), + "", + func (err error, pg *f5.Pagination) { + var lastSinceId int64 + if err != nil { + cb(500, "", lastSinceId, []string{}) + } + if pg.Rows.Next() { + idx := q5.ToInt64(pg.Rows.GetByName("idx")) + if idx > lastSinceId { + lastSinceId = idx + } else { + panic(fmt.Sprintf("AsyncGetApply idx error:%s %s", idx, lastSinceId)) + } + } + }) } func (this *guildMgr) AsyncApplyJoin(string, string, func(int32, string)) {