镇念塔:一键跳关
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import BaseModel from './BaseModel';
|
||||
import { index, getModelForClass, prop, DocumentType } from '@typegoose/typegoose';
|
||||
import * as dicParam from '../pubUtils/dicParam';
|
||||
|
||||
class Goods {
|
||||
@prop({ required: true })
|
||||
@@ -38,12 +37,12 @@ export default class HangUpRecord extends BaseModel {
|
||||
@prop({ required: true, default: false })
|
||||
received: boolean; // 是否已经领取,true-领取,false-未领取
|
||||
|
||||
public static async initRecord(roleId: string, roleName: string, lean = true) {
|
||||
public static async initRecord(roleId: string, roleName: string, towerLv: number) {
|
||||
// console.log('****** initRecord before')
|
||||
const curTime = new Date();
|
||||
const recDoc = new HangUpRecordModel();
|
||||
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}, { $setOnInsert: update }, {upsert: true, new: true}).lean(lean);
|
||||
const update = Object.assign(recDoc.toJSON(), {roleId, roleName, startTime: curTime, towerLv});
|
||||
const rec: HangUpRecordType = await HangUpRecordModel.findOneAndUpdate({roleId, startLv: towerLv}, { $setOnInsert: update }, {upsert: true, new: true}).lean();
|
||||
|
||||
// console.log('****** initRecord after')
|
||||
return rec;
|
||||
|
||||
Reference in New Issue
Block a user