diff --git a/game-server/app/servers/activity/handler/gachaHandler.ts b/game-server/app/servers/activity/handler/gachaHandler.ts index f71e0ec8d..532139eed 100644 --- a/game-server/app/servers/activity/handler/gachaHandler.ts +++ b/game-server/app/servers/activity/handler/gachaHandler.ts @@ -1,19 +1,17 @@ import { Application, BackendSession } from "pinus"; import { resResult, getRandomWithWeight } from "../../../pubUtils/util"; -import { STATUS, GACHA_ID, GACHA_CONTENT_TYPE, GACHA_OCCUPY_HID } from "../../../consts"; +import { STATUS, GACHA_ID } from "../../../consts"; import { gameData } from "../../../pubUtils/data"; -import { GachaListReturn, Floor, Hope, GachaResult } from "../../../domain/activityField/gachaField"; +import { GachaListReturn, GachaResult } from "../../../domain/activityField/gachaField"; import { UserGachaModel } from "../../../db/UserGacha"; import { refreshGacha, getFloorResult, getResultFromContentId, transPiece } from "../../../services/gachaService"; import { RoleModel } from "../../../db/Role"; import { HeroModel, HeroUpdate } from "../../../db/Hero"; import { RewardInter } from "../../../pubUtils/interface"; import { handleCost, createHeroes, addItems } from "../../../services/rewardService"; -import { CounterModel } from "../../../db/Counter"; -import { getNextTime, getAfterDateByDay } from "../../../pubUtils/timeUtil"; +import { getAfterDateByDay } from "../../../pubUtils/timeUtil"; import { UserGachaRecModel } from "../../../db/UserGachaRec"; - export default function (app: Application) { return new GachaHandler(app); } @@ -38,8 +36,8 @@ export class GachaHandler { if(id == GACHA_ID.TIMELIMIT) continue; // 不包括限时 let userGacha = userGachaList.find(cur => cur.gachaId == id); - userGacha = await refreshGacha(dicGacha, userGacha); - console.log(JSON.stringify(userGacha)) + if(userGacha) + userGacha = await refreshGacha(dicGacha, userGacha); let param = new GachaListReturn(dicGacha, userGacha); list.push(param); } @@ -97,7 +95,7 @@ export class GachaHandler { } resultList.push(result); } -console.log('***', dicGacha.free.count, dicGacha.free.day, freeCount, count); + let costNum = count; if(dicGacha.free.count > 0) { if(count > dicGacha.free.count - freeCount) { diff --git a/pushdocker.sh b/pushdocker.sh index ff0bbcc3a..572a38ad7 100755 --- a/pushdocker.sh +++ b/pushdocker.sh @@ -25,5 +25,5 @@ fi node ./game-server/config.js ${1} -rsync -av --include '.babelrc' --include '.eslintrc.js' --exclude '.*' --exclude './game-server/node_modules' --exclude './game-server/node_modules' --exclude './game-server/dist' --exclude 'node_modules' --exclude 'bower_components' --exclude 'dist' --progress --inplace --no-owner --no-group --rsh='ssh -p22' . ${destUrl} +rsync -av --include '.babelrc' --include '.eslintrc.js' --exclude '.*' --exclude 'logs' --exclude './game-server/node_modules' --exclude './game-server/node_modules' --exclude './game-server/dist' --exclude 'node_modules' --exclude 'bower_components' --exclude 'dist' --progress --inplace --no-owner --no-group --rsh='ssh -p22' . ${destUrl} git checkout ./game-server/config.json diff --git a/shared/domain/activityField/gachaField.ts b/shared/domain/activityField/gachaField.ts index d44f291d8..925801c75 100644 --- a/shared/domain/activityField/gachaField.ts +++ b/shared/domain/activityField/gachaField.ts @@ -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; diff --git a/shared/pubUtils/timeUtil.ts b/shared/pubUtils/timeUtil.ts index d6d04e2ea..fe970afef 100644 --- a/shared/pubUtils/timeUtil.ts +++ b/shared/pubUtils/timeUtil.ts @@ -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); } \ No newline at end of file