添加获取寻宝记录接口

This commit is contained in:
liangtongchuan
2020-11-24 23:50:27 +08:00
parent 8cb7a2b612
commit 033dca69f8
3 changed files with 14 additions and 4 deletions

View File

@@ -137,12 +137,15 @@ export default class ComBattleTeam extends BaseModel {
return teams;
}
public static async getTeamByRoleAndTime(roleId: string, quality: number, time: Date, lean = true) {
let query = {roleIds: roleId, createdAt: {$gte: time}};
public static async getTeamByRoleAndTime(roleId: string, quality?: number, time?: Date, limitCnt = 50, lean = true) {
let query = {roleIds: roleId};
if (quality) {
query = Object.assign(query, {quality});
}
const teams = await ComBattleTeamModel.find(query).lean(lean);
if (time) {
query = Object.assign(query, {createdAt: {$gte: time}});
}
const teams = await ComBattleTeamModel.find(query).limit(limitCnt).lean(lean);
return teams;
}
}