fix pvp战报覆盖bug
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import BaseModel from './BaseModel';
|
||||
import { index, getModelForClass, prop, DocumentType } from '@typegoose/typegoose';
|
||||
import { getBeforeDayDate } from '../pubUtils/timeUtil';
|
||||
import { genCode } from '../pubUtils/util';
|
||||
|
||||
export class HeroesRecord {
|
||||
@prop({ required: true, default: 0 })
|
||||
@@ -65,7 +66,8 @@ export default class PvpRecord extends BaseModel {
|
||||
|
||||
public static async createRec(param: { roleId1: string, roleId2: string, warId: number, attackInfo: PlayerInfo, defenseInfo: PlayerInfo, createTime: number }) {
|
||||
await this.delPvpRecords();
|
||||
const result = await PvpRecordModel.findOneAndUpdate({}, param, { new: true, upsert: true }).lean();
|
||||
let code = genCode(6);
|
||||
const result = await PvpRecordModel.findOneAndUpdate({ code }, param, { new: true, upsert: true }).lean();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user