时间:整理时间方法
This commit is contained in:
@@ -3,8 +3,8 @@ import { ActivityModel } from "../db/Activity";
|
||||
import { DicGacha } from "../pubUtils/dictionary/DicGacha";
|
||||
import { UserGachaType, UserGachaModel } from "../db/UserGacha";
|
||||
import { shouldRefresh, getRandEelm, getRandEelmWithWeight } from "../pubUtils/util";
|
||||
import { REFRESH_HOUR, GACHA_TO_FLOOR, GACHA_FLOOR_TYPE, GACHA_CONTENT_TYPE, HERO_QUALITY_TYPE, GACHA_OCCUPY_HID, IT_TYPE, ITID, CONSUME_TYPE, SPECIAL_ATTR } from "../consts";
|
||||
import { getNextDayByGap, getTodayZeroDate } from "../pubUtils/timeUtil";
|
||||
import { REFRESH_TIME, GACHA_TO_FLOOR, GACHA_FLOOR_TYPE, GACHA_CONTENT_TYPE, HERO_QUALITY_TYPE, GACHA_OCCUPY_HID, IT_TYPE, ITID, CONSUME_TYPE, SPECIAL_ATTR, TIME_OUTPUT_TYPE } from "../consts";
|
||||
import { getTimeFunD, getZeroPointD } from "../pubUtils/timeUtil";
|
||||
import { gameData, getDicGachaFloor } from "../pubUtils/data";
|
||||
|
||||
/**
|
||||
@@ -38,13 +38,13 @@ export async function refreshGacha(dicGacha: DicGacha, userGacha: UserGachaType)
|
||||
}
|
||||
|
||||
let { roleId, gachaId, refFreeTime, refHopeTime, hope } = userGacha;
|
||||
if(shouldRefresh(refFreeTime, new Date(), REFRESH_HOUR, day)) {
|
||||
let ref = getNextDayByGap(refFreeTime, new Date(), day);
|
||||
if(shouldRefresh(refFreeTime, new Date(), REFRESH_TIME, day)) {
|
||||
let ref = <Date>getTimeFunD().getAfterDayByGap(refFreeTime, day);
|
||||
userGacha = await UserGachaModel.refreshFreeCount(roleId, gachaId, 0, ref);
|
||||
}
|
||||
if(shouldRefresh(refHopeTime, new Date(), REFRESH_HOUR)) {
|
||||
if(shouldRefresh(refHopeTime, new Date(), REFRESH_TIME)) {
|
||||
hope = hope.map(cur => { return { ...cur, hasGet: false}});
|
||||
let ref = getTodayZeroDate(REFRESH_HOUR);
|
||||
let ref = getZeroPointD();
|
||||
userGacha = await UserGachaModel.refreshHopeCount(roleId, gachaId, 0, hope, ref);
|
||||
}
|
||||
return userGacha
|
||||
|
||||
Reference in New Issue
Block a user