diff --git a/game-server/app/servers/battle/handler/auctionHandler.ts b/game-server/app/servers/battle/handler/auctionHandler.ts index f62e79bee..567126634 100644 --- a/game-server/app/servers/battle/handler/auctionHandler.ts +++ b/game-server/app/servers/battle/handler/auctionHandler.ts @@ -1,11 +1,10 @@ -import { AUCTION_BID_STATUS } from './../../../consts/constModules/auctionConst'; import { DividendModel } from './../../../db/Dividend'; 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 { LotModel } from "../../../db/Lot"; import { ItemReward, LotRec } from "../../../domain/dbGeneral"; import { resResult } from "../../../pubUtils/util"; -import { auctionStage, calculateDividend, genAuction, sendUngotDividend, startGuildAuction, startWorldAuction, stopAuction, todayGuildBegin, getBasePrice, debugAuctionLots, officialAuctionLots } from "../../../services/auctionService"; +import { auctionStage, calculateDividend, genAuction, sendUngotDividend, startGuildAuction, startWorldAuction, stopAuction, todayGuildBegin, getBasePrice, debugAuctionLots, officialAuctionLots, auctionBidStatus } from "../../../services/auctionService"; import { addItems, handleCost } from '../../../services/rewardService'; import { getSimpleRoleInfo } from '../../../services/roleService'; import { getRoleOnlineInfo } from '../../../services/redisService'; @@ -157,8 +156,8 @@ export class AuctionHandler { const lotsData = await LotModel.recentBidLots(serverId, roleId, msg.count); const bidRecs = lotsData.map(lot => { const bidRec = lot.bidRoles.find(role => { return role.roleId === roleId }); - const { curBuyer, gid } = lot; - return { ...bidRec, gid, status: curBuyer === roleId ? AUCTION_BID_STATUS.SUC : AUCTION_BID_STATUS.RETURN }; + const { gid } = lot; + return { ...bidRec, gid, status: auctionBidStatus(roleId, lot) }; }); return resResult(STATUS.SUCCESS, { bidRecs }); } diff --git a/game-server/app/services/auctionService.ts b/game-server/app/services/auctionService.ts index cb3097399..eea7a2caa 100644 --- a/game-server/app/services/auctionService.ts +++ b/game-server/app/services/auctionService.ts @@ -1,6 +1,6 @@ import { MailModel, MailType } from './../db/Mail'; import { DividendModel } from './../db/Dividend'; -import { LOT_CODE_LEN, AUCTION_STAGE, AUCTION_TIME, DIVIDEND_CODE_LEN, DIVIDEND_STATUS, LOT_STATUS, MAIL_TYPE, CURRENCY_BY_TYPE, CURRENCY_TYPE, STATUS, DIVIDENDWEEKENDRATE, DIVIDENDMAXRATIO, DIVIDENDPOSITIONMAXRATIO, ROLE_RECEIVE_STATUS } from './../consts'; +import { LOT_CODE_LEN, AUCTION_STAGE, AUCTION_TIME, DIVIDEND_CODE_LEN, DIVIDEND_STATUS, LOT_STATUS, MAIL_TYPE, CURRENCY_BY_TYPE, CURRENCY_TYPE, STATUS, DIVIDENDWEEKENDRATE, DIVIDENDMAXRATIO, DIVIDENDPOSITIONMAXRATIO, ROLE_RECEIVE_STATUS, AUCTION_BID_STATUS } from './../consts'; import { DividendRec, ItemReward } from "../domain/dbGeneral"; import { genCode, resResult } from '../pubUtils/util'; import { LotModel, LotParam } from '../db/Lot'; @@ -237,6 +237,11 @@ export async function sendUngotDividendJob() { } } +export function auctionBidStatus(roleId: string, lot: LotParam) { + const { curBuyer, gid, 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; +} + export async function sendUngotDividend(debug = false) { try { console.log('schedule sendUngotDividend called:', new Date());