This commit is contained in:
aozhiwei 2024-04-07 16:14:16 +08:00
parent c3e4e511d0
commit d53188ef18

View File

@ -165,7 +165,7 @@ func (this *friendMgr) AsyncGetApplyList(lastIdx int64, accountId string,
constant.FRIEND_DB, constant.FRIEND_DB,
50, 50,
0, 0,
"SELECT * FROM t_friend_apply", "SELECT * FROM t_friend_apply WHERE 1=1",
[]string{}, []string{},
f5.GetDbFilter().Comp( f5.GetDbFilter().Comp(
f5.GetDbFilter().GT("idx", q5.ToString(lastIdx)).And(), f5.GetDbFilter().GT("idx", q5.ToString(lastIdx)).And(),
@ -174,18 +174,23 @@ func (this *friendMgr) AsyncGetApplyList(lastIdx int64, accountId string,
), ),
"", "",
func (err error, pg *f5.Pagination) { func (err error, pg *f5.Pagination) {
var lastSinceId int64 var lastSinceId int64 = lastIdx
if err != nil { if err != nil {
cb(500, "", lastSinceId, []string{}) cb(500, "", lastSinceId, []string{})
return
} }
users := []string{}
if pg.Rows.Next() { if pg.Rows.Next() {
idx := q5.ToInt64(pg.Rows.GetByName("idx")) idx := q5.ToInt64(pg.Rows.GetByName("idx"))
accountId := pg.Rows.GetByName("account_id")
if idx > lastSinceId { if idx > lastSinceId {
lastSinceId = idx lastSinceId = idx
} else { } else {
panic(fmt.Sprintf("AsyncGetApply idx error:%s %s", idx, lastSinceId)) panic(fmt.Sprintf("AsyncGetApply idx error:%s %s", idx, lastSinceId))
} }
*q5.NewSliceElement(&users) = accountId
} }
cb(0, "", lastSinceId, users)
}) })
} }