|
@@ -26,6 +26,21 @@ const GLOBAL_DATA = {
|
|
|
loopResultTime: 0,
|
|
loopResultTime: 0,
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+const resetVersionsCount = () => {
|
|
|
|
|
+ GLOBAL_DATA.straightFixturesVersion = 0;
|
|
|
|
|
+ GLOBAL_DATA.specialFixturesVersion = 0;
|
|
|
|
|
+ GLOBAL_DATA.straightOddsVersion = 0;
|
|
|
|
|
+ GLOBAL_DATA.specialsOddsVersion = 0;
|
|
|
|
|
+
|
|
|
|
|
+ GLOBAL_DATA.straightFixturesCount = 0;
|
|
|
|
|
+ GLOBAL_DATA.specialFixturesCount = 0;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+const incrementVersionsCount = () => {
|
|
|
|
|
+ GLOBAL_DATA.straightFixturesCount = 0;
|
|
|
|
|
+ GLOBAL_DATA.specialFixturesCount = 0;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 获取指定时区当前日期或时间
|
|
* 获取指定时区当前日期或时间
|
|
@@ -85,6 +100,14 @@ const pinnacleGet = async (endpoint, params) => {
|
|
|
// };
|
|
// };
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+const isArrayEqualUnordered = (arr1, arr2) => {
|
|
|
|
|
+ if (arr1.length !== arr2.length) return false;
|
|
|
|
|
+ const s1 = [...arr1].sort();
|
|
|
|
|
+ const s2 = [...arr2].sort();
|
|
|
|
|
+ return s1.every((v, i) => v === s2[i]);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
const getFiltedGames = () => {
|
|
const getFiltedGames = () => {
|
|
|
return new Promise(resolve => {
|
|
return new Promise(resolve => {
|
|
|
const updateFiltedGames = () => {
|
|
const updateFiltedGames = () => {
|
|
@@ -102,11 +125,18 @@ const getFiltedGames = () => {
|
|
|
};
|
|
};
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- GLOBAL_DATA.filtedLeagues = [...new Set(games.map(game => game.leagueId).filter(leagueId => leagueId))];
|
|
|
|
|
|
|
+ const newFiltedLeagues = [...new Set(games.map(game => game.leagueId).filter(leagueId => leagueId))];
|
|
|
|
|
+
|
|
|
|
|
+ if (!isArrayEqualUnordered(newFiltedLeagues, GLOBAL_DATA.filtedLeagues)) {
|
|
|
|
|
+ Logs.outDev('filted leagues changed', newFiltedLeagues);
|
|
|
|
|
+ resetVersionsCount();
|
|
|
|
|
+ GLOBAL_DATA.filtedLeagues = newFiltedLeagues;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
GLOBAL_DATA.filtedGames = games.map(game => game.eventId).filter(eventId => eventId);
|
|
GLOBAL_DATA.filtedGames = games.map(game => game.eventId).filter(eventId => eventId);
|
|
|
|
|
|
|
|
resolve();
|
|
resolve();
|
|
|
- setTimeout(updateFiltedGames, 1000 * 30);
|
|
|
|
|
|
|
+ setTimeout(updateFiltedGames, 1000 * 60);
|
|
|
})
|
|
})
|
|
|
.catch(err => {
|
|
.catch(err => {
|
|
|
Logs.err('failed to update filted games:', err.message);
|
|
Logs.err('failed to update filted games:', err.message);
|
|
@@ -734,21 +764,10 @@ const pinnacleDataLoop = () => {
|
|
|
let loopDelay = 1000 * 5;
|
|
let loopDelay = 1000 * 5;
|
|
|
if (!loopActive) {
|
|
if (!loopActive) {
|
|
|
loopDelay = 1000 * 60;
|
|
loopDelay = 1000 * 60;
|
|
|
- GLOBAL_DATA.straightFixturesVersion = 0;
|
|
|
|
|
- GLOBAL_DATA.specialFixturesVersion = 0;
|
|
|
|
|
- GLOBAL_DATA.straightOddsVersion = 0;
|
|
|
|
|
- GLOBAL_DATA.specialsOddsVersion = 0;
|
|
|
|
|
-
|
|
|
|
|
- GLOBAL_DATA.straightFixturesCount = 0;
|
|
|
|
|
- GLOBAL_DATA.specialFixturesCount = 0;
|
|
|
|
|
- // GLOBAL_DATA.straightOddsCount = 0;
|
|
|
|
|
- // GLOBAL_DATA.specialsOddsCount = 0;
|
|
|
|
|
|
|
+ resetVersionsCount();
|
|
|
}
|
|
}
|
|
|
else {
|
|
else {
|
|
|
- GLOBAL_DATA.straightFixturesCount++;
|
|
|
|
|
- GLOBAL_DATA.specialFixturesCount++;
|
|
|
|
|
- // GLOBAL_DATA.straightOddsCount++;
|
|
|
|
|
- // GLOBAL_DATA.specialsOddsCount++;
|
|
|
|
|
|
|
+ incrementVersionsCount();
|
|
|
}
|
|
}
|
|
|
setTimeout(pinnacleDataLoop, loopDelay);
|
|
setTimeout(pinnacleDataLoop, loopDelay);
|
|
|
});
|
|
});
|