소스 검색

调整实时赛事数据

彭俊 6 년 전
부모
커밋
4a0a7708da
1개의 변경된 파일45개의 추가작업 그리고 6개의 파일을 삭제
  1. 45 6
      Application/Sports/Controller/MatchList.php

+ 45 - 6
Application/Sports/Controller/MatchList.php

@@ -519,14 +519,52 @@ class  MatchList extends Controller {
 
             $matchData->ptime = '';//赛事进行时间
             $matchData->match_score = '';//赛事比分
+            $matchData->result_mark = '';//赛事实时数据json
             //如果该赛事正在进行,则获取进行时间
             if($matchData->status ==1){
-                $result = lm($model_result, 'Sports')->select('match_id','match_time','match_score')
-                    ->where($this->source)
-                    ->where(['match_id'=>$matchData->match_id])
-                    ->first();
-                $matchData->ptime = $result->match_time;
-                $matchData->match_score = $result->match_score;
+//                $result = lm($model_result, 'Sports')->select('match_id','match_time','match_score')
+//                    ->where($this->source)
+//                    ->where(['match_id'=>$matchData->match_id])
+//                    ->first();
+//                $matchData->ptime = $result->match_time;
+//                $matchData->match_score = $result->match_score;
+                $result_record = $models['model_result_record'];
+                $match_id = $matchData->match_id;
+                //如果是棒球
+                if($result_record == 'st_bq_result_record'){
+                    $sql = "select a.match_id,a.home_score,a.guest_score,a.match_time as a_time,a.match_process,a.result_mark from $result_record a,
+(select match_id,max(id) id from $result_record where match_id = $match_id group by match_id)b
+where a.match_id = b.match_id and a.id = b.id ";
+
+                    //查询 赛事结果记录最新的一条
+                    $match_result_record = S ('DB')->select ($sql);
+                    $matchData->match_score = $match_result_record[0]->home_score.'-'.$match_result_record[0]->guest_score;
+                    $matchData->result_mark = $match_result_record[0]->result_mark;
+                }
+
+                //如果是网球
+                else if($result_record == 'st_wq_result_record'){
+                    $sql = "select a.match_id,a.home_player_score,a.guest_player_score,a.match_time as a_time,a.match_process,a.result_mark from $result_record a,
+(select match_id,max(id) id from $result_record where match_id =$match_id group by match_id)b
+where a.match_id = b.match_id and a.id = b.id ";
+
+                    //查询 赛事结果记录最新的一条
+                    $match_result_record = S ('DB')->select ($sql);
+                    $matchData->match_score = $match_result_record[0]->home_player_score.'-'.$match_result_record[0]->guest_player_score;
+                    $matchData->result_mark = $match_result_record[0]->result_mark;
+
+                }else{
+                    $sql = "select a.match_id,a.home_score,a.guest_score,a.match_time as a_time,a.match_process from $result_record a,
+(select match_id,max(id) id from $result_record where match_id = $match_id group by match_id)b
+where a.match_id = b.match_id and a.id = b.id ";
+
+                    //查询 赛事结果记录最新的一条
+                    $match_result_record = S ('DB')->select ($sql);
+                    $matchData->match_score = $match_result_record[0]->home_score.'-'.$match_result_record[0]->guest_score;
+                    $matchData->result_mark = '';
+                }
+
+                $matchData->ptime = $match_result_record[0]->a_time;
 
             }
 
@@ -587,6 +625,7 @@ class  MatchList extends Controller {
                 'match_ptime'=>$matchData->ptime,
                 'match_score'=>$matchData->match_score,
                 'p_code_array'=> $p_code_array,
+                'result_mark'=>$matchData->result_mark,
                 'oddsData'=>$oddsData,
                 'league' => $league,
             ];