|
@@ -79,19 +79,33 @@ const extractOdds = ({ evtime, events, sptime, special }) => {
|
|
|
const setting = getSetting();
|
|
const setting = getSetting();
|
|
|
const expireTimeEv = Date.now() - setting.expireTimeEvents;
|
|
const expireTimeEv = Date.now() - setting.expireTimeEvents;
|
|
|
const expireTimeSP = Date.now() - setting.expireTimeSpecial;
|
|
const expireTimeSP = Date.now() - setting.expireTimeSpecial;
|
|
|
|
|
+ const extractData = {
|
|
|
|
|
+ odds: null,
|
|
|
|
|
+ evExpire: false,
|
|
|
|
|
+ spExpire: false,
|
|
|
|
|
+ removeCount: 0,
|
|
|
|
|
+ }
|
|
|
let odds = {};
|
|
let odds = {};
|
|
|
if (evtime > expireTimeEv) {
|
|
if (evtime > expireTimeEv) {
|
|
|
odds = { ...odds, ...events };
|
|
odds = { ...odds, ...events };
|
|
|
}
|
|
}
|
|
|
|
|
+ else {
|
|
|
|
|
+ extractData.evExpire = true;
|
|
|
|
|
+ }
|
|
|
if (sptime > expireTimeSP) {
|
|
if (sptime > expireTimeSP) {
|
|
|
odds = { ...odds, ...special };
|
|
odds = { ...odds, ...special };
|
|
|
}
|
|
}
|
|
|
|
|
+ else {
|
|
|
|
|
+ extractData.spExpire = true;
|
|
|
|
|
+ }
|
|
|
Object.keys(odds).forEach(ior => {
|
|
Object.keys(odds).forEach(ior => {
|
|
|
if (!odds[ior]?.v || odds[ior].v <= 0) {
|
|
if (!odds[ior]?.v || odds[ior].v <= 0) {
|
|
|
delete odds[ior];
|
|
delete odds[ior];
|
|
|
|
|
+ extractData.removeCount++;
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
- return odds;
|
|
|
|
|
|
|
+ extractData.odds = odds;
|
|
|
|
|
+ return extractData;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const eventMatch = () => {
|
|
const eventMatch = () => {
|
|
@@ -109,9 +123,18 @@ const eventMatch = () => {
|
|
|
|
|
|
|
|
GLOBAL_DATA.relationLength = relationLength;
|
|
GLOBAL_DATA.relationLength = relationLength;
|
|
|
|
|
|
|
|
|
|
+ const expireEvents = [];
|
|
|
|
|
+
|
|
|
const passableEvents = relations.map(({ id, rel }) => {
|
|
const passableEvents = relations.map(({ id, rel }) => {
|
|
|
const eventsMap = {};
|
|
const eventsMap = {};
|
|
|
const oddsMap = {};
|
|
const oddsMap = {};
|
|
|
|
|
+ if (!rel.hasOwnProperty('ps')) {
|
|
|
|
|
+ expireEvents.push({
|
|
|
|
|
+ rel,
|
|
|
|
|
+ noPs: true,
|
|
|
|
|
+ });
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
Object.keys(rel).forEach(platform => {
|
|
Object.keys(rel).forEach(platform => {
|
|
|
const { leagueName, teamHomeName, teamAwayName, timestamp, stage, score, evtime, events, sptime, special } = rel[platform];
|
|
const { leagueName, teamHomeName, teamAwayName, timestamp, stage, score, evtime, events, sptime, special } = rel[platform];
|
|
|
if (!events && !special) {
|
|
if (!events && !special) {
|
|
@@ -120,7 +143,16 @@ const eventMatch = () => {
|
|
|
if (platform == 'ps') {
|
|
if (platform == 'ps') {
|
|
|
eventsMap.info = { leagueName, teamHomeName, teamAwayName, id, timestamp, stage, score };
|
|
eventsMap.info = { leagueName, teamHomeName, teamAwayName, id, timestamp, stage, score };
|
|
|
}
|
|
}
|
|
|
- const odds = extractOdds({ evtime, events, sptime, special });
|
|
|
|
|
|
|
+ const { odds, evExpire, spExpire, removeCount } = extractOdds({ evtime, events, sptime, special });
|
|
|
|
|
+ if (evExpire || spExpire || removeCount) {
|
|
|
|
|
+ expireEvents.push({
|
|
|
|
|
+ rel,
|
|
|
|
|
+ platform,
|
|
|
|
|
+ evExpire,
|
|
|
|
|
+ spExpire,
|
|
|
|
|
+ removeCount,
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
Object.keys(odds).forEach(ior => {
|
|
Object.keys(odds).forEach(ior => {
|
|
|
if (!oddsMap[ior]) {
|
|
if (!oddsMap[ior]) {
|
|
|
oddsMap[ior] = {};
|
|
oddsMap[ior] = {};
|
|
@@ -133,6 +165,10 @@ const eventMatch = () => {
|
|
|
})
|
|
})
|
|
|
.filter(item => item.info);
|
|
.filter(item => item.info);
|
|
|
|
|
|
|
|
|
|
+ if (expireEvents?.length) {
|
|
|
|
|
+ Logs.out('updateExpireEvents', expireEvents);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
const solutions = eventsCombination(passableEvents);
|
|
const solutions = eventsCombination(passableEvents);
|
|
|
|
|
|
|
|
// Logs.out('eventMatch solutions', solutions);
|
|
// Logs.out('eventMatch solutions', solutions);
|