Jelajahi Sumber

更新中单方案获取方式

flyzto 7 bulan lalu
induk
melakukan
41a008147b

+ 3 - 2
server/models/Games.js

@@ -322,10 +322,10 @@ const setSolutions = (solutions) => {
  * 获取中单方案
  */
 const getSolutions = async () => {
+  const gamesEvents = getGamesEvents();
   const gamesRelations = await getGamesRelation();
   const relationsMap = new Map(gamesRelations.map(item => [item.id, item.rel]));
-  const solutions = Object.values(GAMES.Solutions).sort((a, b) => b.sol.win_average - a.sol.win_average);
-  return solutions.map(item => {
+  const solutions = Object.values(GAMES.Solutions).sort((a, b) => b.sol.win_average - a.sol.win_average).map(item => {
     const { info: { id } } = item;
     const relation = relationsMap.get(id);
     return {
@@ -333,6 +333,7 @@ const getSolutions = async () => {
       info: { id, ...relation }
     }
   });
+  return { solutions, gamesEvents };
 }
 
 /**

+ 1 - 14
web/apps/web-antd/src/views/match/solutions/index.vue

@@ -21,19 +21,6 @@ const getSolutions = async () => {
   }
 }
 
-const getGamesEvents = async () => {
-  try {
-    const data = await requestClient.get('/triangle/get_games_events');
-    return data;
-  }
-  catch (error) {
-    console.error('Failed to fetch games events:', error);
-    message.error('获取比赛盘口失败');
-    return {};
-  }
-}
-
-
 // const moveToFront = (arr, index) => {
 //   if (index <= 0 || index >= arr.length) {
 //     return arr;
@@ -174,7 +161,7 @@ const formatEvents = (events, cprKeys) => {
 }
 
 const updateSolutions = async () => {
-  const [solutionsList, eventsList] = await Promise.all([getSolutions(), getGamesEvents()]);
+  const { solutions: solutionsList, gamesEvents: eventsList } = await getSolutions();
   solutions.value = solutionsList.map(item => {
     const { cpr, info, sol: { cross_type, jc_index, gold_side_a, gold_side_b, gold_side_m, win_side_a, win_side_b, win_side_m, win_average } } = item;
     const cprKeys = cpr.map(item => item.k);