远征:真人玩家数据从小到大取玩家数值
This commit is contained in:
@@ -135,8 +135,7 @@ export async function matchPlayers(roleId: string, scale: number, range: number,
|
||||
let resultRange = await RoleModel.findByCeScale(min, max);
|
||||
resultRange = resultRange.filter(cur => cur.roleId != roleId);
|
||||
if(resultRange.length > 0) {
|
||||
let index = Math.floor(Math.random() * resultRange.length);
|
||||
let role = resultRange[index];
|
||||
let role = resultRange[0];
|
||||
let {roleId, topLineup, topLineupCe } = role;
|
||||
let attrByHid = await getHeroesAttributes(roleId);
|
||||
|
||||
|
||||
@@ -109,6 +109,7 @@ export class Teraph {
|
||||
@index({ roleName: 1 })
|
||||
@index({ serverId: 1, roleId: 1 })
|
||||
@index({ towerLv: -1, towerUpTime: 1 })
|
||||
@index({ topLineupCe: 1, updatedAt: 1 })
|
||||
@index({ ce: -1 })
|
||||
// @index({ userInfo.uid: 1, serverId: 1 })
|
||||
export default class Role extends BaseModel {
|
||||
@@ -752,7 +753,7 @@ export default class Role extends BaseModel {
|
||||
public static async findByCeScale(min: number, max: number) {
|
||||
const result: RoleType[] = await RoleModel.find({ topLineupCe: { $lte: max, $gte: min } })
|
||||
.populate('topLineup.hero')
|
||||
.sort({ updatedAt: -1 }).limit(100).lean({ getters: true, virtuals: true });
|
||||
.sort({ topLineupCe: 1, updatedAt: 1 }).limit(10).lean({ getters: true, virtuals: true });
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user