This commit is contained in:
aozhiwei 2024-03-30 09:58:22 +08:00
parent 7a96d0874c
commit 8bebbdc293

View File

@ -148,7 +148,7 @@ func (this *friendMgr) getBlacks(accountId string) *map[string]int32 {
return nil
}
func (this *friendMgr) AsyncGetApplyList(idx 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,
@ -156,13 +156,24 @@ func (this *friendMgr) AsyncGetApplyList(idx int64, accountId string, cb func(in
"SELECT * FROM t_friend_apply",
[]string{},
f5.GetDbFilter().Comp(
f5.GetDbFilter().GT("idx", q5.ToString(idx)).And(),
f5.GetDbFilter().GT("idx", q5.ToString(lastIdx)).And(),
f5.GetDbFilter().EQ("target_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))
}
}
})
}