拍卖行:个人可以竞价后出一口价,修改军团拍卖记录的状态
This commit is contained in:
@@ -1,10 +1,10 @@
|
|||||||
import { DividendModel } from './../../../db/Dividend';
|
import { DividendModel } from './../../../db/Dividend';
|
||||||
import { Application, BackendSession, ChannelService } from "pinus";
|
import { Application, BackendSession, ChannelService } from "pinus";
|
||||||
import { AUCTION_STAGE, DEBUG_MAGIC_WORD, STATUS, OFFER_RATIO, CURRENCY_BY_TYPE, CURRENCY_TYPE, DATA_NAME, LOT_STATUS } from "../../../consts";
|
import { AUCTION_STAGE, DEBUG_MAGIC_WORD, STATUS, OFFER_RATIO, CURRENCY_BY_TYPE, CURRENCY_TYPE, DATA_NAME, LOT_STATUS, DIVIDEND_STATUS } from "../../../consts";
|
||||||
import { LotModel } from "../../../db/Lot";
|
import { LotModel } from "../../../db/Lot";
|
||||||
import { ItemReward, LotRec } from "../../../domain/dbGeneral";
|
import { ItemReward, LotRec } from "../../../domain/dbGeneral";
|
||||||
import { resResult } from "../../../pubUtils/util";
|
import { resResult } from "../../../pubUtils/util";
|
||||||
import { auctionStage, calculateDividend, genAuction, sendUngotDividend, startGuildAuction, startWorldAuction, stopAuction, todayGuildBegin, getBasePrice, debugAuctionLots, officialAuctionLots, auctionBidStatus } from "../../../services/auctionService";
|
import { auctionStage, calculateDividend, genAuction, sendUngotDividend, startGuildAuction, startWorldAuction, stopAuction, todayGuildBegin, getBasePrice, debugAuctionLots, officialAuctionLots, auctionBidStatus, getMaxPrice, guildBidStatus } from "../../../services/auctionService";
|
||||||
import { addItems, handleCost } from '../../../services/rewardService';
|
import { addItems, handleCost } from '../../../services/rewardService';
|
||||||
import { getSimpleRoleInfo } from '../../../services/roleService';
|
import { getSimpleRoleInfo } from '../../../services/roleService';
|
||||||
import { getRoleOnlineInfo } from '../../../services/redisService';
|
import { getRoleOnlineInfo } from '../../../services/redisService';
|
||||||
@@ -58,7 +58,7 @@ export class AuctionHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const { curBuyer, curPrice, maxPrice, gid, count, bidRoles, watchingRoles } = lot;
|
const { curBuyer, curPrice, maxPrice, gid, count, bidRoles, watchingRoles } = lot;
|
||||||
if (curBuyer === roleId) {
|
if (curBuyer === roleId && !max) {
|
||||||
res.releaseCallback();
|
res.releaseCallback();
|
||||||
return resResult(STATUS.LOT_OFFER_SERIAL);
|
return resResult(STATUS.LOT_OFFER_SERIAL);
|
||||||
}
|
}
|
||||||
@@ -165,16 +165,17 @@ export class AuctionHandler {
|
|||||||
async guildLotRecs(msg: { count: number }, session: BackendSession) {
|
async guildLotRecs(msg: { count: number }, session: BackendSession) {
|
||||||
const guildCode = session.get('guildCode');
|
const guildCode = session.get('guildCode');
|
||||||
const dividends = await DividendModel.findDividendsByGuild(guildCode, msg.count);
|
const dividends = await DividendModel.findDividendsByGuild(guildCode, msg.count);
|
||||||
let lotsData: LotRec[] = [];
|
let lotsData = [];
|
||||||
dividends.forEach(dividend => {
|
dividends.forEach(dividend => {
|
||||||
const lots = dividend.lots.map(lot => {
|
const lots = dividend.lots.map(lot => {
|
||||||
return { ...lot, sourceType: dividend.sourceType };
|
return { ...lot, sourceType: dividend.sourceType, dividendStatus: dividend.status };
|
||||||
})
|
})
|
||||||
lotsData = [...lotsData, ...lots];
|
lotsData = [...lotsData, ...lots];
|
||||||
});
|
});
|
||||||
const lotRecs = lotsData.map(lot => {
|
const lotRecs = lotsData.map(lot => {
|
||||||
const price = lot.price === 0 ? getBasePrice(lot.gid, lot.count) : lot.price;
|
const { gid, count, price: lotPrice } = lot;
|
||||||
const sold = lot.price !== 0;
|
const price = lotPrice === 0 ? getBasePrice(gid, count) : lotPrice;
|
||||||
|
const sold = guildBidStatus(lot);
|
||||||
return { ...lot, price, sold };
|
return { ...lot, price, sold };
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ export function getBasePrice(gid: number, count: number) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ! 获取一口价,假数据
|
// ! 获取一口价,假数据
|
||||||
function getMaxPrice(gid: number, count: number) {
|
export function getMaxPrice(gid: number, count: number) {
|
||||||
const good = getGoodById(gid);
|
const good = getGoodById(gid);
|
||||||
return (good ? good.quality * 200 : 200) * count;
|
return (good ? good.quality * 200 : 200) * count;
|
||||||
}
|
}
|
||||||
@@ -238,10 +238,15 @@ export async function sendUngotDividendJob() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function auctionBidStatus(roleId: string, lot: LotParam) {
|
export function auctionBidStatus(roleId: string, lot: LotParam) {
|
||||||
const { curBuyer, gid, status } = lot;
|
const { curBuyer, status } = lot;
|
||||||
return curBuyer !== roleId ? AUCTION_BID_STATUS.RETURN : status === LOT_STATUS.SOLD || status === LOT_STATUS.MAX ? AUCTION_BID_STATUS.SUC : AUCTION_BID_STATUS.LEAD;
|
return curBuyer !== roleId ? AUCTION_BID_STATUS.RETURN : status === LOT_STATUS.SOLD || status === LOT_STATUS.MAX ? AUCTION_BID_STATUS.SUC : AUCTION_BID_STATUS.LEAD;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function guildBidStatus(lot: { max: boolean, gid: number, count: number, price: number, dividendStatus: number }) {
|
||||||
|
const { max, gid, count, price: lotPrice, dividendStatus } = lot;
|
||||||
|
return max || lotPrice === getMaxPrice(gid, count) || ((dividendStatus == DIVIDEND_STATUS.END || dividendStatus == DIVIDEND_STATUS.SENT) && lotPrice !== 0)
|
||||||
|
}
|
||||||
|
|
||||||
export async function sendUngotDividend(debug = false) {
|
export async function sendUngotDividend(debug = false) {
|
||||||
try {
|
try {
|
||||||
console.log('schedule sendUngotDividend called:', new Date());
|
console.log('schedule sendUngotDividend called:', new Date());
|
||||||
|
|||||||
@@ -260,7 +260,7 @@ export class LotRec {
|
|||||||
@prop({ required: true, default: null })
|
@prop({ required: true, default: null })
|
||||||
time: Date; // 出价时间
|
time: Date; // 出价时间
|
||||||
@prop({ required: true, default: 0 })
|
@prop({ required: true, default: 0 })
|
||||||
max: boolean; // 出价时间
|
max: boolean; // 一口价
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user