镇念塔:系统参数表

This commit is contained in:
luying
2021-08-18 16:44:54 +08:00
parent 7d1f49e02a
commit a4627b3ac6
7 changed files with 119 additions and 89 deletions
+3 -2
View File
@@ -1,6 +1,7 @@
import { HANG_UP_CONSTS } from './../consts';
import BaseModel from './BaseModel';
import { index, getModelForClass, prop, DocumentType } from '@typegoose/typegoose';
import * as dicParam from '../pubUtils/dicParam';
class Goods {
@prop({ required: true })
@@ -41,8 +42,8 @@ export default class HangUpRecord extends BaseModel {
public static async initRecord(roleId: string, roleName: string, lean = true) {
const curTime = new Date();
const recDoc = new HangUpRecordModel();
const update = Object.assign(recDoc.toJSON(), {roleId, roleName, startTime: curTime, startLv: HANG_UP_CONSTS.ENABLE_LV});
const rec: HangUpRecordType = await HangUpRecordModel.findOneAndUpdate({roleId, startLv: HANG_UP_CONSTS.ENABLE_LV}, update, {upsert: true, new: true}).lean(lean);
const update = Object.assign(recDoc.toJSON(), {roleId, roleName, startTime: curTime, startLv: dicParam.TOWER_HANG_UP.TOWER_HANG_UP_ENABLE_LV + 1});
const rec: HangUpRecordType = await HangUpRecordModel.findOneAndUpdate({roleId, startLv: dicParam.TOWER_HANG_UP.TOWER_HANG_UP_ENABLE_LV + 1}, update, {upsert: true, new: true}).lean(lean);
return rec;
}