拍卖行:修改分红逻辑
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
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, DIVIDENDMAXRATIO, DIVIDENDPOSITIONMAXRATIO, ROLE_RECEIVE_STATUS, AUCTION_BID_STATUS, DEBUG_MAGIC_WORD, AUCTION_SOURCE, TA_EVENT, getAuctionSourceTypeName, PUSH_ROUTE } from './../consts';
|
||||
import { LOT_CODE_LEN, AUCTION_STAGE, AUCTION_TIME, DIVIDEND_CODE_LEN, DIVIDEND_STATUS, LOT_STATUS, MAIL_TYPE, CURRENCY_BY_TYPE, CURRENCY_TYPE, DIVIDENDMAXRATIO, DIVIDENDPOSITIONMAXRATIO, ROLE_RECEIVE_STATUS, AUCTION_BID_STATUS, DEBUG_MAGIC_WORD, AUCTION_SOURCE, TA_EVENT, getAuctionSourceTypeName, PUSH_ROUTE, GUILD_JOB } from './../consts';
|
||||
import { DividendRec, ItemReward } from "../domain/dbGeneral";
|
||||
import { genCode, getRandSingleEelm } from '../pubUtils/util';
|
||||
import { LotModel, LotParam, LotType } from '../db/Lot';
|
||||
@@ -242,8 +242,12 @@ export async function genAuction(guildCode: string, sourceType: number, sourceCo
|
||||
|
||||
function posDividend(totalPrice: number, roleRatio: number, totalRatio: number) {
|
||||
const dividend = Math.floor(totalPrice * roleRatio / totalRatio);
|
||||
const maxDividend = Math.floor(totalPrice * DIVIDENDMAXRATIO);
|
||||
return dividend <= maxDividend ? dividend : Math.floor(maxDividend * roleRatio / DIVIDENDPOSITIONMAXRATIO);
|
||||
const maxDividend = Math.floor(totalPrice * dicParam.GUILD_AUCTION.DIVIDEND_MAXRATIO);
|
||||
return dividend <= maxDividend ? dividend : Math.floor(maxDividend * roleRatio / getMaxPosRatio());
|
||||
}
|
||||
|
||||
function getMaxPosRatio() {
|
||||
return gameData.guildPosition.get(GUILD_JOB.DAJIANGJUN).sellRatio;
|
||||
}
|
||||
|
||||
function weekendDividend(posNum: number, date: Date) {
|
||||
@@ -275,6 +279,7 @@ export async function calculateDividend(dividend: DividendType) {
|
||||
const totalRatio = totalDividendRatio(participantsData);
|
||||
const dividends: DividendRec[] = participantsData.map(data => {
|
||||
const { roleId } = data;
|
||||
console.log('### calculateDividend', calcuTotalPrice, dividendRate(data), totalRatio)
|
||||
const posNum = posDividend(calcuTotalPrice, dividendRate(data), totalRatio);
|
||||
const weekendNum = weekendDividend(posNum, begin);
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user