军团:改表

This commit is contained in:
luying
2021-12-21 19:26:24 +08:00
parent 75da9edc85
commit b304995c5d
17 changed files with 7838 additions and 2469 deletions

View File

@@ -117,14 +117,11 @@ export class DonationHandler {
const { guildCode: code, receiveBoxs: resReceiveBoxs } = userGuild;
if (resReceiveBoxs.indexOf(id) != -1)
return resResult(STATUS.GUILD_DONATE_BOXS_IS_GOT);
let { boxRewards, fund } = getArmyDonateBoxBaseById(id);
let { boxRewards, fund, level } = getArmyDonateBoxBaseById(id);
let { donateFund, donationLv } = await getDonation(code, serverId);
let { boxRewardRatio, requireRewardRatio } = getArmyDonateBaseByLv(donationLv);
if (donateFund < Math.floor(fund * (100 + requireRewardRatio) / 100))
if( donationLv < level) return resResult(STATUS.GUILD_DONATE_LV_NOT_ENOUGH)
if (donateFund < fund)
return resResult(STATUS.GUILD_DONATE_BOXS_NOT_GOT);
boxRewards = boxRewards.map(({ id, count }) => {
return { id, count: count * (boxRewardRatio + 100) };
});
resReceiveBoxs.push(id);
let { receiveBoxs } = await UserGuildModel.updateInfo(roleId, { receiveBoxs: resReceiveBoxs }, {}, 'receiveBoxs');
let goods = await addItems(roleId, roleName, sid, boxRewards, ITEM_CHANGE_REASON.DONATE_BOX);