Your Name 4 年之前
父節點
當前提交
8153cb0859
共有 1 個檔案被更改,包括 10 行新增10 行删除
  1. 10
    10
      src/util/FootballPrice.js

+ 10
- 10
src/util/FootballPrice.js 查看文件

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