拍卖行:处理分红格式
This commit is contained in:
@@ -16,6 +16,7 @@ import { reportTAEvent } from './sdkService';
|
||||
import { getAllServers } from './redisService';
|
||||
import { sendMessageToGuildWithSuc, sendMessageToServer, sendMessageToServerWithSuc } from './pushService';
|
||||
import { isDebugTime } from '../pubUtils/sdkUtil';
|
||||
import { pick } from 'underscore';
|
||||
|
||||
// ! 获取底价,假数据
|
||||
export function getBasePrice(gid: number, count: number) {
|
||||
@@ -237,7 +238,7 @@ export async function genAuction(guildCode: string, sourceType: number, sourceCo
|
||||
};
|
||||
const dividend = await DividendModel.createDividend(dividendData);
|
||||
await sendMessageToGuildWithSuc(guildCode, PUSH_ROUTE.AUCTION_ADD, { lots });
|
||||
await sendMessageToGuildWithSuc(guildCode, PUSH_ROUTE.DIVIDEND_ADD, { dividends: [dividend] });
|
||||
await sendMessageToGuildWithSuc(guildCode, PUSH_ROUTE.DIVIDEND_ADD, { dividends: processDividendFormat([dividend]) });
|
||||
return { lots, dividend };
|
||||
}
|
||||
|
||||
@@ -477,7 +478,7 @@ export async function getAuction(guildCode: string, session: FrontendOrBackendSe
|
||||
if(guildCode) {
|
||||
dividends = await DividendModel.findGuildDividendsByBegin(guildCode, begin);
|
||||
}
|
||||
return { lots, dividends };
|
||||
return { lots, dividends: processDividendFormat(dividends) };
|
||||
}
|
||||
|
||||
export async function pushAuctionOver(lot: LotType) {
|
||||
@@ -526,7 +527,7 @@ export async function pushAuctionUpdate(lots: LotType[], dividends: DividendType
|
||||
dividendsResult.get(dividend.guildCode).push(dividend);
|
||||
}
|
||||
for(let [guildCode, dividends] of dividendsResult) {
|
||||
await sendMessageToGuildWithSuc(guildCode, PUSH_ROUTE.DIVIDEND_UPDATE, { dividends })
|
||||
await sendMessageToGuildWithSuc(guildCode, PUSH_ROUTE.DIVIDEND_UPDATE, { dividends: processDividendFormat(dividends) })
|
||||
}
|
||||
|
||||
|
||||
@@ -544,4 +545,12 @@ export async function checkAuctionStage(auctionStage: number) {
|
||||
if(curTime > (await todayWorldEnd()).getTime() + 10 * 60 * 1000) return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
export function processSingleDividendFormat(dividend: DividendType) {
|
||||
return pick(dividend, ['serverId', 'guildCode', 'sourceType', 'sourceCode', 'code', 'totalPrice', 'dividends'])
|
||||
}
|
||||
|
||||
export function processDividendFormat(dividends: DividendType[]) {
|
||||
return dividends.map(processSingleDividendFormat);
|
||||
}
|
||||
Reference in New Issue
Block a user