Browse Source

增加盘口类型筛选

flyzto 2 months ago
parent
commit
17e31a8777

+ 25 - 10
server/models/GamesPs.js

@@ -28,6 +28,11 @@ const PS_IOR_KEYS = [
   ['jqs', 'ior_ot_1', 'ior_ot_2', 'ior_ot_3', 'ior_ot_4', 'ior_ot_5', 'ior_ot_6', 'ior_ot_7'],
 ];
 
+const IOR_KEYS_TYPE = {
+  A: 1, B: 1, C: 1, L: 1,
+  D: 2, E: 2, F: 2, G: 2, H: 2, I: 2, J: 2,
+}
+
 // 测试环境
 // const BASE_API_URL = 'https://dev.api.czxd8.com/api/p';
 const IS_DEV = process.env.NODE_ENV == 'development';
@@ -69,6 +74,14 @@ const getMarketType = (mk) => {
   return 'today';
 }
 
+/**
+ * 获取策略类型
+ */
+const getRuleType = (rule) => {
+  const rulePrefix = rule.split(':')[0];
+  return IOR_KEYS_TYPE[rulePrefix];
+}
+
 /**
  * 同步联赛列表
  */
@@ -844,9 +857,10 @@ const getSolutions = async ({ win_min, with_events, mk=-1 }) => {
 /**
  * 获取中单方案并按照比赛分组
  */
-const getGamesSolutions = async ({ win_min, with_events, mk=-1 }) => {
+const getGamesSolutions = async ({ win_min, with_events, mk=-1, tp=0 }) => {
 
   const filterMarketType = +mk;
+  const filterDataType = +tp;
   const { minShowAmount } = getSetting();
   const solutionsList = Object.values(GAMES.Solutions);
   const gamesRelation = getGamesRelation({ listEvents: with_events });
@@ -861,17 +875,18 @@ const getGamesSolutions = async ({ win_min, with_events, mk=-1 }) => {
 
   const solutionsMap = {};
 
-  solutionsList.filter(item => {
-    const { sol: { win_average } } = item;
-    return win_average >= (win_min ?? minShowAmount);
-  }).forEach(item => {
+  solutionsList.forEach(item => {
     const { info: { id }, ...solution } = item;
-    const gameRelation = relationsMap.get(id);
-    if (!solutionsMap[id]) {
-      solutionsMap[id] = { ...gameRelation, solutions: [] };
+    const { rule, sol: { win_average } } = solution;
+    const ruleType = getRuleType(rule);
+    if ((filterDataType == 0 || filterDataType == ruleType) && win_average >= (win_min ?? minShowAmount)) {
+      const gameRelation = relationsMap.get(id);
+      if (!solutionsMap[id]) {
+        solutionsMap[id] = { ...gameRelation, solutions: [] };
+      }
+      solutionsMap[id].solutions.push(solution);
     }
-    solutionsMap[id].solutions.push(solution);
-  });
+  })
 
   const gamesSolutions = Object.values(solutionsMap)
   .filter(item => {

+ 3 - 2
server/routes/pstery.js

@@ -87,11 +87,12 @@ router.get('/get_solutions', (req, res) => {
 
 // 获取中单方案并按照比赛分组
 router.get('/get_games_solutions', (req, res) => {
-  const { win_min, with_events, mk } = req.query;
+  const { win_min, with_events, mk, tp } = req.query;
   Games.getGamesSolutions({
     win_min: win_min ? +win_min : undefined,
     with_events: with_events === 'true',
-    mk: mk ? +mk : -1
+    mk: mk ? +mk : -1,
+    tp: tp ? +tp : 0
   })
   .then(gamesSolutions => {
     res.sendSuccess(gamesSolutions);

+ 35 - 4
web/apps/web-antd/src/views/match/solutions/index.vue

@@ -19,6 +19,7 @@ const loopTimer = ref(null);
 const updateTimer = ref(null);
 const minProfitRate = ref(2);
 const marketType = ref(-1);
+const dataType = ref(0);
 const updateLoaderHide = ref(null);
 
 const totalProfitVisible = ref(false);
@@ -50,8 +51,9 @@ const getSolutions = async () => {
   try {
     const win_min = minProfitRate.value * 100;
     const mk = marketType.value;
+    const tp = dataType.value;
     const with_events = true;
-    const data = await requestClient.get('/pstery/get_games_solutions', { params: { win_min, mk, with_events } });
+    const data = await requestClient.get('/pstery/get_games_solutions', { params: { win_min, mk, tp, with_events } });
     return data;
   }
   catch (error) {
@@ -158,16 +160,31 @@ watch(marketType, (newVal) => {
   }, 1000);
 });
 
+watch(dataType, (newVal) => {
+  if (!updateLoaderHide.value) {
+    updateLoaderHide.value = message.loading('数据更新中...', 0);
+  }
+  clearTimeout(updateTimer.value);
+  updateTimer.value = setTimeout(() => {
+    setLocalStorage('dataType', newVal);
+    updateSolutions();
+  }, 1000);
+});
+
 onMounted(() => {
   loopActive.value = true;
   const min_win_rate = getLocalStorage('minProfitRate');
   const mk = getLocalStorage('marketType');
+  const tp = getLocalStorage('dataType');
   if (min_win_rate !== null) {
     minProfitRate.value = min_win_rate;
   }
   if (mk !== null) {
     marketType.value = mk;
   }
+  if (tp !== null) {
+    dataType.value = tp;
+  }
   setTimeout(() => {
     updateSolutions(true);
   }, 100);
@@ -186,7 +203,7 @@ onUnmounted(() => {
     <div class="contents-header transition-all duration-200" :style="headerStyle">
       <div class="solution-options">
         <Form layout="inline" class="sol-opt-container">
-          <Form.Item label="盘口类型" class="sol-opt-item">
+          <Form.Item label="比赛类型" class="sol-opt-item">
             <RadioGroup v-model:value="marketType">
               <Radio :value="-1">全部({{ markCount.all ?? 0 }})</Radio>
               <Radio :value="2">滚球({{ markCount.rollball ?? 0 }})</Radio>
@@ -194,6 +211,13 @@ onUnmounted(() => {
               <Radio :value="0">早盘({{ markCount.early ?? 0 }})</Radio>
             </RadioGroup>
           </Form.Item>
+          <Form.Item label="盘口类型" class="sol-opt-item">
+            <RadioGroup v-model:value="dataType">
+              <Radio :value="0">全部</Radio>
+              <Radio :value="1">让球</Radio>
+              <Radio :value="2">大小</Radio>
+            </RadioGroup>
+          </Form.Item>
           <Form.Item label="最小利润率(%)" class="sol-opt-item">
             <InputNumber style="width: 60px" size="small" max="100" min="-100" step="0.1" placeholder="最小利润率(%)" v-model:value="minProfitRate"/>
           </Form.Item>
@@ -245,11 +269,18 @@ onUnmounted(() => {
 
 .sol-opt-container {
   flex-grow: 1;
-  justify-content: space-between;
+  // justify-content: flex-end;
 }
 
-.sol-opt-item:last-child {
+.sol-opt-item {
   margin-inline-end: 0 !important;
+  &:nth-child(2) {
+    margin-inline-start: auto;
+  }
+  &:nth-child(n+3) {
+  padding-inline-start: 15px;
+  border-left: 1px solid hsl(var(--border));
+}
 }
 
 .solution-header {