拍卖行:分红时间问题修改

This commit is contained in:
luying
2022-06-04 20:04:22 +08:00
parent 29b2bef6db
commit 117838f53d
4 changed files with 36 additions and 45 deletions

View File

@@ -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 { genCode, resResult } from "../../../pubUtils/util";
import { auctionStage, calculateDividend, genAuction, sendUngotDividend, startGuildAuction, startWorldAuction, stopAuction, todayGuildBegin, getBasePrice, debugAuctionLots, officialAuctionLots, auctionBidStatus, getMaxPrice, guildBidStatus, getAuction, pushAuctionOver, treatSingleLotTime, treatLotsTime, pushAuctionUpdate, checkAuctionStage, processDividendFormat, processSingleDividendFormat } from "../../../services/auctionService";
import { auctionStage, calculateDividend, genAuction, sendUngotDividend, startGuildAuction, startWorldAuction, stopAuction, todayGuildBegin, getBasePrice, debugAuctionLots, officialAuctionLots, auctionBidStatus, getMaxPrice, guildBidStatus, getAuction, pushAuctionOver, pushAuctionUpdate, checkAuctionStage, processDividendFormat, processSingleDividendFormat, tomorrowGuildBegin, processLotsFormat, processSingleLotFormat } from "../../../services/auctionService";
import { addItems, getGoldObject, handleCost } from '../../../services/role/rewardService';
import { getSimpleRoleInfo } from '../../../services/roleService';
import { getRoleOnlineInfo } from '../../../services/redisService';
@@ -17,8 +17,6 @@ import { UserGuildModel } from '../../../db/UserGuild';
import { UserGuildApplyModel } from '../../../db/UserGuildApply';
import * as dicParam from '../../../pubUtils/dicParam';
import { gameData, getAuctionRewardByPoolId } from '../../../pubUtils/data';
import { addRoleToGuildAuctionChannel, addRoleToWorldAuctionChannel, channelServer, groupRoomId, leaveGuildAuctionChannel } from '../../../services/chatService';
import { RewardInter } from '../../../pubUtils/interface';
import { sendMailByContent } from '../../../services/mailService';
import { reportTAEvent } from '../../../services/sdkService';
import { sendMessageToGuildWithSuc, sendMessageToServerWithSuc } from '../../../services/pushService';
@@ -124,7 +122,7 @@ export class AuctionHandler {
const dividend = await DividendModel.updateLot(code, gid, curPrice, incPrice, max);
newDividend = await calculateDividend(dividend);
}
let newLotResult = await treatSingleLotTime(newLot);
let newLotResult = processSingleLotFormat(newLot);
await sendMessageToGuildWithSuc(guildCode, PUSH_ROUTE.DIVIDEND_UPDATE, { dividends: processDividendFormat([newDividend]) })
return resResult(STATUS.SUCCESS, { lot: newLotResult, dividend: processSingleDividendFormat(newDividend) });
} catch (e) {
@@ -139,7 +137,7 @@ export class AuctionHandler {
const { code } = msg;
const lot = await LotModel.watchLot(code, roleId);
if (!lot) return resResult(STATUS.WRONG_PARMS);
return resResult(STATUS.SUCCESS, { lot });
return resResult(STATUS.SUCCESS, { lot: processSingleLotFormat(lot) });
}
async unWatchLot(msg: { code: string }, session: BackendSession) {
@@ -147,19 +145,20 @@ export class AuctionHandler {
const { code } = msg;
const lot = await LotModel.unWatchLot(code, roleId);
if (!lot) return resResult(STATUS.WRONG_PARMS);
return resResult(STATUS.SUCCESS, { lot });
return resResult(STATUS.SUCCESS, { lot: processSingleLotFormat(lot) });
}
async checkDividend(msg: {}, session: BackendSession) {
const begin = await todayGuildBegin();
const tomorrowBegin = await tomorrowGuildBegin();
const guildCode = session.get('guildCode');
if(guildCode) {
const dividends = await DividendModel.findGuildDividendsByBegin(guildCode, begin);
const dividends = await DividendModel.findGuildDividendsByBegin(guildCode, [begin, tomorrowBegin]);
return resResult(STATUS.SUCCESS, { dividends: processDividendFormat(dividends) });
} else {
let roleId = session.get('roleId');
const dividends = await DividendModel.findDividendByRoleAndBegin(roleId, begin);
const dividends = await DividendModel.findDividendByRoleAndBegin(roleId, [begin, tomorrowBegin]);
return resResult(STATUS.SUCCESS, { dividends: processDividendFormat(dividends) });
}
}
@@ -186,7 +185,7 @@ export class AuctionHandler {
const begin = await todayGuildBegin();
const lots = await LotModel.watchingLotsByBegin(serverId, roleId, begin);
const stage = await auctionStage();
let newLots = await treatLotsTime(lots);
let newLots = await processLotsFormat(lots);
return resResult(STATUS.SUCCESS, { lots: stage === AUCTION_STAGE.END ? [] : newLots });
}