捐献所

This commit is contained in:
mamengke01
2021-02-03 10:38:58 +08:00
parent 1fb4e7b9be
commit f836d6586a
9 changed files with 38 additions and 183 deletions

View File

@@ -1,6 +1,6 @@
import { DonationModel } from '../db/Donation';
import { nowSeconds } from '../pubUtils/timeUtil';
import { getTodayZeroPoint, nowSeconds } from '../pubUtils/timeUtil';
import { GuildModel } from '../db/Guild';
import { findWhere } from 'underscore';
import { GUILD_STRUCTURE } from '../consts/constModules/guildConst';
@@ -9,7 +9,7 @@ export async function getDonation(code: string, serverId: number) {
if (!donation) {
donation = await createDonation(code, serverId);
}
if (donation.refTime < nowSeconds()) {
if (donation.refTime < getTodayZeroPoint()) {
let { structure } = await GuildModel.findGuild(code, serverId, 'structure');
let { lv } = findWhere(structure, {id: GUILD_STRUCTURE.DONATE});
donation = await DonationModel.updateDonation(code, { donateFund:0, reports:[], refTime: nowSeconds(), donationLv: lv});