flyzto 3 сар өмнө
parent
commit
589d7d6f39

+ 22 - 7
server/models/GamesPs.js

@@ -786,30 +786,45 @@ const getSolutions = async ({ win_min, no_events, mk=-1 }) => {
   const solutionsList = Object.values(GAMES.Solutions);
   const gamesRelation = getGamesRelation();
   const relationsMap = new Map(gamesRelation.map(item => [item.id, item]));
-  const solutions = solutionsList.sort((a, b) => b.sol.win_average - a.sol.win_average)
-  .filter(item => {
+
+  const mkCount = {
+    all: 0,
+    rollball: 0,
+    today: 0,
+    early: 0,
+  }
+
+  let solutions = solutionsList.filter(item => {
     const { sol: { win_average } } = item;
     return win_average >= (win_min ?? minShowAmount);
   })
   .map(item => {
     const { info: { id } } = item;
     const { mk, rel } = relationsMap.get(id);
+    const marketType = getMarketType(mk);
+    mkCount.all ++;
+    mkCount[marketType] ++;
     return {
       ...item,
       info: { id, mk, ...rel }
     }
-  })
-  .filter(item => {
-    const { info: { mk } } = item;
-    return marketType == -1 || marketType == mk;
   });
 
+  if (mk >= 0) {
+    solutions = solutions.filter(item => {
+      const { info: { mk } } = item;
+      return mk == marketType;
+    });
+  }
+
+  solutions = solutions.sort((a, b) => b.sol.win_average - a.sol.win_average);
+
   const relIds = solutions.map(item => item.info.id);
   let gamesEvents = null;
   if (!no_events) {
     gamesEvents = getGamesEvents({ relIds });
   }
-  return { solutions, gamesEvents };
+  return { solutions, gamesEvents, mkCount };
 }
 
 /**

+ 2 - 2
server/routes/pstery.js

@@ -77,8 +77,8 @@ router.get('/get_solutions', (req, res) => {
     no_events: no_events === 'true',
     mk: mk ? +mk : -1
   })
-  .then(({ solutions, gamesEvents }) => {
-    res.sendSuccess({ solutions, gamesEvents });
+  .then(({ solutions, gamesEvents, mkCount }) => {
+    res.sendSuccess({ solutions, gamesEvents, mkCount });
   })
   .catch(err => {
     res.badRequest(err.message);

+ 59 - 57
web/apps/web-antd/src/views/match/solutions/index.vue

@@ -10,6 +10,7 @@ import { useContentsPositionStore } from '@vben/stores';
 const contentsPositionStore = useContentsPositionStore();
 
 const solutions = ref([]);
+const markCount = ref({ all: 0, rollball: 0, today: 0, early: 0 });
 const selectedSolutions = reactive([]);
 const totalProfit = ref({});
 const loopActive = ref(false);
@@ -34,58 +35,58 @@ const headerStyle = computed(() => {
   }
 });
 
-const totalProfitValue = computed(() => {
-  const { profit = {}, preSolution = {}, subSolution = {}, gamesEvents = {} } = totalProfit.value;
-  const sol1 = formatSolution(preSolution, gamesEvents);
-  const sol2 = formatSolution(subSolution, gamesEvents);
-
-  const psInfo = [];
-  const outPreSol = [];
-  const outSubSol = [];
-
-  const solutions = [sol1, sol2].filter(item => item);
-  solutions.forEach((item, index) => {
-    const { sol: { ps_index }, cpr } = item;
-    const newCpr = [...cpr];
-    const ps_info = newCpr.splice(ps_index, 1);
-    psInfo.push({ ...ps_info[0] });
-    newCpr.forEach((c, i) => {
-      let side = '';
-      if (ps_index == 0) {
-        if (i == 0) {
-          side = "B"
-        }
-        else {
-          side = "M";
-        }
-      }
-      else if (ps_index == 1) {
-        if (i == 0) {
-          side = "A";
-        }
-        else {
-          side = "M";
-        }
-      }
-      else {
-        if (i == 0) {
-          side = "A";
-        }
-        else {
-          side = "B";
-        }
-      }
-      if (index == 0) {
-        outPreSol.push({ ...c, g: profitInfo[`gold${side}${index+1}`] });
-      }
-      else {
-        outSubSol.push({ ...c, g: profitInfo[`gold${side}${index+1}`] });
-      }
-    })
-  });
-
-  return { solutions, profit: profitInfo, psInfo, outPreSol, outSubSol };
-});
+// const totalProfitValue = computed(() => {
+//   const { profit = {}, preSolution = {}, subSolution = {}, gamesEvents = {} } = totalProfit.value;
+//   const sol1 = formatSolution(preSolution, gamesEvents);
+//   const sol2 = formatSolution(subSolution, gamesEvents);
+
+//   const psInfo = [];
+//   const outPreSol = [];
+//   const outSubSol = [];
+
+//   const solutions = [sol1, sol2].filter(item => item);
+//   solutions.forEach((item, index) => {
+//     const { sol: { ps_index }, cpr } = item;
+//     const newCpr = [...cpr];
+//     const ps_info = newCpr.splice(ps_index, 1);
+//     psInfo.push({ ...ps_info[0] });
+//     newCpr.forEach((c, i) => {
+//       let side = '';
+//       if (ps_index == 0) {
+//         if (i == 0) {
+//           side = "B"
+//         }
+//         else {
+//           side = "M";
+//         }
+//       }
+//       else if (ps_index == 1) {
+//         if (i == 0) {
+//           side = "A";
+//         }
+//         else {
+//           side = "M";
+//         }
+//       }
+//       else {
+//         if (i == 0) {
+//           side = "A";
+//         }
+//         else {
+//           side = "B";
+//         }
+//       }
+//       if (index == 0) {
+//         outPreSol.push({ ...c, g: profitInfo[`gold${side}${index+1}`] });
+//       }
+//       else {
+//         outSubSol.push({ ...c, g: profitInfo[`gold${side}${index+1}`] });
+//       }
+//     })
+//   });
+
+//   return { solutions, profit: profitInfo, psInfo, outPreSol, outSubSol };
+// });
 
 const solutionsList = computed(() => {
   const startTimestamp = selectedSolutions[0]?.timestamp ?? 0;
@@ -325,8 +326,9 @@ const formatSolution = (solution, eventsList) => {
 const updateSolutions = async () => {
   clearTimeout(loopTimer.value);
   getSolutions()
-  .then(({ solutions: solutionsList, gamesEvents: eventsList }) => {
+  .then(({ solutions: solutionsList, gamesEvents: eventsList, mkCount: mkCountData }) => {
     solutions.value = solutionsList?.map(solution => formatSolution(solution, eventsList)) ?? [];
+    markCount.value = mkCountData;
   })
   .catch(error => {
     console.error('Failed to update solutions:', error);
@@ -423,10 +425,10 @@ onUnmounted(() => {
         <Form layout="inline" class="sol-opt-container">
           <Form.Item label="盘口类型" class="sol-opt-item">
             <RadioGroup v-model:value="marketType">
-              <Radio :value="-1">全部</Radio>
-              <Radio :value="2">滚球</Radio>
-              <Radio :value="1">今日</Radio>
-              <Radio :value="0">早盘</Radio>
+              <Radio :value="-1">全部({{ markCount.all ?? 0 }})</Radio>
+              <Radio :value="2">滚球({{ markCount.rollball ?? 0 }})</Radio>
+              <Radio :value="1">今日({{ markCount.today ?? 0 }})</Radio>
+              <Radio :value="0">早盘({{ markCount.early ?? 0 }})</Radio>
             </RadioGroup>
           </Form.Item>
           <Form.Item label="最小利润率(%)" class="sol-opt-item">