Merge branch 'bugfix' into dev

This commit is contained in:
chenkai 2023-12-25 11:23:03 +08:00
commit 3346957b5a
2 changed files with 48 additions and 45 deletions

View File

@ -109,7 +109,7 @@ export default async function (call: ApiCall<ReqReceive, ResReceive>) {
}); });
const showOffListKey = showOffListKeyPrefix + activityId; const showOffListKey = showOffListKeyPrefix + activityId;
await G.iorediscross.lpush(showOffListKey, msg); await G.iorediscross.lpush(showOffListKey, msg);
await G.ioredis.ltrim(showOffListKey, 0, 49); // 限制列表保存 50 条消息, 避免无限增长 await G.iorediscross.ltrim(showOffListKey, 0, 49); // 限制列表保存 50 条消息, 避免无限增长
} }
} }
} else { } else {

View File

@ -6,13 +6,16 @@
export async function zbsGroup() { export async function zbsGroup() {
let arr = await G.mongodb.collection("hbzb_user_cross").find( let arr = await G.mongodb.collection("hbzb_user_cross").find(
{"jifen": {$gt: -999999}} {"jifen": {$gt: -999999}}
).sort(
{ "data.player.cTime": -1 }
).project({ ).project({
uid: 1, uid: 1,
jifen:1 jifen: 1,
'data.player.cTime': 1
}).toArray(); }).toArray();
// 移除mongo查询里的排序↑会造成内存超出报错
// 在内存里按照玩家注册时间相近的排序分组
R.sort((a, b) => b.data.player.cTime - a.data.player.cTime)
//有积分的玩家总数 //有积分的玩家总数
let groups = []; let groups = [];
let currGroup = []; let currGroup = [];