镇念塔:修复加速次数

This commit is contained in:
luying
2021-08-19 14:13:51 +08:00
parent 90da4e3af2
commit 7fedc5dfba

View File

@@ -451,8 +451,8 @@ export default class Role extends BaseModel {
const result = await RoleModel.findOne({ roleId }).lean();
const lastSpdUpTime = result?.lastSpdUpTime;
let role: RoleType;
if(shouldRefresh(lastSpdUpTime, curTime)) {
role = await RoleModel.findOneAndUpdate({ roleId }, { hangUpSpdUpCnt: 0, lastSpdUpTime: curTime }, { new: true }).lean();
if(!lastSpdUpTime || shouldRefresh(lastSpdUpTime, curTime)) {
role = await RoleModel.findOneAndUpdate({ roleId }, { hangUpSpdUpCnt: cnt, lastSpdUpTime: curTime }, { new: true }).lean();
} else {
role = await RoleModel.findOneAndUpdate({ roleId, hangUpSpdUpCnt: { $lte: dicParam.TOWER_BOOST.TOWER_BOOSTTIME - cnt } }, { $inc: { hangUpSpdUpCnt: cnt }, lastSpdUpTime: curTime }, { new: true }).lean();
}