🐞 fix(guild): 军团数据跟人,不跟军团
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user