军团:捐献所等级第二天生效

This commit is contained in:
luying
2022-08-24 15:39:29 +08:00
parent 38ab926e6c
commit e50e412e75
3 changed files with 9 additions and 6 deletions

View File

@@ -3,12 +3,12 @@ import { UserGuildModel } from '../../../db/UserGuild';
import { resResult } from '../../../pubUtils/util';
import { DATA_NAME, ITEM_CHANGE_REASON, STATUS, TASK_TYPE } from '../../../consts';
import { DonationModel } from '../../../db/Donation';
import { nowSeconds } from '../../../pubUtils/timeUtil';
import { getZeroPoint, nowSeconds } from '../../../pubUtils/timeUtil';
import { getArmyDonateBaseByLv, getArmyDonateBoxBaseById } from '../../../pubUtils/data';
import { GuildModel } from '../../../db/Guild';
import { handleCost, addItems } from '../../../services/role/rewardService';
import { CHAT_SERVER, GUILD_POINT_WAYS } from '../../../consts';
import { addFund, donate, getDonation } from '../../../services/donateService';
import { addFund, donate, getDonation, getGuildFundByRefTime } from '../../../services/donateService';
import { getUserGuildWithRefActive, refreshUserGuild } from '../../../services/guildService';
import { ARMY } from '../../../pubUtils/dicParam';
import { addActive } from '../../../services/guildService'
@@ -82,7 +82,7 @@ export class DonationHandler {
res.releaseCallback();
return resResult(STATUS.GUILD_DONATE_TIMES_NOT_ENOUGH);
}
let { donationLv } = await getDonation(code, guild);
let { donationLv } = await getGuildFundByRefTime(code, getZeroPoint());
let { donateReward } = getArmyDonateBaseByLv(donationLv);
let { rewardGood, rewardFund, cosume } = donateReward.get(id);
let consumeResult = getVipDonateConsume(cosume, session.get('vipStartTime'));
@@ -93,7 +93,7 @@ export class DonationHandler {
}
let { donateCnt } = await UserGuildModel.donateFund(roleId, 1);
let { donateFund, reports } = await donate(code, rewardFund, id, roleName, guild);
let { donateFund, reports } = await donate(code, rewardFund, id, roleName, donationLv);
let goods = [];
if (!!rewardGood)
goods = await addItems(roleId, roleName, sid, [rewardGood], ITEM_CHANGE_REASON.DONATE);

View File

@@ -19,9 +19,9 @@ export async function getDonation(code: string, guild: GuildType) {
return donation;
}
export async function donate(code: string, fund: number, donateId: number, roleName: string, guild: GuildType) {
export async function donate(code: string, fund: number, donateId: number, roleName: string, donateLv: number) {
let refTime = getZeroPoint();
let donation = await DonationModel.donate(code, refTime, fund, { id: donateId, roleName, time: refTime }, getDonateLv(guild));
let donation = await DonationModel.donate(code, refTime, fund, { id: donateId, roleName, time: refTime, fund }, donateLv);
return donation;
}

View File

@@ -10,6 +10,9 @@ export class Report {
@prop({ required: true })
id: number;//捐献类型id 1-铜钱 2-元宝 3-至尊捐赠
@prop({ required: true })
fund: number;//捐献数
}
export default class Donation extends BaseModel {