Browse Source

增加 2-3 0-1 规则

flyzto 4 tháng trước cách đây
mục cha
commit
ee5b7104a4

+ 1 - 0
server/models/GamesPs.js

@@ -23,6 +23,7 @@ const PS_IOR_KEYS = [
   ['-2', 'ior_rh_25', 'ior_wmh_2', 'ior_rac_15'],
   ['+1', 'ior_rah_05', 'ior_wmc_1', 'ior_rc_15'],
   ['+2', 'ior_rah_15', 'ior_wmc_2', 'ior_rc_25'],
+  ['0-1', 'ior_ot_0', 'ior_os_0-1', 'ior_ot_1'],
   ['2-3', 'ior_ot_2', 'ior_os_2-3', 'ior_ot_3'],
 ];
 

+ 9 - 0
server/triangle/iorKeys.js

@@ -94,6 +94,12 @@ module.exports = {
 
     ['ior_ouc_25', 'ior_ouh_2', 'ior_ot_2', 'la_dr_wa'],
 
+    ['ior_os_0-1', 'ior_ouc_225', 'ior_ot_2', 'la_lh_wa'],
+
+    ['ior_os_0-1', 'ior_ouc_25', 'ior_ot_2', 'la_la_wa'],
+
+    ['ior_os_0-1', 'ior_ouc_2', 'ior_ot_2', 'la_dr_wa'],
+
     ['ior_ouh_25', 'ior_ouc_275', 'ior_ot_3', 'la_wh_wa'],
 
     ['ior_ouh_275', 'ior_ouc_3', 'ior_ot_3', 'lh_dr_wa'],
@@ -113,6 +119,9 @@ module.exports = {
     ['ior_ouc_35', 'ior_ouh_275', 'ior_ot_3', 'la_lh_wa'],
 
     ['ior_ouc_35', 'ior_ouh_25', 'ior_ot_3', 'la_la_wa'],
+
+    ['ior_os_0-1', 'ior_ouc_35', 'ior_os_2-3', 'la_la_wa'],
+
   ],
   // E: [
   //   ['ior_rh_05', 'ior_rac_05', '-', 'la_wa_rv'],

+ 13 - 9
server/triangle/trangleCalc.js

@@ -15,7 +15,7 @@ function getOptimalSelections(odds, rules) {
     hg: 1 + hgRebateRatio / 100,
   };
 
-  rules.forEach((rule, index) => {
+  rules.forEach((rule, ruleIndex) => {
     let validOptions = [];
 
     for (let i = 0; i < 3; i++) {
@@ -70,14 +70,18 @@ function getOptimalSelections(odds, rules) {
       }
     }
 
-    if (validOptions.length > 0) {
-      const iors = validOptions.reduce((a, b) => {
-        const sumA = a.reduce((sum, x) => sum + x.v, 0);
-        const sumB = b.reduce((sum, x) => sum + x.v, 0);
-        return sumA > sumB ? a : b;
-      });
-      results.push({ rule, iors, index });
-    }
+    validOptions.forEach(iors => {
+      results.push({ rule, iors, ruleIndex });
+    });
+
+    // if (validOptions.length > 0) {
+    //   const iors = validOptions.reduce((a, b) => {
+    //     const sumA = a.reduce((sum, x) => sum + x.v, 0);
+    //     const sumB = b.reduce((sum, x) => sum + x.v, 0);
+    //     return sumA > sumB ? a : b;
+    //   });
+    //   results.push({ rule, iors, ruleIndex });
+    // }
   });
 
   return results;

+ 13 - 2
web/apps/web-antd/src/views/match/solutions/index.vue

@@ -151,8 +151,14 @@ const calcTotalProfit = async () => {
 }
 
 const parseIorKey = (iorKey) => {
-  const [, type, accept, side, , ratioString] = iorKey.match(/^ior_(r|ou|m|wm|ot)(a?)(h|c|n)?(_(\d+))?$/);
-  const ratio = ratioString ? `${ratioString[0]}.${ratioString.slice(1)}` * (accept ? 1 : -1) : 0;
+  const [, type, accept, side, , ratioString] = iorKey.match(/^ior_(r|ou|m|wm|ot|os)(a?)(h|c|n)?(_([\d-]+))?$/);
+  let ratio = 0;
+  if (ratioString?.includes('-')) {
+    ratio = ratioString;
+  }
+  else if (ratioString) {
+    ratio = `${ratioString[0]}.${ratioString.slice(1)}` * (accept ? 1 : -1);
+  }
   return { type, side, ratio };
 }
 
@@ -163,6 +169,7 @@ const PS_IOR_KEYS = [
   ['-2', 'ior_rh_25', 'ior_wmh_2', 'ior_rac_15'],
   ['+1', 'ior_rah_05', 'ior_wmc_1', 'ior_rc_15'],
   ['+2', 'ior_rah_15', 'ior_wmc_2', 'ior_rc_25'],
+  ['0-1', 'ior_ot_0', 'ior_os_0-1', 'ior_ot_1'],
   ['2-3', 'ior_ot_2', 'ior_os_2-3', 'ior_ot_3'],
 ];
 
@@ -245,6 +252,10 @@ const formatEvents = (events, cprKeys) => {
         index = 2;
       }
     }
+    else if (type === 'os') {
+      ratioKey = ratio;
+      index = 1;
+    }
     if (typeof (ratioKey) == 'number') {
       if (ratioKey > 0) {
         ratioKey = `+${ratioKey}`;