拍卖行:拍品起止时间

This commit is contained in:
liangtongchuan
2021-03-17 15:43:53 +08:00
parent 0dc4f18d2d
commit a76c0fa7fe
4 changed files with 66 additions and 7 deletions
+6 -5
View File
@@ -1,7 +1,8 @@
import { LOT_CODE_LEN, AUCTION_STAGE, AUCTION_SOURCE } from './../consts';
import { LOT_CODE_LEN, AUCTION_STAGE, AUCTION_SOURCE, AUCTION_TIME } from './../consts';
import { ItemReward } from "../domain/dbGeneral";
import { genCode } from '../pubUtils/util';
import { LotModel, LotParam } from '../db/Lot';
import { getNextTime } from '../pubUtils/timeUtil';
/**
* @description 生成拍卖数据
@@ -13,21 +14,21 @@ import { LotModel, LotParam } from '../db/Lot';
* @param {ItemReward[]} rewards
*/
export async function genAuction(guildCode: string, sourceType: number, sourceCode: string, serverId: number, rewards: ItemReward[]) {
const curTime = new Date();
const begin = getNextTime(new Date(), AUCTION_TIME.GUILD_BEGIN_HOUR, AUCTION_TIME.GUILD_BEGIN_MIN);
const end = getNextTime(new Date(), AUCTION_TIME.WORLD_END_HOUR, AUCTION_TIME.WORLD_END_MIN);
const lots: LotParam[] = rewards.map(reward => {
const { id, count } = reward;
const code = genCode(LOT_CODE_LEN);
return {
auctionStage: AUCTION_STAGE.DEFAULT, sourceType,
sourceCode, serverId, guildCode, code, gid: id, count,
maxPrice: 100, begin: curTime, end: curTime, curPrice: 10, // ! 此行为临时数据
sourceCode, serverId, guildCode, code, gid: id, count, begin, end,
maxPrice: 100, curPrice: 10, // ! 此行为临时数据
}
});
const result = await LotModel.createRecs(lots);
return result;
}
/**
* @description 获取活动参加者
* @export