From 8725d7990ec042bdc5d5539601b84512a4420665 Mon Sep 17 00:00:00 2001 From: dingchaolin Date: Tue, 7 Mar 2023 14:39:45 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9E=20fix(guild):=20=E5=86=9B=E5=9B=A2?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E8=B7=9F=E4=BA=BA=EF=BC=8C=E4=B8=8D=E8=B7=9F?= =?UTF-8?q?=E5=86=9B=E5=9B=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shared/db/UserGuild.ts | 42 +++++++++++++++--------------------------- 1 file changed, 15 insertions(+), 27 deletions(-) diff --git a/shared/db/UserGuild.ts b/shared/db/UserGuild.ts index 7fb3268be..4769f195f 100644 --- a/shared/db/UserGuild.ts +++ b/shared/db/UserGuild.ts @@ -153,33 +153,21 @@ export default class UserGuild extends BaseModel { const update = Object.assign(doc.toJSON(), { guildCode, roleId: role.roleId, role: role._id, job, auth, receiveBoxs, donateCnt, receivedActive, encourageCnt, bossChallengeCnt, receivedWishPool, wishGoods, wishDntCnt, refTimeDaily, refBossTime, trainCount, buyTrainCount, trainTime, trainRewards, refineCnt, refRefineTime }); // trainRewards: 试炼奖励, 无论在任何情况下都不能被清空(次数可以重置,奖励领过就不能再领了,无论在哪个军团) - // 【退出军团】 和 【再加入军团】在同一天 - if (isToday(role.quitGuildTime)) { - // 同一个军团: 所有数据保留; 不同军团: 许愿池数据清空,当天不允许许愿,其他数据保留 - if (guildCode !== lastGuild?.guildCode) { - update.wishGoods = []; - update.receivedWishPool = []; - update.wishDntCnt = 0; - } - - - } else { - // 【退出军团】 和 【再加入军团】不在同一天; 此处包含: 首次加入军团(lastGuild == null) - if (lastGuild) { - // 之前加入过军团 - 清空之前的数据 - update.receiveBoxs = []; - update.donateCnt = 0; - update.receivedActive = []; - update.encourageCnt = 0; - update.bossChallengeCnt = 0; - update.receivedWishPool = []; - update.wishGoods = []; - update.wishDntCnt = 0; - update.trainCount = 0; - update.buyTrainCount = 0; - update.trainTime = 0; - update.refineCnt = []; - } + // 【退出军团】 和 【再加入军团】不在同一天; 此处包含: 首次加入军团(lastGuild == null) + if (!isToday(role.quitGuildTime) && lastGuild) { + // 之前加入过军团 - 清空之前的数据 + update.receiveBoxs = []; + update.donateCnt = 0; + update.receivedActive = []; + update.encourageCnt = 0; + update.bossChallengeCnt = 0; + update.receivedWishPool = []; + update.wishGoods = []; + update.wishDntCnt = 0; + update.trainCount = 0; + update.buyTrainCount = 0; + update.trainTime = 0; + update.refineCnt = []; } delete update._id;