|
|
@@ -307,20 +307,22 @@ const syncBaseEvents = ({ mk, games, outrights }) => {
|
|
|
const isRb = (mk == 2);
|
|
|
const isSubsidy = timestamp > nowTime && timestamp < nowTime + 1000*60*60*subsidyTime;
|
|
|
Object.keys(events).forEach(ior => {
|
|
|
+ // 滚球胜平负补水
|
|
|
if (isRb && (ior.startsWith('ior_r') || ior.startsWith('ior_m') || ior.startsWith('ior_wm')) && subsidyRbWmAmount) {
|
|
|
- // 滚球胜平负
|
|
|
const sourceOdds = events[ior].v;
|
|
|
events[ior].v = fixFloat(sourceOdds * (1 + subsidyRbWmAmount), 3);
|
|
|
events[ior].s = sourceOdds
|
|
|
}
|
|
|
+ // 滚球进球数补水
|
|
|
+ // API采集特殊盘口用
|
|
|
else if (isRb && ior.startsWith('ior_ot') && subsidyRbOtAmount) {
|
|
|
- // 滚球进球数
|
|
|
const sourceOdds = events[ior].v;
|
|
|
events[ior].v = fixFloat(sourceOdds * (1 + subsidyRbOtAmount), 3);
|
|
|
events[ior].s = sourceOdds
|
|
|
}
|
|
|
+ // 赛前进球数补水
|
|
|
+ // API采集特殊盘口用
|
|
|
else if (!isRb && isSubsidy && ior.startsWith('ior_ot') && subsidyAmount) {
|
|
|
- // 赛前进球数
|
|
|
const sourceOdds = events[ior].v;
|
|
|
events[ior].v = fixFloat(sourceOdds * (1 + subsidyAmount), 3);
|
|
|
events[ior].s = sourceOdds
|
|
|
@@ -336,45 +338,46 @@ const syncBaseEvents = ({ mk, games, outrights }) => {
|
|
|
}
|
|
|
});
|
|
|
|
|
|
- outrights?.forEach(outright => {
|
|
|
- const { parentId, sptime, special } = outright;
|
|
|
- const baseGame = baseMap.get(parentId);
|
|
|
- if (baseGame) { // 赛前特殊盘口
|
|
|
- const { timestamp } = baseGame;
|
|
|
- const isSubsidy = timestamp > nowTime && timestamp < nowTime + 1000*60*60*subsidyTime;
|
|
|
- if (isSubsidy) {
|
|
|
- Object.keys(special).forEach(ior => {
|
|
|
- if (ior.startsWith('ior_ot') && subsidyAmount) {
|
|
|
- const sourceOdds = special[ior].v;
|
|
|
- special[ior].v = fixFloat(sourceOdds * (1 + subsidyAmount), 3);
|
|
|
- special[ior].s = sourceOdds
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- baseGame.sptime = sptime;
|
|
|
- baseGame.special = special;
|
|
|
- }
|
|
|
- else {
|
|
|
- const originBaseMap = new Map(baseList[marketType].map(item => [item.originId, item]));
|
|
|
- const originBaseGame = originBaseMap.get(parentId);
|
|
|
- if (originBaseGame) { // 滚球特殊盘口
|
|
|
- Object.keys(special).forEach(ior => {
|
|
|
- if (ior.startsWith('ior_wm') && subsidyRbWmAmount) {
|
|
|
- const sourceOdds = special[ior].v;
|
|
|
- special[ior].v = fixFloat(sourceOdds * (1 + subsidyRbWmAmount), 3);
|
|
|
- special[ior].s = sourceOdds
|
|
|
- }
|
|
|
- else if (ior.startsWith('ior_ot') && subsidyRbOtAmount) {
|
|
|
- const sourceOdds = special[ior].v;
|
|
|
- special[ior].v = fixFloat(sourceOdds * (1 + subsidyRbOtAmount), 3);
|
|
|
- special[ior].s = sourceOdds
|
|
|
- }
|
|
|
- });
|
|
|
- originBaseGame.sptime = sptime;
|
|
|
- originBaseGame.special = special;
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
+ // 浏览器采集特殊盘口用的
|
|
|
+ // outrights?.forEach(outright => {
|
|
|
+ // const { parentId, sptime, special } = outright;
|
|
|
+ // const baseGame = baseMap.get(parentId);
|
|
|
+ // if (baseGame) { // 赛前特殊盘口
|
|
|
+ // const { timestamp } = baseGame;
|
|
|
+ // const isSubsidy = timestamp > nowTime && timestamp < nowTime + 1000*60*60*subsidyTime;
|
|
|
+ // if (isSubsidy) {
|
|
|
+ // Object.keys(special).forEach(ior => {
|
|
|
+ // if (ior.startsWith('ior_ot') && subsidyAmount) {
|
|
|
+ // const sourceOdds = special[ior].v;
|
|
|
+ // special[ior].v = fixFloat(sourceOdds * (1 + subsidyAmount), 3);
|
|
|
+ // special[ior].s = sourceOdds
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ // baseGame.sptime = sptime;
|
|
|
+ // baseGame.special = special;
|
|
|
+ // }
|
|
|
+ // else {
|
|
|
+ // const originBaseMap = new Map(baseList[marketType].map(item => [item.originId, item]));
|
|
|
+ // const originBaseGame = originBaseMap.get(parentId);
|
|
|
+ // if (originBaseGame) { // 滚球特殊盘口
|
|
|
+ // Object.keys(special).forEach(ior => {
|
|
|
+ // if (ior.startsWith('ior_wm') && subsidyRbWmAmount) {
|
|
|
+ // const sourceOdds = special[ior].v;
|
|
|
+ // special[ior].v = fixFloat(sourceOdds * (1 + subsidyRbWmAmount), 3);
|
|
|
+ // special[ior].s = sourceOdds
|
|
|
+ // }
|
|
|
+ // else if (ior.startsWith('ior_ot') && subsidyRbOtAmount) {
|
|
|
+ // const sourceOdds = special[ior].v;
|
|
|
+ // special[ior].v = fixFloat(sourceOdds * (1 + subsidyRbOtAmount), 3);
|
|
|
+ // special[ior].s = sourceOdds
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // originBaseGame.sptime = sptime;
|
|
|
+ // originBaseGame.special = special;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // });
|
|
|
|
|
|
if (games?.length) {
|
|
|
const gamesList = baseList[marketType]?.map(game => {
|
|
|
@@ -488,6 +491,24 @@ const updateBaseEvents = ({ games, timestamp }) => {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+/**
|
|
|
+ * 比较外盘与内盘的赔率
|
|
|
+ */
|
|
|
+const compareOdds = (events, baseEvents, platform) => {
|
|
|
+ const setting = getSetting();
|
|
|
+ const maxDiff = setting[`${platform}MaxDiff`] ?? 0;
|
|
|
+ Object.keys(events).forEach(ior => {
|
|
|
+ const value = events[ior].v;
|
|
|
+ const baseValue = baseEvents[ior]?.s ?? baseEvents[ior]?.v ?? 1;
|
|
|
+ if (value - baseValue >= maxDiff) {
|
|
|
+ events[ior].q = 1;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ events[ior].q = 0;
|
|
|
+ }
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
const updateGamesEvents = ({ platform, mk, games, outrights, timestamp, tp }) => {
|
|
|
return new Promise((resolve, reject) => {
|
|
|
if (!platform || (!games && !outrights)) {
|
|
|
@@ -508,7 +529,16 @@ const updateGamesEvents = ({ platform, mk, games, outrights, timestamp, tp }) =>
|
|
|
return resolve({ update });
|
|
|
}
|
|
|
|
|
|
- const relatedGames = Object.values(GAMES.Relations).map(item => item.rel?.[platform] ?? {});
|
|
|
+ const relatedGames = Object.values(GAMES.Relations).map(item => {
|
|
|
+ // item.rel?.[platform] ?? {}
|
|
|
+ const { rel } = item ?? {};
|
|
|
+ if (!rel) {
|
|
|
+ return {};
|
|
|
+ }
|
|
|
+ const game = rel[platform] ?? {};
|
|
|
+ game.baseId = rel['ps']?.eventId;
|
|
|
+ return game;
|
|
|
+ });
|
|
|
|
|
|
if (!relatedGames.length) {
|
|
|
return resolve({ update: 0 });
|
|
|
@@ -518,11 +548,16 @@ const updateGamesEvents = ({ platform, mk, games, outrights, timestamp, tp }) =>
|
|
|
update: 0
|
|
|
};
|
|
|
|
|
|
+ const marketType = getMarketType(mk);
|
|
|
+ const baseList = GAMES.Baselist[marketType] ?? [];
|
|
|
+ const baseMap = new Map(baseList.map(item => [item.eventId, item]));
|
|
|
const relatedMap = new Map(relatedGames.map(item => [item.eventId, item]));
|
|
|
|
|
|
games?.forEach(game => {
|
|
|
const { eventId, evtime, events, stage, retime, score, wm } = game;
|
|
|
const relatedGame = relatedMap.get(eventId);
|
|
|
+ const baseEvents = baseMap.get(relatedGame.baseId)?.events ?? {};
|
|
|
+ compareOdds(events, baseEvents, platform);
|
|
|
if (relatedGame) {
|
|
|
relatedGame.evtime = evtime;
|
|
|
relatedGame.events = events;
|
|
|
@@ -538,6 +573,8 @@ const updateGamesEvents = ({ platform, mk, games, outrights, timestamp, tp }) =>
|
|
|
outrights?.forEach(outright => {
|
|
|
const { parentId, sptime, special } = outright;
|
|
|
const relatedGame = relatedMap.get(parentId);
|
|
|
+ const baseEvents = baseMap.get(relatedGame.baseId)?.events ?? {};
|
|
|
+ compareOdds(special, baseEvents, platform);
|
|
|
if (relatedGame) {
|
|
|
relatedGame.sptime = sptime;
|
|
|
relatedGame.special = special;
|
|
|
@@ -1179,8 +1216,9 @@ const syncQbossConfig = () => {
|
|
|
}
|
|
|
const {
|
|
|
qboss_return_ratio,
|
|
|
- ob_return_ratio, ob_return_type,
|
|
|
- hg_return_ratio, hg_return_type,
|
|
|
+ ob_return_ratio, ob_return_type, ob_odds_more_than,
|
|
|
+ hg_return_ratio, hg_return_type, hg_odds_more_than,
|
|
|
+ pc_return_ratio, pc_return_type,
|
|
|
qboss_jq_add_odds, qboss_jq_add_hours,
|
|
|
qboss_gq_add_dy_odds, qboss_gq_add_jq_odds,
|
|
|
} = data.data;
|
|
|
@@ -1188,8 +1226,12 @@ const syncQbossConfig = () => {
|
|
|
innerRebateRatio: +qboss_return_ratio,
|
|
|
obRebateRatio: +ob_return_ratio,
|
|
|
obRebateType: +ob_return_type,
|
|
|
+ obMaxDiff: +ob_odds_more_than,
|
|
|
hgRebateRatio: +hg_return_ratio,
|
|
|
hgRebateType: +hg_return_type,
|
|
|
+ hgMaxDiff: +hg_odds_more_than,
|
|
|
+ pcRebateRatio: +pc_return_ratio,
|
|
|
+ pcRebateType: +pc_return_type,
|
|
|
subsidyTime: +qboss_jq_add_hours,
|
|
|
subsidyAmount: +qboss_jq_add_odds,
|
|
|
subsidyRbWmAmount: +qboss_gq_add_dy_odds,
|