修改远征创建记录逻辑

This commit is contained in:
luying
2020-11-17 10:07:59 +08:00
parent d5a5cfc270
commit 0e2f043f93
26 changed files with 2147 additions and 1150 deletions

View File

@@ -51,26 +51,6 @@ export default class BattleRecord extends BaseModel {
return result;
}
public static async getBattleList( roleId: string, warType: number, lean = true) {
const searchObj = { roleId, warType, status: 1 };
const count = await BattleRecordModel.countDocuments(searchObj);
const limit = 1000;
const page = Math.ceil(count/limit);
let result = new Array();
for(let i = 0; i < page; i++) {
const battleRecords = await BattleRecordModel.find(searchObj)
.select('battleId battleCode warType star status')
.limit(1000)
.skip(1000 * i)
.sort({battleId: 1, star: -1, createdAt: -1})
.lean(lean);
for(let battleRecord of battleRecords) {
result.push(battleRecord);
}
}
return result;
}
public static async deleteAccount(roleId: string, lean = true) {
let result = await BattleRecordModel.deleteMany({roleId}).lean(lean);
return result||{};