vali 6 лет назад
Родитель
Сommit
33cae033b1
2 измененных файлов с 46 добавлено и 8 удалено
  1. 34 6
      app/Logic/WinfailLogic.php
  2. 12 2
      datainf/logic/HttpServerSettelement.php

+ 34 - 6
app/Logic/WinfailLogic.php

@@ -132,6 +132,18 @@ class WinfailLogic
         return $model;
     }
 
+    //冠军比赛结果
+    public function getGjDatasV2($game_code, $lg_id)
+    {
+        $table = 'st_' . $game_code . '_league_result';
+        $where = ['lg_id' => $lg_id, 'game_name' => $game_code];
+        $model = DB::table($table)->where($where)->first();
+        if (empty($model)) {
+            return false;
+        }
+        return $model;
+    }
+
 
     public function getOddsTypeData($game_code, $match_id)
     {
@@ -222,7 +234,7 @@ class WinfailLogic
 
 
     //对单式订单   单个更改过比赛结果的订单进行输赢判断  $orderInfoArray一维数组  $matchArray二维数组
-    public function WinFailOneOrder($orderInfo, $matchArray, $result)
+    public function WinFailOneOrder($orderInfo, $matchArray, $is_champion)
     {
         $game_code = $orderInfo->game_code;
         $match_id = $orderInfo->match_id;
@@ -232,13 +244,29 @@ class WinfailLogic
         $RefClass = new  \ReflectionClass($AdapterObj);
 
         $result = json_decode($orderInfo->single_result);
-        $result['0']->first_score = json_encode($result['0']->first_score, 256);
-        $result['0']->corner_ball = json_encode($result['0']->corner_ball, 256);
-        $result['0']->penalty_card = json_encode($result['0']->penalty_card, 256);
-        $result['0']->warn_more = json_encode($result['0']->warn_more, 256);
+        if ($is_champion == 0) {
+            //还原回原来的类型,以兼容之前的处理
+            switch (strtolower($orderInfo->game_code)) {
+                case 'zq':
+                    $result['0']->first_score = json_encode($result['0']->first_score, 256);
+                    $result['0']->corner_ball = json_encode($result['0']->corner_ball, 256);
+                    $result['0']->penalty_card = json_encode($result['0']->penalty_card, 256);
+                    break;
+                case 'lq':
+                    $result['0']->home_score = json_encode($result['0']->home_score, 256);
+                    $result['0']->guest_score = json_encode($result['0']->guest_score, 256);
+                    break;
+                case 'wq':
+                    $result['0']->inning = json_encode($result['0']->inning, 256);
+                    break;
+                case 'bq':
+                    $result['0']->match_score_t = json_encode($result['0']->match_score_t, 256);
+                    break;
+            }
+            $result['0']->warn_more = json_encode($result['0']->warn_more, 256);
+        }
 
         $winorfalsedef = ['result' => 2, 'matchResult' => 'noRuleOrError'];
-
         foreach ($matchArray as $matchModel) {
             $fun1 = $matchModel->odds_code;
             $fun2 = $matchModel->p_code;

+ 12 - 2
datainf/logic/HttpServerSettelement.php

@@ -182,7 +182,17 @@ class HttpServerSettelement
             return;
         }
         $logic_obj = new WinfailLogic();
-        $result = $logic_obj->getCompResult($orderInfo->game_code, $orderInfo->match_id);
+
+        $result = [];
+        if ($orderInfo->is_champion == 0) {
+            $result = $logic_obj->getCompResult($orderInfo->game_code, $orderInfo->match_id);
+        } else {
+            $resulttmp = $logic_obj->getGjDatasV2($orderInfo->game_code, $orderInfo->lg_id);
+            if ($resulttmp) {
+                $result['0'] = $resulttmp;
+            }
+        }
+
         if (count($result) <= 0) {
             $data = Response::generate('', 10, $paras, 'result empty');
             $response->end($data);
@@ -190,7 +200,7 @@ class HttpServerSettelement
         }
 
         try {
-            $logic_obj->WinFailOneOrder($orderInfo, $match_datas, $result['0']);
+            $logic_obj->WinFailOneOrder($orderInfo, $match_datas, $orderInfo->is_champion);
             $data = Response::generate('', 1, ['cost' => (microtime(true) - $request->server['request_time_float'])], 'succes ');
         } catch (\Exception $e) {
             $data = Response::generate('', 10, '', $e->getMessage() . '--' . $e->getFile() . '--' . $e->getLine());