From 7fedc5dfbad68b2cfd3051c2eace55aae8ea252b Mon Sep 17 00:00:00 2001 From: luying Date: Thu, 19 Aug 2021 14:13:51 +0800 Subject: [PATCH] =?UTF-8?q?=E9=95=87=E5=BF=B5=E5=A1=94=EF=BC=9A=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E5=8A=A0=E9=80=9F=E6=AC=A1=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shared/db/Role.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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(); }