时间:整理时间方法
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { Application, BackendSession } from "pinus";
|
||||
import { resResult, getRandEelmWithWeight, shouldRefresh, getRandSingleEelm } from "../../../pubUtils/util";
|
||||
import { STATUS, GACHA_ID, HERO_QUALITY_TYPE, TASK_TYPE, REFRESH_HOUR } from "../../../consts";
|
||||
import { STATUS, GACHA_ID, HERO_QUALITY_TYPE, TASK_TYPE, REFRESH_TIME, TIME_OUTPUT_TYPE } from "../../../consts";
|
||||
import { gameData } from "../../../pubUtils/data";
|
||||
import { GachaListReturn, GachaResult, GachaData } from "../../../domain/activityField/gachaField";
|
||||
import { UserGachaModel } from "../../../db/UserGacha";
|
||||
@@ -9,7 +9,7 @@ import { RoleModel } from "../../../db/Role";
|
||||
import { HeroModel } from "../../../db/Hero";
|
||||
import { RewardInter } from "../../../pubUtils/interface";
|
||||
import { handleCost, createHeroes, addItems } from "../../../services/rewardService";
|
||||
import { getAfterDateByDay, getTodayZeroDate } from "../../../pubUtils/timeUtil";
|
||||
import { getZeroPointD, getTimeFun } from "../../../pubUtils/timeUtil";
|
||||
import { UserGachaRecModel } from "../../../db/UserGachaRec";
|
||||
import { ActivityModel } from "../../../db/Activity";
|
||||
import { checkTask } from "../../../services/taskService";
|
||||
@@ -133,7 +133,8 @@ export class GachaHandler {
|
||||
|
||||
let resultRefFreeTime = 0;
|
||||
if (dicGacha.free.count > 0) {
|
||||
resultRefFreeTime = getAfterDateByDay(refFreeTime, dicGacha.free.day);
|
||||
let f = getTimeFun(userGacha.refFreeTime);
|
||||
resultRefFreeTime = <number>f.getAfterDayWithHour(dicGacha.free.day);
|
||||
}
|
||||
return resResult(STATUS.SUCCESS, {
|
||||
gachaId, activityId,
|
||||
@@ -290,7 +291,7 @@ export class GachaHandler {
|
||||
const roleId: string = session.get('roleId');
|
||||
|
||||
let { visitedHero, refVisitedTime } = await UserGachaModel.findByRole(roleId, GACHA_ID.NORMAL, 0);
|
||||
if (shouldRefresh(refVisitedTime, new Date(), REFRESH_HOUR)) {
|
||||
if (shouldRefresh(refVisitedTime, new Date())) {
|
||||
visitedHero = [];
|
||||
}
|
||||
|
||||
@@ -317,9 +318,9 @@ export class GachaHandler {
|
||||
let { pieceId } = dicHero;
|
||||
|
||||
let { visitedHero, refVisitedTime } = await UserGachaModel.findByRole(roleId, GACHA_ID.NORMAL, 0);
|
||||
if (shouldRefresh(refVisitedTime, new Date(), REFRESH_HOUR)) {
|
||||
if (shouldRefresh(refVisitedTime, new Date())) {
|
||||
visitedHero = [];
|
||||
refVisitedTime = getTodayZeroDate(REFRESH_HOUR);
|
||||
refVisitedTime = getZeroPointD();
|
||||
}
|
||||
if (visitedHero.includes(hid)) {
|
||||
return resResult(STATUS.GACHA_HAS_VISITED);
|
||||
|
||||
Reference in New Issue
Block a user