From 5290b257b8292670f471070759e5d470e5255813 Mon Sep 17 00:00:00 2001 From: liangtongchuan Date: Wed, 24 Mar 2021 16:53:12 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8B=8D=E5=8D=96=E8=A1=8C=EF=BC=9A=E5=B7=B2?= =?UTF-8?q?=E6=8B=8D=E5=87=BA=E7=9A=84=E6=8B=8D=E5=93=81=E4=B8=8D=E8=BF=9B?= =?UTF-8?q?=E5=85=A5=E4=B8=96=E7=95=8C=E6=8B=8D=E5=8D=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- game-server/app/services/auctionService.ts | 2 +- shared/db/Lot.ts | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/game-server/app/services/auctionService.ts b/game-server/app/services/auctionService.ts index eea7a2caa..960d3c4cf 100644 --- a/game-server/app/services/auctionService.ts +++ b/game-server/app/services/auctionService.ts @@ -180,7 +180,7 @@ export async function startWorldAuction() { console.log('schedule startWorldAuction called:', new Date()); const begin = todayGuildBegin(); await LotModel.setLotSoldByBegin(begin); - await LotModel.updateLotsStageByBegin(begin, AUCTION_STAGE.WORLD); + await LotModel.updateUnSoldLotsStageByBegin(begin, AUCTION_STAGE.WORLD); await DividendModel.updateDividendsStatus(begin, DIVIDEND_STATUS.END); return true; } catch (e) { diff --git a/shared/db/Lot.ts b/shared/db/Lot.ts index c12bbcc6c..9b0c24dee 100644 --- a/shared/db/Lot.ts +++ b/shared/db/Lot.ts @@ -123,6 +123,11 @@ export default class Lot extends BaseModel { return results; } + public static async updateUnSoldLotsStageByBegin(begin: Date, auctionStage: number) { + const results = await LotModel.updateMany({ begin, status: { $in: [LOT_STATUS.DEFAULT, LOT_STATUS.ING] } }, { auctionStage }).select('-_id -__v').lean(); + return results; + } + public static async setLotSoldByBegin(begin: Date) { const results = await LotModel.updateMany({ begin, status: LOT_STATUS.ING }, { status: LOT_STATUS.SOLD }).select('-_id -__v').lean(); return results;