拍卖行:调整接口以便测试

This commit is contained in:
liangtongchuan
2021-03-23 10:43:12 +08:00
parent ecb4b87abc
commit 6eb1a1976f
2 changed files with 44 additions and 14 deletions
+20 -1
View File
@@ -9,7 +9,7 @@ import { gameData, getGoodById } from '../pubUtils/data';
import { DividendParam, DividendType } from '../db/Dividend';
import { pushMail } from '../pubUtils/interface';
import { getMailContent } from './mailService';
import { pinus } from 'pinus';
import { pinus, BackendSession } from 'pinus';
import { participants } from './guildActivityService';
import { Member } from '../domain/battleField/guildActivity';
@@ -33,6 +33,25 @@ export function auctionStage() {
if (curTime > todayWorldEnd().getTime()) return AUCTION_STAGE.END;
}
export async function debugAuctionLots(session: BackendSession, begin: Date) {
const serverId = session.get('serverId');
const lots = await LotModel.findWorldLotsByBegin(serverId, begin);
return lots;
}
export async function officialAuctionLots(session: BackendSession, begin: Date) {
const serverId = session.get('serverId');
const guildCode = session.get('guildCode');
const stage = auctionStage();
let lots = [];
if (stage === AUCTION_STAGE.DEFAULT || stage === AUCTION_STAGE.GUILD) {
lots = await LotModel.findGuildLotsByBegin(guildCode, begin);
} else if (stage === AUCTION_STAGE.WORLD) {
lots = await LotModel.findWorldLotsByBegin(serverId, begin);
}
return lots;
}
export function auctionBegin() {
return getNextTime(new Date(), AUCTION_TIME.GUILD_BEGIN_HOUR, AUCTION_TIME.GUILD_BEGIN_MIN);
}