体力:enter中添加before

This commit is contained in:
luying
2021-12-26 07:36:54 +08:00
parent ce861323c1
commit 09151ef045

View File

@@ -23,7 +23,7 @@ export default class ActionPoint extends BaseModel {
buyTimes: number; // 当前体力
public static async getAp(roleId: string, lean = true) {
let result: ActionPointType = await ActionPointModel.findOne({roleId}).select('ap refTime buyRefTime buyTimes').lean(lean);
let result: ActionPointType = await ActionPointModel.findOne({roleId}).select('ap refTime buyRefTime buyTimes apBefore').lean(lean);
if(!result) {
result = await ActionPointModel.findOneAndUpdate({roleId}, { $setOnInsert: { ap: 0, refTime: 0, buyRefTime: 0, buyTimes: 0 } }, {new: true, upsert: true}).lean(lean)
}