This commit is contained in:
aozhiwei 2024-04-10 16:34:26 +08:00
parent 9450dc97d3
commit 449aa55a7c

View File

@ -98,13 +98,13 @@ func (this* cacheMgr) AsyncGetUsersAndFillMFGuildMember([]string, *[]*cs.MFGuild
}
func (this *cacheMgr) AsyncSearch(sinceId int64, q string,
cb func(int32, string, int64, []string)) {
func (this *cacheMgr) AsyncSearch(sinceId int64, q string, pbUsers *[]*cs.MFUser,
cb func(int32, string, int64)) {
f5.GetJsStyleDb().PageQuery(
constant.GAME_DB,
50,
0,
"SELECT * FROM t_user WHERE 1=1",
"SELECT idx, account_id FROM t_user WHERE 1=1",
[]string{},
f5.GetDbFilter().Comp(
f5.GetDbFilter().GT("idx", q5.ToString(sinceId)).And(),
@ -114,7 +114,7 @@ func (this *cacheMgr) AsyncSearch(sinceId int64, q string,
func (err error, pg *f5.Pagination) {
var lastSinceId int64 = sinceId
if err != nil {
cb(500, "", lastSinceId, []string{})
cb(500, "", lastSinceId)
return
}
users := []string{}
@ -124,7 +124,7 @@ func (this *cacheMgr) AsyncSearch(sinceId int64, q string,
if idx > lastSinceId {
lastSinceId = idx
} else {
panic(fmt.Sprintf("AsyncGetApply idx error:%s %s", idx, lastSinceId))
panic(fmt.Sprintf("cacheMgr.AsyncSearch idx error:%s %s", idx, lastSinceId))
}
u := this.getUser(accountId)
if u == nil {
@ -133,9 +133,16 @@ func (this *cacheMgr) AsyncSearch(sinceId int64, q string,
u.loadFromDb(pg.Rows)
this.userHash[u.accountId] = u
*q5.NewSliceElement(&users) = u.accountId
}
cb(0, "", lastSinceId, users)
this.AsyncGetUsersAndFillMFUser(
users, pbUsers,
func (errCode int32, errMsg string) {
if errCode != 0 {
cb(500, "", lastSinceId)
return
}
cb(0, "", lastSinceId)
})
})
}