🐞 fix(guild): 军团数据跟人,不跟军团
This commit is contained in:
+15
-27
@@ -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 });
|
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: 试炼奖励, 无论在任何情况下都不能被清空(次数可以重置,奖励领过就不能再领了,无论在哪个军团)
|
// trainRewards: 试炼奖励, 无论在任何情况下都不能被清空(次数可以重置,奖励领过就不能再领了,无论在哪个军团)
|
||||||
// 【退出军团】 和 【再加入军团】在同一天
|
// 【退出军团】 和 【再加入军团】不在同一天; 此处包含: 首次加入军团(lastGuild == null)
|
||||||
if (isToday(role.quitGuildTime)) {
|
if (!isToday(role.quitGuildTime) && lastGuild) {
|
||||||
// 同一个军团: 所有数据保留; 不同军团: 许愿池数据清空,当天不允许许愿,其他数据保留
|
// 之前加入过军团 - 清空之前的数据
|
||||||
if (guildCode !== lastGuild?.guildCode) {
|
update.receiveBoxs = [];
|
||||||
update.wishGoods = [];
|
update.donateCnt = 0;
|
||||||
update.receivedWishPool = [];
|
update.receivedActive = [];
|
||||||
update.wishDntCnt = 0;
|
update.encourageCnt = 0;
|
||||||
}
|
update.bossChallengeCnt = 0;
|
||||||
|
update.receivedWishPool = [];
|
||||||
|
update.wishGoods = [];
|
||||||
} else {
|
update.wishDntCnt = 0;
|
||||||
// 【退出军团】 和 【再加入军团】不在同一天; 此处包含: 首次加入军团(lastGuild == null)
|
update.trainCount = 0;
|
||||||
if (lastGuild) {
|
update.buyTrainCount = 0;
|
||||||
// 之前加入过军团 - 清空之前的数据
|
update.trainTime = 0;
|
||||||
update.receiveBoxs = [];
|
update.refineCnt = [];
|
||||||
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;
|
delete update._id;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user