|
|
@@ -33,13 +33,10 @@ const getOptimalSelections = (odds, rules) => {
|
|
|
isValid = false;
|
|
|
break;
|
|
|
}
|
|
|
+ const { v, r, s, q, b, t } = item['ps'];
|
|
|
selection.push([{
|
|
|
- k: key,
|
|
|
- p: 'ps',
|
|
|
- v: item.ps.v,
|
|
|
- r: item.ps.r,
|
|
|
- s: item.ps.s,
|
|
|
- q: item.ps.q,
|
|
|
+ k: key, p: 'ps',
|
|
|
+ v, r, s, q, b, t,
|
|
|
o: item
|
|
|
}]);
|
|
|
}
|
|
|
@@ -50,15 +47,14 @@ const getOptimalSelections = (odds, rules) => {
|
|
|
isValid = false;
|
|
|
break;
|
|
|
}
|
|
|
- selection.push(candidates.map(k => ({
|
|
|
- k: key,
|
|
|
- p: k,
|
|
|
- v: item[k].v,
|
|
|
- r: item[k].r,
|
|
|
- s: item[k].s,
|
|
|
- q: item[k].q,
|
|
|
- o: item
|
|
|
- })));
|
|
|
+ selection.push(candidates.map(k => {
|
|
|
+ const { v, r, s, q, b, t } = item[k];
|
|
|
+ return {
|
|
|
+ k: key, p: k,
|
|
|
+ v, r, s, q, b, t,
|
|
|
+ o: item
|
|
|
+ };
|
|
|
+ }));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -109,9 +105,14 @@ const getPlatformKey = (cpr) => {
|
|
|
/**
|
|
|
* 添加返佣
|
|
|
*/
|
|
|
-const attachRebate = (ior) => {
|
|
|
+const attachRebate = (ior, k, p) => {
|
|
|
+ if (!ior) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (!k || !p) {
|
|
|
+ return { ...ior };
|
|
|
+ }
|
|
|
const { obRebateRatio, obRebateType, hgRebateRatio, hgRebateLower, hgRebateType, pcRebateRatio, pcRebateType } = getSetting();
|
|
|
- const { p, k } = ior;
|
|
|
let rebate = 0, rebateType = 0;
|
|
|
if (p == 'ps') {
|
|
|
rebate = 0;
|
|
|
@@ -138,7 +139,7 @@ const attachRebate = (ior) => {
|
|
|
/**
|
|
|
* 提取盘口数据
|
|
|
*/
|
|
|
-const extractOdds = ({ evtime, events, sptime, special }) => {
|
|
|
+const extractOdds = ({ platform, evtime, events, sptime, special }) => {
|
|
|
const { expireTimeEvents, expireTimeSpecial } = getSetting();
|
|
|
const nowTime = Date.now();
|
|
|
const expireTimeEv = nowTime - expireTimeEvents;
|
|
|
@@ -167,6 +168,9 @@ const extractOdds = ({ evtime, events, sptime, special }) => {
|
|
|
delete odds[ior];
|
|
|
extractData.removeCount++;
|
|
|
}
|
|
|
+ else {
|
|
|
+ odds[ior] = attachRebate(odds[ior], ior, platform);
|
|
|
+ }
|
|
|
});
|
|
|
extractData.odds = odds;
|
|
|
return extractData;
|
|
|
@@ -188,7 +192,7 @@ const getPassableEvents = (relations, eventsLogsMap) => {
|
|
|
if (platform == 'ps') {
|
|
|
eventsMap.info = { leagueName, teamHomeName, teamAwayName, id, timestamp, stage, score, retime };
|
|
|
}
|
|
|
- const { odds, evExpire, spExpire, removeCount } = extractOdds({ evtime, events, sptime, special });
|
|
|
+ const { odds, evExpire, spExpire, removeCount } = extractOdds({ platform, evtime, events, sptime, special });
|
|
|
|
|
|
/** 日志 盘口过期 */
|
|
|
if (eventsLogsMap && (evExpire || spExpire)) {
|
|
|
@@ -236,28 +240,28 @@ const eventsCombination = (passableEvents, innerBase, innerRebate) => {
|
|
|
optimalSelections.forEach(selection => {
|
|
|
const { rule, iors, ruleIndex } = selection;
|
|
|
const [, , , crossType] = rule;
|
|
|
- const oddsSideA = attachRebate(iors[0]);
|
|
|
- const oddsSideB = attachRebate(iors[1]);
|
|
|
- const oddsSideC = attachRebate(iors[2]);
|
|
|
+ // const oddsSideA = iors[0];
|
|
|
+ // const oddsSideB = iors[1];
|
|
|
+ // const oddsSideC = iors[2];
|
|
|
const innerIndex = iors.findIndex(item => item.p == 'ps');
|
|
|
- if (!oddsSideA || !oddsSideB || !oddsSideC) {
|
|
|
+ if (iors.some(item => !item?.v || item.v <= 0)) {
|
|
|
return;
|
|
|
}
|
|
|
- const cpr = [ oddsSideA, oddsSideB, oddsSideC ];
|
|
|
+ const cpr = [...iors];
|
|
|
const betInfo = {
|
|
|
cross_type: crossType,
|
|
|
inner_index: innerIndex,
|
|
|
inner_base: innerBase ?? innerDefaultAmount,
|
|
|
inner_rebate: innerRebate ?? fixFloat(innerRebateRatio / 100, 3),
|
|
|
- odds_side_a: fixFloat(oddsSideA.v - 1),
|
|
|
- odds_side_b: fixFloat(oddsSideB.v - 1),
|
|
|
- odds_side_c: fixFloat(oddsSideC.v - 1),
|
|
|
- rebate_side_a: parseFloat((oddsSideA.b / 100).toFixed(4)),
|
|
|
- rebate_type_side_a: oddsSideA.t,
|
|
|
- rebate_side_b: parseFloat((oddsSideB.b / 100).toFixed(4)),
|
|
|
- rebate_type_side_b: oddsSideB.t,
|
|
|
- rebate_side_c: parseFloat((oddsSideC.b / 100).toFixed(4)),
|
|
|
- rebate_type_side_c: oddsSideC.t,
|
|
|
+ odds_side_a: fixFloat(iors[0].v - 1),
|
|
|
+ odds_side_b: fixFloat(iors[1].v - 1),
|
|
|
+ odds_side_c: fixFloat(iors[2].v - 1),
|
|
|
+ rebate_side_a: parseFloat((iors[0].b / 100).toFixed(4)),
|
|
|
+ rebate_type_side_a: iors[0].t,
|
|
|
+ rebate_side_b: parseFloat((iors[1].b / 100).toFixed(4)),
|
|
|
+ rebate_type_side_b: iors[1].t,
|
|
|
+ rebate_side_c: parseFloat((iors[2].b / 100).toFixed(4)),
|
|
|
+ rebate_type_side_c: iors[2].t,
|
|
|
};
|
|
|
const sol = eventSolutions(betInfo, true);
|
|
|
if (cpr[2].k == '-') {
|
|
|
@@ -281,4 +285,4 @@ const eventsCombination = (passableEvents, innerBase, innerRebate) => {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
-module.exports = { eventsCombination, getPassableEvents };
|
|
|
+module.exports = { eventsCombination, getPassableEvents, extractOdds };
|