抽卡:修复时间戳

This commit is contained in:
luying
2021-04-23 16:10:55 +08:00
parent beadccf778
commit eabfd1cdfd
4 changed files with 11 additions and 13 deletions

View File

@@ -2,7 +2,7 @@ import { ActivityModelType } from '../../db/Activity';
import { ActivityBase } from './activityField';
import { prop } from '@typegoose/typegoose';
import { UserGachaType } from '../../db/UserGacha';
import { getSeconds } from '../../pubUtils/timeUtil';
import { getSeconds, getAfterDateByDay } from '../../pubUtils/timeUtil';
import { DicGacha } from '../../pubUtils/dictionary/DicGacha';
import { getFloorStatus } from '../../services/gachaService';
import { GACHA_OCCUPY_HID } from '../../consts';
@@ -78,7 +78,7 @@ export class GachaListReturn {
if(userGacha) {
this.freeCount = userGacha.freeCount;
this.refFreeTime = getSeconds(userGacha.refFreeTime);
this.refFreeTime = getAfterDateByDay(userGacha.refFreeTime, dicGacha.free.day);
this.count = userGacha.count;
this.floor = getFloorStatus(dicGacha.id, userGacha.floor);
this.hope = userGacha.hope;

View File

@@ -264,7 +264,7 @@ export function getNextDayByGap(preDate: Date, curDate: Date, day: number) {
let gap = getDayGap(preDate, curDate);
let n = Math.ceil(gap / day);
let time = getAfterDateByDay(preDate, n);
return new Date(time);
return new Date(time * PER_SECOND);
}
/**
@@ -273,5 +273,5 @@ export function getNextDayByGap(preDate: Date, curDate: Date, day: number) {
*/
export function getAfterDateByDay(preDate: Date, day: number) {
let time = getZeroDate(preDate, REFRESH_HOUR).getTime() - day * PER_DAY;
return time;
return Math.floor(time/PER_SECOND);
}