Explorar el Código

im平台支持

flyzto hace 2 semanas
padre
commit
3d0899f6a5
Se han modificado 3 ficheros con 13 adiciones y 7 borrados
  1. 2 2
      pinnacle/main.js
  2. 9 3
      server/models/GamesPs.js
  3. 2 2
      server/routes/pstery.js

+ 2 - 2
pinnacle/main.js

@@ -7,7 +7,7 @@ import { getData, setData } from "./libs/cache.js";
 
 const gamesMapCacheFile = 'data/gamesCache.json';
 const globalDataCacheFile = 'data/globalDataCache.json';
-
+const TP = 'ps_9_9_1';
 
 const GLOBAL_DATA = {
   filtedLeagues: [],
@@ -734,7 +734,7 @@ const pinnacleDataLoop = () => {
     const { straightFixturesVersion: sfv, specialFixturesVersion: pfv, straightOddsVersion: sov, specialsOddsVersion: pov } = GLOBAL_DATA;
     const timestamp = Math.max(sfv, pfv, sov, pov);
     const games = getGames();
-    const data = { games, timestamp };
+    const data = { games, timestamp, tp: TP };
 
     updateBaseEvents(data);
 

+ 9 - 3
server/models/GamesPs.js

@@ -42,7 +42,7 @@ const IOR_KEYS_TYPE = {
 // 测试环境
 // const BASE_API_URL = 'https://dev.api.czxd8.com/api/p';
 const IS_DEV = process.env.NODE_ENV == 'development';
-const BASE_API_URL = IS_DEV ? 'https://api.qboss.vip/api' : 'http://172.17.222.37/api';
+const BASE_API_URL = IS_DEV ? 'https://cb.long.bid/qbapi' : 'http://172.17.222.37/api';
 
 const GAMES = {
   Leagues: {},
@@ -163,6 +163,7 @@ const updateLeaguesList = ({ mk, leagues, platform='ps' }) => {
 const getFilteredLeagues = async (mk) => {
   return axios.get(`${BASE_API_URL}/p/getLeagueTast?mk=${mk ?? ''}`, { proxy: false })
   .then(res => {
+    Logs.out('getFilteredLeagues', res.data);
     if (res.data.code == 0) {
       return res.data.data;
     }
@@ -465,7 +466,7 @@ const syncBaseEvents = ({ mk, games, outrights }) => {
   }
 }
 
-const updateBaseEvents = ({ games, timestamp }) => {
+const updateBaseEvents = ({ games, timestamp, tp='ps_9_9_1' }) => {
   return new Promise((resolve, reject) => {
     if (!games) {
       return reject(new Error('GAMES_INVALID'));
@@ -476,7 +477,6 @@ const updateBaseEvents = ({ games, timestamp }) => {
 
     let update = 0;
     const { UpdateTimestamp } = GAMES;
-    const tp = 'ps_9_9';
     if (!UpdateTimestamp[tp] || UpdateTimestamp[tp] < timestamp) {
       UpdateTimestamp[tp] = timestamp;
     }
@@ -556,6 +556,9 @@ const updateGamesEvents = ({ platform, mk, games, outrights, timestamp, tp }) =>
     games?.forEach(game => {
       const { eventId, evtime, events, stage, retime, score, wm } = game;
       const relatedGame = relatedMap.get(eventId);
+      if (!relatedGame) {
+        return;
+      }
       const baseEvents = baseMap.get(relatedGame.baseId)?.events ?? {};
       compareOdds(events, baseEvents, platform);
       if (relatedGame) {
@@ -573,6 +576,9 @@ const updateGamesEvents = ({ platform, mk, games, outrights, timestamp, tp }) =>
     outrights?.forEach(outright => {
       const { parentId, sptime, special } = outright;
       const relatedGame = relatedMap.get(parentId);
+      if (!relatedGame) {
+        return;
+      }
       const baseEvents = baseMap.get(relatedGame.baseId)?.events ?? {};
       compareOdds(special, baseEvents, platform);
       if (relatedGame) {

+ 2 - 2
server/routes/pstery.js

@@ -29,8 +29,8 @@ router.post('/update_games_events', (req, res) => {
 
 // 更新内盘盘口
 router.post('/update_base_events', (req, res) => {
-  const { games, timestamp } = req.body ?? {};
-  Games.updateBaseEvents({ games, timestamp })
+  const { games, timestamp, tp } = req.body ?? {};
+  Games.updateBaseEvents({ games, timestamp, tp })
   .then(() => {
     res.sendSuccess();
   })