From 07bc1fb75c43c84e5d81fd250ca1603e92a2c8b3 Mon Sep 17 00:00:00 2001 From: liangtongchuan Date: Wed, 24 Mar 2021 14:34:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8B=8D=E5=8D=96=E8=A1=8C=EF=BC=9A=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E7=AB=9E=E6=8B=8D=E8=AE=B0=E5=BD=95=E4=B8=AD=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E7=9A=84=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- game-server/app/servers/battle/handler/auctionHandler.ts | 7 +++---- game-server/app/services/auctionService.ts | 7 ++++++- 2 files changed, 9 insertions(+), 5 deletions(-) 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());