Your Name преди 4 години
родител
ревизия
8153cb0859
променени са 1 файла, в които са добавени 10 реда и са изтрити 10 реда
  1. 10
    10
      src/util/FootballPrice.js

+ 10
- 10
src/util/FootballPrice.js Целия файл

@@ -15,14 +15,13 @@ const playWayFunc = {
15 15
 }
16 16
 
17 17
 // 遍历模拟比赛获取最大, 最小奖金
18
-// rq 让球数
19
-export function GetPrice (allParts, rq) {
18
+export function GetPrice (allParts) {
20 19
   let minPrice
21 20
   let maxPrice
22 21
 
23 22
   // 遍历模拟比赛的各种可能
24 23
   matches.forEach(match => {
25
-    const [min, max] = GetMinAndMax(allParts, match, rq)
24
+    const [min, max] = GetMinAndMax(allParts, match)
26 25
     if (min < minPrice || minPrice === undefined) {
27 26
       minPrice = min
28 27
     }
@@ -35,7 +34,7 @@ export function GetPrice (allParts, rq) {
35 34
   return [minPrice, maxPrice]
36 35
 }
37 36
 
38
-function GetMinAndMax (allParts, match, rq) {
37
+function GetMinAndMax (allParts, match) {
39 38
   let minPrice = 0
40 39
   let maxPrice = 0
41 40
 
@@ -45,9 +44,10 @@ function GetMinAndMax (allParts, match, rq) {
45 44
     const price = parts.map(part => {
46 45
       // 场次组合 比如 2串1
47 46
       return part.map(grp => {
48
-        const { wayCode } = grp.rules
47
+        const { detail, spreadPoints } = grp
48
+        const { wayCode } = detail
49 49
         const fn = playWayFunc[wayCode]
50
-        return fn(grp, match, rq)
50
+        return fn(grp, match, spreadPoints)
51 51
       }).filter(Boolean).reduce((acc, x) => acc * x, 1)
52 52
     }).reduce((acc, x) => acc + x, 0)
53 53
 
@@ -79,7 +79,7 @@ function computeWDL (part, match, rq) {
79 79
 // 让球胜平负
80 80
 function computeWDLS (part, match, rq) {
81 81
   const [x, y] = match
82
-  const { ruleCode, odds } = part.rules
82
+  const { ruleCode, odds } = part.detail
83 83
 
84 84
   switch (ruleCode) {
85 85
     case 'ft-sp-win':
@@ -94,7 +94,7 @@ function computeWDLS (part, match, rq) {
94 94
 // 比分
95 95
 function computeScore (part, match, rq) {
96 96
   const [x, y] = match
97
-  const { ruleCode, odds } = part.rules
97
+  const { ruleCode, odds } = part.detail
98 98
 
99 99
   switch (ruleCode) {
100 100
     case 'ft-w10':
@@ -165,7 +165,7 @@ function computeScore (part, match, rq) {
165 165
 // 进球数
166 166
 function computePoints (part, match, rq) {
167 167
   const [x, y] = match
168
-  const { ruleCode, odds } = part.rules
168
+  const { ruleCode, odds } = part.detail
169 169
 
170 170
   switch (ruleCode) {
171 171
     case 'ft-p0':
@@ -190,7 +190,7 @@ function computePoints (part, match, rq) {
190 190
 // 半全场
191 191
 function computeDouble (part, match, rq) {
192 192
   const [x, y] = match
193
-  const { ruleCode, odds } = part.rules
193
+  const { ruleCode, odds } = part.detail
194 194
 
195 195
   switch (ruleCode) {
196 196
     case 'ft-ww':