diff --git a/shared/db/Role.ts b/shared/db/Role.ts index 412c46b31..b83d2d52d 100644 --- a/shared/db/Role.ts +++ b/shared/db/Role.ts @@ -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(); }