拍卖行:获取军团拍卖记录;修改分红机制

This commit is contained in:
liangtongchuan
2021-03-20 01:09:09 +08:00
parent 7df19fd510
commit a9d06173ac
7 changed files with 108 additions and 15 deletions
+9 -2
View File
@@ -13,7 +13,7 @@ import { getMailContent } from './mailService';
import { pinus } from 'pinus';
// ! 获取底价,假数据
function getBasePrice(gid: number, count: number) {
export function getBasePrice(gid: number, count: number) {
const good = getGoodById(gid);
return (good ? good.quality * 100 : 100) * count;
}
@@ -36,6 +36,10 @@ export function auctionBegin() {
return getNextTime(new Date(), AUCTION_TIME.GUILD_BEGIN_HOUR, AUCTION_TIME.GUILD_BEGIN_MIN);
}
export function guildAuctionEnd() {
return getNextTime(new Date(), AUCTION_TIME.GUILD_END_HOUR, AUCTION_TIME.GUILD_END_MIN);
}
export function auctionEnd() {
return getNextTime(new Date(), AUCTION_TIME.WORLD_END_HOUR, AUCTION_TIME.WORLD_END_MIN);
}
@@ -67,6 +71,7 @@ export function todayWorldEnd() {
*/
export async function genAuction(guildCode: string, sourceType: number, sourceCode: string, serverId: number, rewards: ItemReward[]) {
const begin = auctionBegin();
const guildEnd = guildAuctionEnd();
const end = auctionEnd();
const lotsData: LotParam[] = rewards.map(reward => {
const { id, count } = reward;
@@ -82,7 +87,7 @@ export async function genAuction(guildCode: string, sourceType: number, sourceCo
const dividendData: DividendParam = {
guildCode, sourceType, sourceCode, serverId, code: dividendCode, dividends: [], totalPrice: 0, begin, lots: lots.map(lot => {
const { code, gid } = lot;
return { code, gid, price: 0 }
return { code, gid, price: 0, time: guildEnd, max: false, count: lot.count }
}),
};
const dividend = await DividendModel.createDividend(dividendData);
@@ -172,6 +177,7 @@ export async function startWorldAuction() {
try {
console.log('schedule startWorldAuction called:', new Date());
const begin = todayGuildBegin();
await LotModel.setLotSoldByBegin(begin);
await LotModel.updateLotsStageByBegin(begin, AUCTION_STAGE.WORLD);
return true;
} catch (e) {
@@ -184,6 +190,7 @@ export async function stopAuction() {
try {
console.log('schedule stopAuction called:', new Date());
const begin = todayGuildBegin();
await LotModel.setLotSoldByBegin(begin);
await LotModel.updateLotsStageByBegin(begin, AUCTION_STAGE.END);
await DividendModel.updateDividendsStatus(begin, DIVIDEND_STATUS.END);
return true;