修改远征创建记录逻辑
This commit is contained in:
@@ -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||{};
|
||||
|
||||
Reference in New Issue
Block a user