时间:整理时间方法

This commit is contained in:
luying
2021-05-08 19:13:44 +08:00
parent 6f03a96c51
commit 78e3c26a7a
51 changed files with 662 additions and 411 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
import { DonationModel } from '../db/Donation';
import { getTodayZeroPoint, nowSeconds } from '../pubUtils/timeUtil';
import { getZeroPoint, nowSeconds } from '../pubUtils/timeUtil';
import { GuildModel } from '../db/Guild';
import { findWhere } from 'underscore';
import { GUILD_STRUCTURE } from '../consts/constModules/guildConst';
@@ -14,7 +14,7 @@ export async function getDonation(code: string, serverId: number) {
if (!donation) {
donation = await createDonation(code, serverId);
}
if (donation.refTime < getTodayZeroPoint()) {
if (donation.refTime < getZeroPoint()) {
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});