vali 6 жил өмнө
parent
commit
c83c82e75a

+ 44 - 25
app/Lib/Settlement/Adapter/BqRule.php

@@ -12,7 +12,9 @@ class BqRule
 {
     use RulePlus;
 
-    public function concede($model, $resultModels, $resultRecords)
+
+    //让球
+    public function CO($model, $resultModels, $resultRecords)
     {
         $stand_Datas = $this->bq_scoreDatas($resultModels);
         $odds_code = $model->odds_code;
@@ -24,26 +26,27 @@ class BqRule
         $condition = $model->condition;
 
         switch ($odds_code) {
-            case 'concede_home':
+            case 'coh':
                 $return = $this->zq_letball($home - $guest, $condition, $home . '-' . $guest . '(全场)');
                 break;
-            case 'concede_guest':
+            case 'cog':
                 $return = $this->zq_letball($guest - $home, $condition, $home . '-' . $guest . '(全场)');
                 break;
-            case 'five_concede_guest':
+            case 'cog_5':
                 $return = $this->zq_letball($home_half - $guest_half, $condition, $home_half . '-' . $guest_half . '(半场)');
                 break;
-            case 'five_concede_home':
+            case 'coh_5':
                 $return = $this->zq_letball($home_half - $guest_half, $condition, $home_half . '-' . $guest_half . '(半场)');
                 break;
             default:
-                $return = $this->return_error;
+                $return = $this->return_he;
                 break;
         }
         return $return;
     }
 
-    public function total_size($model, $resultModels, $resultRecords)
+    //总得分大小
+    public function TN($model, $resultModels, $resultRecords)
     {
         $stand_Datas = $this->bq_scoreDatas($resultModels);
         $odds_code = $model->odds_code;
@@ -55,26 +58,28 @@ class BqRule
         $condition = $model->condition;
 
         switch ($odds_code) {
-            case 'total_size_big':
+            case 'tnb':
                 $return = $this->zq_inball_bigsmall($home + $guest, $condition, 2, $home . '-' . $guest . '(全场)');
                 break;
-            case 'total_size_small':
+            case 'tns':
                 $return = $this->zq_inball_bigsmall($home + $guest, $condition, 1, $home . '-' . $guest . '(全场)');
                 break;
-            case 'five_total_size_big':
+            case 'tnb_5':
                 $return = $this->zq_inball_bigsmall($home_half + $guest_half, $condition, 2, $home_half . '-' . $guest_half . '(半场)');
                 break;
-            case 'five_total_size_small':
+            case 'tns_5':
                 $return = $this->zq_inball_bigsmall($home_half + $guest_half, $condition, 1, $home_half . '-' . $guest_half . '(半场)');
                 break;
             default:
-                $return = $this->return_error;
+                $return = $this->return_he;
                 break;
         }
         return $return;
     }
 
-    public function two_sides($model, $resultModels, $resultRecords)
+
+    //单双
+    public function TS($model, $resultModels, $resultRecords)
     {
         $stand_Datas = $this->bq_scoreDatas($resultModels);
         $odds_code = $model->odds_code;
@@ -84,21 +89,23 @@ class BqRule
         $condition = $model->condition;
 
         switch ($odds_code) {
-            case 'two_sides_single':
+            case 'tss':
                 $return = $this->zq_doublesing($home + $guest, $condition, $home . '-' . $guest . '(全场)');
                 break;
-            case 'two_sides_double':
+            case 'tsd':
                 $return = $this->zq_doublesing($home + $guest, $condition, $home . '-' . $guest . '(全场)');
                 break;
             default:
-                $return = $this->return_error;
+                $return = $this->return_he;
                 break;
         }
         return $return;
 
     }
 
-    public function capot($model, $resultModels, $resultRecords)
+
+    //独赢
+    public function C($model, $resultModels, $resultRecords)
     {
         $stand_Datas = $this->bq_scoreDatas($resultModels);
         $odds_code = $model->odds_code;
@@ -108,7 +115,7 @@ class BqRule
 
 
         switch ($odds_code) {
-            case 'capot_home':
+            case 'ch':
                 if ($home > $guest) {
                     $return['result'] = 1;
                 } else {
@@ -117,7 +124,7 @@ class BqRule
                 $return['matchResult'] = $home . '-' . $guest . '(全场)';
 
                 break;
-            case 'capot_guest':
+            case 'cg':
                 if ($guest > $home) {
                     $return['result'] = 1;
                 } else {
@@ -136,14 +143,26 @@ class BqRule
     //棒球 type ==1 返回第$sn节   ==2返回上下节,sn=1上半场,sn=2下半场    type==4全部按节数的数组
     public function bq_getResultBySn($recoreModesArray, $type = 4, $sn = 1)
     {
+        if (!isset($recoreModesArray['0']) || empty($recoreModesArray['0'])) {
+            throw new  \Exception("网球结果不能为空");
+            return;
+        }
+        $RecoedModel = $recoreModesArray['0'];
+
+        $imatch_id = $RecoedModel->match_id;
+        $all_datas = json_decode($RecoedModel->match_score_t, true);
+
         $return = [];
-        foreach ($recoreModesArray as $key => $val) {
-            $nowsn = intval($val->match_process);
-            $return[$nowsn] = $val;
+        foreach ($all_datas as $key => $val) {
+            $tt = clone $RecoedModel;
+            $tmpobj = json_decode(json_encode($tt, 256), true);
+            $tmpobj['home_score'] = $all_datas[$key]['home'];
+            $tmpobj['guest_score'] = $all_datas[$key]['guest'];
+            $return[$key] = json_decode(json_encode($tmpobj, 256));
         }
 
-        if (count($return)!=9 || !empty(array_diff([1,2,3,4,5,6,7,8,9],array_keys($return)))){
-            throw new  \Exception("棒球球结果不为9的数组,或match_process有错");
+        if (count($return) != 10 || !empty(array_diff([1, 2, 3, 4, 5, 6, 7, 8, 9, 'other'], array_keys($return)))) {
+            throw new  \Exception("棒球球结果不为10的数组,或match_process有错");
         }
 
         if ($type == 4) {
@@ -188,7 +207,7 @@ class BqRule
             $return['all']['home'] += $tmp_home;
             $return['all']['guest'] += $tmp_guest;
 
-            if (in_array($key,[1,2,3,4,5])) {
+            if (in_array($key, [1, 2, 3, 4, 5])) {
                 $return['half']['home'] += $tmp_home;
                 $return['half']['guest'] += $tmp_guest;
             } else {

+ 1 - 1
app/Lib/Settlement/Adapter/RulePlus.php

@@ -6,7 +6,7 @@ namespace App\Lib\Settlement\Adapter;
 trait RulePlus
 {
 
-    public $return_he = ['result' => '2', 'matchResult' => '无规则和'];
+    public $return_he = ['result' => '2', 'matchResult' => 'error无规则和'];
     public $return_fail = ['result' => '-1', 'matchResult' => ''];
     public $return_error = ['result' => '100', 'matchResult' => '无胜负判断规则'];