拍卖行:修改拍卖阶段判断,实现查看分红接口

This commit is contained in:
liangtongchuan
2021-03-18 14:17:00 +08:00
parent 9a463afd0d
commit 73d2523870
2 changed files with 27 additions and 12 deletions
@@ -4,7 +4,7 @@ import { AUCTION_STAGE, DEBUG_MAGIC_WORD, STATUS, OFFER_RATIO, CURRENCY_BY_TYPE,
import { LotModel } from "../../../db/Lot";
import { ItemReward } from "../../../domain/dbGeneral";
import { resResult } from "../../../pubUtils/util";
import { auctionBegin, auctionStage, genAuction } from "../../../services/auctionService";
import { auctionBegin, auctionStage, calculateDividend, genAuction, todayGuildBegin } from "../../../services/auctionService";
import { addItems, handleCost } from '../../../services/rewardService';
import { getSimpleRoleInfo } from '../../../services/roleService';
import { getRoleOnlineInfo } from '../../../services/redisService';
@@ -23,7 +23,7 @@ export class AuctionHandler {
const guildCode = session.get('guildCode');
const serverId = session.get('serverId');
if (!guildCode) return resResult(STATUS.GUILD_NOT_FOUND);
const begin = auctionBegin();
const begin = todayGuildBegin();
const stage = auctionStage();
let lots = [];
if (stage === AUCTION_STAGE.DEFAULT || stage === AUCTION_STAGE.GUILD) {
@@ -65,7 +65,9 @@ export class AuctionHandler {
const incPrice = newPrice - (curBuyer ? curPrice : 0);
const dividend = await DividendModel.updateLot(code, gid, newPrice, incPrice);
return resResult(STATUS.SUCCESS, { lot: newLot, dividend });
const newDividend = await calculateDividend(dividend);
// TODO 加关注
return resResult(STATUS.SUCCESS, { lot: newLot, dividend: newDividend });
}
async watchLot(msg: { code: string }, session: BackendSession) {
@@ -73,10 +75,14 @@ export class AuctionHandler {
}
async checkDividend(msg: {}, session: BackendSession) {
return resResult(STATUS.SUCCESS);
const begin = todayGuildBegin();
const guildCode = session.get('guildCode');
if (!guildCode) return resResult(STATUS.GUILD_NOT_FOUND);
const dividends = await DividendModel.findGuildDividendsByBegin(guildCode, begin);
return resResult(STATUS.SUCCESS, { dividends });
}
async getDividend(msg: {}, session: BackendSession) {
async getDividend(msg: { sourceType: number }, session: BackendSession) {
return resResult(STATUS.SUCCESS);
}