拍卖:优化

This commit is contained in:
luying
2021-10-27 16:40:24 +08:00
parent b03802136b
commit 0dde8fd09a
9 changed files with 146 additions and 68 deletions
@@ -247,7 +247,6 @@ export class ChatRemote {
public async pushCurrentTime(serverId: number, time: number) {
let roomId = groupRoomId(CHANNEL_PREFIX.WORLD, serverId);
let channel = this.channelService.getChannel(roomId, false);
console.log('*********', roomId, channel);
if (!channel) return { result: false, serverId };
channel.pushMessage('onPushCurrentTime', resResult(STATUS.SUCCESS, { time }));
@@ -21,6 +21,7 @@ import { ActivityGroupTypeModel } from '../../../db/ActivityGroupType';
import { GuildActivityCityModel } from '../../../db/GuildActivityCity';
import { GuildActivityRecordModel } from '../../../db/GuildActivityRec';
import { getTimeFunM } from '../../../pubUtils/timeUtil';
import { sendUngotDividend } from '../../../services/auctionService';
let timer: NodeJS.Timer;
export default function (app: Application) {
return new GmHandler(app);
@@ -385,6 +386,7 @@ export class GmHandler {
let time = <number>getTimeFunM().getAfterDayWithHour(0);
pinus.app.rpc.guild.guildActivityRemote.setCurrentTime.broadcast(time);
await pushCurrentTime(time);
await sendUngotDividend();
}, startActivity * 1000 + endActivity * 1000 + startGuildAuction * 1000 + endGuildAuction * 1000 + startWorldAuction * 1000 + endWorldAuction * 1000 + startNextDay * 1000)
return resResult(STATUS.SUCCESS, {
startActivity: startTimes[0],
@@ -4,7 +4,7 @@ import { AUCTION_STAGE, DEBUG_MAGIC_WORD, STATUS, CURRENCY_BY_TYPE, CURRENCY_TYP
import { LotModel } from "../../../db/Lot";
import { ItemReward } from "../../../domain/dbGeneral";
import { resResult } from "../../../pubUtils/util";
import { auctionStage, calculateDividend, genAuction, sendUngotDividend, startGuildAuction, startWorldAuction, stopAuction, todayGuildBegin, getBasePrice, debugAuctionLots, officialAuctionLots, auctionBidStatus, getMaxPrice, guildBidStatus, getAuction, pushAuctionOver } from "../../../services/auctionService";
import { auctionStage, calculateDividend, genAuction, sendUngotDividend, startGuildAuction, startWorldAuction, stopAuction, todayGuildBegin, getBasePrice, debugAuctionLots, officialAuctionLots, auctionBidStatus, getMaxPrice, guildBidStatus, getAuction, pushAuctionOver, treatSingleLotTime, treatLotsTime } from "../../../services/auctionService";
import { addItems, handleCost } from '../../../services/rewardService';
import { getSimpleRoleInfo } from '../../../services/roleService';
import { getRoleOnlineInfo } from '../../../services/redisService';
@@ -125,7 +125,8 @@ export class AuctionHandler {
const dividend = await DividendModel.updateLot(code, gid, newPrice, incPrice, max);
newDividend = await calculateDividend(dividend);
}
return resResult(STATUS.SUCCESS, { lot: newLot, dividend: newDividend });
let newLotResult = await treatSingleLotTime(newLot);
return resResult(STATUS.SUCCESS, { lot: newLotResult, dividend: newDividend });
} catch (e) {
console.log('offer got err:', e);
res.releaseCallback();
@@ -178,7 +179,8 @@ export class AuctionHandler {
const begin = await todayGuildBegin();
const lots = await LotModel.watchingLotsByBegin(serverId, roleId, begin);
const stage = await auctionStage();
return resResult(STATUS.SUCCESS, { lots: stage === AUCTION_STAGE.END ? [] : lots });
let newLots = await treatLotsTime(lots);
return resResult(STATUS.SUCCESS, { lots: stage === AUCTION_STAGE.END ? [] : newLots });
}
async offerRecs(msg: { count: number }, session: BackendSession) {