|
@@ -10,7 +10,6 @@ const fs = require('fs');
|
|
|
const path = require('path');
|
|
const path = require('path');
|
|
|
|
|
|
|
|
const GamesCacheFile = path.join(__dirname, '../data/games.cache');
|
|
const GamesCacheFile = path.join(__dirname, '../data/games.cache');
|
|
|
-const DevGameTastFile = path.join(__dirname, '../data/gameTast.json');
|
|
|
|
|
|
|
|
|
|
const childOptions = process.env.NODE_ENV == 'development' ? {
|
|
const childOptions = process.env.NODE_ENV == 'development' ? {
|
|
|
execArgv: ['--inspect=9230'],
|
|
execArgv: ['--inspect=9230'],
|
|
@@ -624,22 +623,13 @@ const getGamesEvents = ({ platform, relIds = [] } = {}) => {
|
|
|
/**
|
|
/**
|
|
|
* 获取关联比赛
|
|
* 获取关联比赛
|
|
|
*/
|
|
*/
|
|
|
-const getDevGameTast = () => {
|
|
|
|
|
- return new Promise((resolve) => {
|
|
|
|
|
- const data = Cache.getData(DevGameTastFile, true);
|
|
|
|
|
- resolve({data});
|
|
|
|
|
- });
|
|
|
|
|
-}
|
|
|
|
|
const fetchGamesRelation = async (mk='') => {
|
|
const fetchGamesRelation = async (mk='') => {
|
|
|
- const getGameTast = Promise.all([
|
|
|
|
|
- getDevGameTast(),
|
|
|
|
|
- axios.get(`${BASE_API_URL}/p/getGameTast?mk=${mk}`, { proxy: false })
|
|
|
|
|
- ]);
|
|
|
|
|
- return getGameTast.then(([res1, res2]) => {
|
|
|
|
|
- const resData = res1.data ?? res2.data;
|
|
|
|
|
|
|
+ return axios.get(`${BASE_API_URL}/p/getGameTast?mk=${mk}`, {
|
|
|
|
|
+ proxy: false
|
|
|
|
|
+ }).then(({ data: resData }) => {
|
|
|
if (resData.code == 0) {
|
|
if (resData.code == 0) {
|
|
|
const nowTime = Date.now();
|
|
const nowTime = Date.now();
|
|
|
- const gamesRelation = resData.data?.filter(item => {
|
|
|
|
|
|
|
+ const gamesRelation = resData.data?.filter?.((item) => {
|
|
|
const timestamp = new Date(item.timestamp).getTime();
|
|
const timestamp = new Date(item.timestamp).getTime();
|
|
|
if (nowTime > timestamp) {
|
|
if (nowTime > timestamp) {
|
|
|
item.mk = 2;
|
|
item.mk = 2;
|