拍卖行:时间使用参数表

This commit is contained in:
luying
2021-09-22 16:46:15 +08:00
parent 7df7de4bed
commit fb8e88020c
5 changed files with 54 additions and 27 deletions

View File

@@ -31,7 +31,7 @@ export class AuctionHandler {
const { magicWord } = msg;
const guildCode = session.get('guildCode');
if (!guildCode) return resResult(STATUS.GUILD_NOT_FOUND);
// if (!guildCode) return resResult(STATUS.GUILD_NOT_FOUND);
let result = await getAuction(guildCode, session, magicWord);
return resResult(STATUS.SUCCESS, result);

View File

@@ -53,31 +53,38 @@ export async function officialAuctionLots(session: FrontendOrBackendSession, beg
}
export function auctionBegin() {
return <Date>getTimeFunD().getAfterDayWithHour(0, AUCTION_TIME.GUILD_BEGIN_HOUR, AUCTION_TIME.GUILD_BEGIN_MIN);
let { hour, minute } = gameData.auctionTime.get(AUCTION_TIME.GUILD_OPEN);
return <Date>getTimeFunD().getAfterDayWithHour(0, hour, minute);
}
export function guildAuctionEnd() {
return <Date>getTimeFunD().getAfterDayWithHour(0, AUCTION_TIME.GUILD_END_HOUR, AUCTION_TIME.GUILD_END_MIN);
let { hour, minute } = gameData.auctionTime.get(AUCTION_TIME.GUILD_CLOSE);
return <Date>getTimeFunD().getAfterDayWithHour(0, hour, minute);
}
export function auctionEnd() {
return <Date>getTimeFunD().getAfterDayWithHour(0, AUCTION_TIME.WORLD_END_HOUR, AUCTION_TIME.WORLD_END_MIN);
let { hour, minute } = gameData.auctionTime.get(AUCTION_TIME.WORLD_CLOSE);
return <Date>getTimeFunD().getAfterDayWithHour(0, hour, minute);
}
export function todayGuildBegin() {
return <Date>getTimeFunD(getZeroPointD()).getAfterDayWithHour(0, AUCTION_TIME.GUILD_BEGIN_HOUR, AUCTION_TIME.GUILD_BEGIN_MIN);
let { hour, minute } = gameData.auctionTime.get(AUCTION_TIME.GUILD_OPEN);
return <Date>getTimeFunD(getZeroPointD()).getAfterDayWithHour(0, hour, minute);
}
export function yestodayGuildBegin() {
return <Date>getTimeFunD(getZeroPointD()).getAfterDayWithHour(-1, AUCTION_TIME.GUILD_BEGIN_HOUR, AUCTION_TIME.GUILD_BEGIN_MIN);
let { hour, minute } = gameData.auctionTime.get(AUCTION_TIME.GUILD_OPEN);
return <Date>getTimeFunD(getZeroPointD()).getAfterDayWithHour(-1, hour, minute);
}
export function todayWorldBegin() {
return <Date>getTimeFunD(getZeroPointD()).getAfterDayWithHour(0, AUCTION_TIME.WORLD_BEGIN_HOUR, AUCTION_TIME.WORLD_BEGIN_MIN);
let { hour, minute } = gameData.auctionTime.get(AUCTION_TIME.WORLD_OPEN);
return <Date>getTimeFunD(getZeroPointD()).getAfterDayWithHour(0, hour, minute);
}
export function todayWorldEnd() {
return <Date>getTimeFunD(getZeroPointD()).getAfterDayWithHour(0, AUCTION_TIME.WORLD_END_HOUR, AUCTION_TIME.WORLD_END_MIN);
let { hour, minute } = gameData.auctionTime.get(AUCTION_TIME.WORLD_CLOSE);
return <Date>getTimeFunD(getZeroPointD()).getAfterDayWithHour(0, hour, minute);
}
/**
@@ -287,6 +294,9 @@ export async function getAuction(guildCode: string, session: FrontendOrBackendSe
const begin = todayGuildBegin();
let lots = magicWord === DEBUG_MAGIC_WORD ? await debugAuctionLots(session, begin) : await officialAuctionLots(session, begin);
const dividends = await DividendModel.findGuildDividendsByBegin(guildCode, begin);
let dividends: DividendType[] = [];
if(guildCode) {
dividends = await DividendModel.findGuildDividendsByBegin(guildCode, begin);
}
return { lots, dividends };
}

View File

@@ -4,11 +4,11 @@ import { PVPConfigModel } from '../db/SystemConfig';
import PvpDefenseType, { PvpDefenseModel } from '../db/PvpDefense';
import { PVP } from '../pubUtils/dicParam';
import { nowSeconds, getTimeFun } from '../pubUtils/timeUtil';
import { getPvpGkWarIds, getPvpRankRewards, getPvpHeroRewards, getResultMaxRank, getTodayGuildActivity } from '../pubUtils/data';
import { getPvpGkWarIds, getPvpRankRewards, getPvpHeroRewards, getResultMaxRank, getTodayGuildActivity, gameData } from '../pubUtils/data';
import { deepCopy, getRandSingleEelm } from '../pubUtils/util';
import { getLvByScore } from './pvpService';
import { getAllOnlineRoles, getAllServers, initSingleRank, delGuildActivityRank } from './redisService';
import { MAIL_TYPE, REDIS_KEY, GUILD_ACTIVITY_STATUS, GUILD_ACTIVITY_TYPE, TASK_TYPE, TIME_OUTPUT_TYPE, REFRESH_TIME, SEND_NAME, SERVER_OPEN_TIME, COUNTER } from '../consts';
import { MAIL_TYPE, REDIS_KEY, GUILD_ACTIVITY_STATUS, GUILD_ACTIVITY_TYPE, TASK_TYPE, TIME_OUTPUT_TYPE, REFRESH_TIME, SEND_NAME, SERVER_OPEN_TIME, COUNTER, AUCTION_TIME } from '../consts';
import { RoleModel } from '../db/Role';
import { pinus } from 'pinus';
import { indexOf } from 'underscore';
@@ -518,8 +518,12 @@ export async function raceActivitySeconds() {
}
function auctionSchedule() {
scheduleJob('startGuildAuction', '0 0 20 20 * ?', startGuildAuction);
scheduleJob('startWorldAuction', '0 0 20 30 * ?', startWorldAuction);
scheduleJob('stopAuction', '0 0 22 00 * ?', stopAuction);
let guildOpen = gameData.auctionTime.get(AUCTION_TIME.GUILD_OPEN);
let worldOpen = gameData.auctionTime.get(AUCTION_TIME.WORLD_OPEN);
let worldClose = gameData.auctionTime.get(AUCTION_TIME.WORLD_CLOSE);
scheduleJob('startGuildAuction', `0 0 ${guildOpen.hour} ${guildOpen.minute} * ?`, startGuildAuction);
scheduleJob('startWorldAuction', `0 0 ${worldOpen.hour} ${worldOpen.minute} * ?`, startWorldAuction);
scheduleJob('stopAuction', `0 0 ${worldClose.hour} ${worldClose.minute} * ?`, stopAuction);
scheduleJob('sendUngotDividendJob', '0 0 5 00 * ?', sendUngotDividendJob);
}

View File

@@ -16,17 +16,14 @@ export const AUCTION_SOURCE = {
export const LOT_CODE_LEN = 8;
export const DIVIDEND_CODE_LEN = 8;
// 世界拍卖开始时间需晚于军团拍卖结束时间
export const AUCTION_TIME = {
GUILD_BEGIN_HOUR: 20, // 军团拍卖开
GUILD_BEGIN_MIN: 20, // 军团拍卖开始
WORLD_BEGIN_HOUR: 20, // 世界拍卖开始
WORLD_BEGIN_MIN: 30, // 世界拍卖开
GUILD_END_HOUR: 20, // 军团拍卖结束
GUILD_END_MIN: 30, // 军团拍卖结束
WORLD_END_HOUR: 22, // 世界拍卖结束
WORLD_END_MIN: 0, // 世界拍卖结束
};
export enum AUCTION_TIME {
GUILD_PREVIEW = 1, // 军团拍卖预览时间(非开启时间)
GUILD_OPEN = 2, // 军团拍卖开启时间
GUILD_CLOSE = 3, // 军团拍卖关闭时间
WORLD_PREVIEW = 4, // 世界拍卖预览时间(非开启时间)
WORLD_OPEN = 5, // 世界拍卖开启时间
WORLD_CLOSE = 6, // 世界拍卖结束时间
}
export const DIVIDEND_STATUS = {
DEFAULT: 0, // 0未开始

View File

@@ -18,7 +18,7 @@ import { dicTowerTask, loadTowerTask } from "./dictionary/DicTowerTask";
import { dicWar, dicWarPvp, dicDailyWarByType, loadWar } from "./dictionary/DicWar";
import { dicWarJson, loadWarJson } from "./dictionary/DicWarJson";
import { dicXunbao, loadXunbao } from "./dictionary/DicXunbao";
import { SPECIAL_ATTR } from "../consts";
import { AUCTION_TIME, SPECIAL_ATTR } from "../consts";
import { dicFashions, loadFashions } from "./dictionary/DicFashions";
import { friendShips, friendShipHidAandIds, loadFriendShip } from "./dictionary/DicFriendShip";
import { maxFriendShipLv, dicFriendShipLevelMap, loadFriendShipLevel } from "./dictionary/DicFriendShipLevel";
@@ -235,7 +235,8 @@ export const gameData = {
ceRatio: new Array<{type: number, val: number}>(),
holiday: dicHoliday,
expeditionSubAttr: dicExpeditionSubAttr,
auctionPool: dicAuctionPool
auctionPool: dicAuctionPool,
auctionTime: new Map<number, { hour: number, minute: number, seconds: number}>()
};
// 在此提供一些原先在gamedata中提供的方法以便更方便获取gameData数据
@@ -799,6 +800,20 @@ function loadEquipAttributeRatio() {
}
}
function loadAuctionTime() {
gameData.auctionTime.set(AUCTION_TIME.GUILD_PREVIEW, splitTime(param.AUCTION.GUILD_AUCTION_PREVIEW_TIME));
gameData.auctionTime.set(AUCTION_TIME.GUILD_OPEN, splitTime(param.AUCTION.GUILD_AUCTION_OPEN_TIME));
gameData.auctionTime.set(AUCTION_TIME.GUILD_CLOSE, splitTime(param.AUCTION.GUILD_AUCTION_CLOSE_TIME));
gameData.auctionTime.set(AUCTION_TIME.WORLD_PREVIEW, splitTime(param.AUCTION.WORLD_AUCTION_PREVIEW_TIME));
gameData.auctionTime.set(AUCTION_TIME.WORLD_OPEN, splitTime(param.AUCTION.WORLD_AUCTION_OPEN_TIME));
gameData.auctionTime.set(AUCTION_TIME.WORLD_CLOSE, splitTime(param.AUCTION.WORLD_AUCTION_CLOSE_TIME));
}
function splitTime(str: string) {
let arr = str.split(':');
return { hour: parseInt(arr[0]), minute: parseInt(arr[1]), seconds: parseInt(arr[2]) }
}
// 初始加载
function initDatas() {
parseDicParam();
@@ -815,6 +830,7 @@ function parseDicParam() {
getHeroTransPiece();
parseComBtlLvRange();
getCeRatio();
loadAuctionTime();
}
// 加载json