军团:改表
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user