|
@@ -172,6 +172,18 @@ const syncBaseList = ({ marketType, games }) => {
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+/**
|
|
|
|
|
+ * 清理基准比赛列表
|
|
|
|
|
+ */
|
|
|
|
|
+const cleanupBaseList = () => {
|
|
|
|
|
+ const baseList = GAMES.Baselist;
|
|
|
|
|
+ const nowTime = Date.now();
|
|
|
|
|
+ const expireTime = nowTime - 1000*60*60*3;
|
|
|
|
|
+ Object.keys(baseList).forEach(marketType => {
|
|
|
|
|
+ baseList[marketType] = baseList[marketType].filter(item => item.timestamp < expireTime);
|
|
|
|
|
+ });
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 更新比赛列表
|
|
* 更新比赛列表
|
|
|
*/
|
|
*/
|
|
@@ -268,16 +280,6 @@ const syncBaseEvents = ({ mk, games, outrights }) => {
|
|
|
value: odds[key]?.v ?? 0,
|
|
value: odds[key]?.v ?? 0,
|
|
|
origin: odds[key]?.r
|
|
origin: odds[key]?.r
|
|
|
}
|
|
}
|
|
|
- // if (key.includes('os') && !odds[key]) {
|
|
|
|
|
- // return { key, value: 1 };
|
|
|
|
|
- // }
|
|
|
|
|
- // else {
|
|
|
|
|
- // return {
|
|
|
|
|
- // key,
|
|
|
|
|
- // value: odds[key]?.v ?? 0,
|
|
|
|
|
- // origin: odds[key]?.r
|
|
|
|
|
- // }
|
|
|
|
|
- // }
|
|
|
|
|
});
|
|
});
|
|
|
if (label == 'jqs') {
|
|
if (label == 'jqs') {
|
|
|
match = match.filter(item => item.value !== 0);
|
|
match = match.filter(item => item.value !== 0);
|
|
@@ -294,13 +296,10 @@ const syncBaseEvents = ({ mk, games, outrights }) => {
|
|
|
return item.match.every(entry => entry.value !== 0);
|
|
return item.match.every(entry => entry.value !== 0);
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
|
|
+
|
|
|
|
|
+ game.matches = matches; // matches 也记录下来
|
|
|
|
|
+
|
|
|
let uptime = evtime ?? 0;
|
|
let uptime = evtime ?? 0;
|
|
|
- // if (evtime && sptime) {
|
|
|
|
|
- // uptime = Math.min(evtime, sptime);
|
|
|
|
|
- // }
|
|
|
|
|
- // else if (!sptime) {
|
|
|
|
|
- // uptime = evtime ?? 0;
|
|
|
|
|
- // }
|
|
|
|
|
return { ...gameInfo, matches, uptime };
|
|
return { ...gameInfo, matches, uptime };
|
|
|
});
|
|
});
|
|
|
|
|
|
|
@@ -828,9 +827,22 @@ const getSolution = async (sid) => {
|
|
|
* 通过比赛 ID 获取中单方案
|
|
* 通过比赛 ID 获取中单方案
|
|
|
*/
|
|
*/
|
|
|
const getSolutionsByIds = async (ids) => {
|
|
const getSolutionsByIds = async (ids) => {
|
|
|
- const idsSet = new Set(ids.map(item => +item));
|
|
|
|
|
- const solutions = Object.values(GAMES.Solutions).filter(item => idsSet.has(item.info.id));
|
|
|
|
|
- return solutions;
|
|
|
|
|
|
|
+ const baseList = Object.values(GAMES.Baselist).flat();
|
|
|
|
|
+ const baseMap = new Map(baseList.map(item => [item.eventId, item]));
|
|
|
|
|
+ const result = {};
|
|
|
|
|
+ ids.forEach(id => {
|
|
|
|
|
+ const baseGame = baseMap.get(id);
|
|
|
|
|
+ result[id] = {};
|
|
|
|
|
+ result[id].matches = baseGame?.matches ?? [];
|
|
|
|
|
+ result[id].sols = [];
|
|
|
|
|
+ });
|
|
|
|
|
+ Object.values(GAMES.Solutions).forEach(item => {
|
|
|
|
|
+ const { info: { id } } = item;
|
|
|
|
|
+ if (result[id]) {
|
|
|
|
|
+ result[id].sols.push(item);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ return result;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -865,6 +877,7 @@ const solutionsCleanup = () => {
|
|
|
* 定时清理盘口信息
|
|
* 定时清理盘口信息
|
|
|
*/
|
|
*/
|
|
|
setInterval(() => {
|
|
setInterval(() => {
|
|
|
|
|
+ cleanupBaseList();
|
|
|
solutionsCleanup();
|
|
solutionsCleanup();
|
|
|
gamesRelationCleanup();
|
|
gamesRelationCleanup();
|
|
|
}, 1000*30);
|
|
}, 1000*30);
|