体力:enter中添加before
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user