后台:设置关卡等级
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import BaseModel from './BaseModel';
|
||||
import { index, getModelForClass, prop, DocumentType } from '@typegoose/typegoose';
|
||||
import { gameData } from '../pubUtils/data';
|
||||
|
||||
class WarStatus {
|
||||
@prop({ required: true })
|
||||
@@ -86,6 +87,17 @@ export default class TowerRecord extends BaseModel {
|
||||
return rec;
|
||||
}
|
||||
|
||||
public static async insertTowerRec(roleId: string, lv: number) {
|
||||
let insertParams = [];
|
||||
let doc = new TowerRecordModel();
|
||||
for(let [towerLv, { warArray }] of gameData.tower) {
|
||||
if(towerLv < lv) {
|
||||
insertParams.push({...doc.toJSON(), roleId, lv: towerLv, warStatus: warArray.map(warId => ({ warId, status: true })), passed: true})
|
||||
} else if (towerLv == lv) {
|
||||
insertParams.push({...doc.toJSON(), roleId, lv: towerLv, warStatus: warArray.map(warId => ({ warId, status: true })), passed: false})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static async deleteAccount(roleId: string) {
|
||||
let result = await TowerRecordModel.deleteMany({roleId});
|
||||
|
||||
Reference in New Issue
Block a user