军团:修复bug

This commit is contained in:
luying
2021-10-23 18:37:25 +08:00
parent 18d81a6165
commit 254648610f
2 changed files with 15 additions and 4 deletions

View File

@@ -27,7 +27,7 @@ export function getMaxPrice(gid: number, count: number) {
}
export async function auctionStage() {
const curTime = new Date().getTime();
const curTime = await getCurrentTimeWithSetDay();
if (curTime < (await todayGuildBegin()).getTime()) return AUCTION_STAGE.DEFAULT;
if (curTime < (await todayWorldBegin()).getTime() && curTime > (await todayGuildBegin()).getTime()) return AUCTION_STAGE.GUILD;
if (curTime > (await todayWorldBegin()).getTime() && curTime < (await todayWorldEnd()).getTime()) return AUCTION_STAGE.WORLD;
@@ -91,6 +91,17 @@ async function getCurrentTime() {
return now
}
async function getCurrentTimeWithSetDay() {
let now = new Date();
if(dicParam.SERVER_DEBUG_MODE.CURRENT_TIME == 1) {
let guilds = pinus.app.getServersByType('guild');
let guild = getRandSingleEelm(guilds);
let currentTime = await pinus.app.rpc.guild.guildActivityRemote.getCurrentTime.toServer(guild.id);
now.setDate(new Date(currentTime).getDate());
}
return now.getTime();
}
// 明天军团拍卖行开始时间 20:20
export async function tomorrowGuildBegin() {
let now = await getCurrentTime();
@@ -137,7 +148,7 @@ export async function guildAuctionPreview() {
// 演武台。8点以前是今天的8点以后是明天的
export async function getBossAuctionBegin() {
if(Date.now() < (await guildAuctionPreview()).getTime()) {
if((await getCurrentTimeWithSetDay()) < (await guildAuctionPreview()).getTime()) {
return await todayGuildBegin();
} else {
return await tomorrowGuildBegin();
@@ -146,7 +157,7 @@ export async function getBossAuctionBegin() {
// 演武台。8点以前是今天的8点以后是明天的
export async function getBossAuctionEnd() {
if(Date.now() < (await guildAuctionPreview()).getTime()) {
if((await getCurrentTimeWithSetDay()) < (await guildAuctionPreview()).getTime()) {
return await guildAuctionEnd();
} else {
return await tomorrowGuildEnd();

View File

@@ -59,7 +59,7 @@ export async function sendMailByContent(contentId: MAIL_TYPE, hisRoleId: string,
}
export async function sendMailToGuildByContent(contentId: MAIL_TYPE, guildCode: string, params: { sendName?: string, endTime?: number, params?: string[], goods?: RewardInter[], notPush?: boolean }, guild?: GuildType) {
if(!guild) guild = await GuildModel.findByCode(guildCode);
if(!guild) guild = await GuildModel.findByCode(guildCode, null, '+members');
if(!guild) return false;
let f = new SendMailFun();
f.setWithContentId(contentId, params);