✨ feat(校验): 添加战场伤害统计伤害
This commit is contained in:
@@ -115,8 +115,8 @@ export class PvpRecordPlayerInfo {
|
||||
|
||||
@index({ code: 1 })
|
||||
@index({ battleCode: 1 })
|
||||
@index({ roleId1: 1, updatedAt: -1 })
|
||||
@index({ roleId2: 1, updatedAt: -1 })
|
||||
@index({ roleId1: 1, createTime: -1 })
|
||||
@index({ roleId2: 1, createTime: -1 })
|
||||
|
||||
export default class PvpRecord extends BaseModel {
|
||||
@prop({ required: true })
|
||||
@@ -146,7 +146,7 @@ export default class PvpRecord extends BaseModel {
|
||||
timeout: boolean;
|
||||
|
||||
public static async createRec(roleId1: string, roleId2: string, battleCode: string) {
|
||||
await this.delPvpRecords();
|
||||
// await this.delPvpRecords();
|
||||
let code = genCode(6);
|
||||
const result = await PvpRecordModel.findOneAndUpdate({ code }, { $set: { roleId1, roleId2, battleCode } }, { new: true, upsert: true }).lean();
|
||||
return result;
|
||||
@@ -158,8 +158,9 @@ export default class PvpRecord extends BaseModel {
|
||||
}
|
||||
|
||||
public static async getRecByRoleId( roleId: string, limit = 15, lean = true) {
|
||||
await this.delPvpRecords();
|
||||
const result: PvpRecord[] = await PvpRecordModel.find({ $or:[{roleId1: roleId}, {roleId2: roleId}], createTime: { $gt: 0 } }).select('-_id -__v -createdAt -updatedAt').limit(limit).sort({createTime: -1}).lean(lean);
|
||||
// await this.delPvpRecords();
|
||||
let t = <number>getTimeFun().getBeforeDayWithHour(3);
|
||||
const result: PvpRecord[] = await PvpRecordModel.find({ $or:[{roleId1: roleId}, {roleId2: roleId}], createTime: { $gt: t } }).select('-_id -__v -createdAt -updatedAt').limit(limit).sort({createTime: -1}).lean(lean);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user