Explorar o código

修改页面接口异常

彭俊 %!s(int64=6) %!d(string=hai) anos
pai
achega
f74470e5e3
Modificáronse 2 ficheiros con 15 adicións e 4 borrados
  1. 13 4
      Application/Sports/Controller/Sports.php
  2. 2 0
      Biz/Match/GetmatchData.php

+ 13 - 4
Application/Sports/Controller/Sports.php

@@ -34,8 +34,9 @@ class Sports extends Controller{
             $data['all']['name'] ='今日赛事';
             $data['all']['game_code'] = $game_code;
             $data['all']['code'] = 'today';
-            $data['all']['count'] = lm($st_competition,'Sports')
+            $matchData = lm($st_competition,'Sports')
                 ->join($st_league,$st_league.'.id',$st_competition.'.lg_id')
+                ->select($st_competition.'.id as match_id')
                 ->where(getState('StToday',$st_competition))
                 ->where([
                     [$st_competition.'.home_team','<>',null],
@@ -44,13 +45,16 @@ class Sports extends Controller{
                     [$st_competition.'.status','<',2],
                     [$st_competition.'.us_time','>',$this->commonFunction->qgmdate('Y-m-d H:i:s', '', -4)]
                 ])
-                ->count('*');
+                ->get()
+                ->toArray();
+                // ->count('*');
             } else {
                 $data['all']['name'] = '所有赛事';
                 $data['all']['game_code'] = $game_code;
                 $data['all']['code'] = 'all';
-                $data['all']['count'] = lm($st_competition,'Sports')
+                $matchData = lm($st_competition,'Sports')
                     ->join($st_league,$st_league.'.id',$st_competition.'.lg_id')
+                    ->select($st_competition.'.id as match_id')
                     ->where([[$st_competition.'.status', '<', '2']])
                     ->where([
                         [$st_competition.'.home_team','<>',null],
@@ -60,8 +64,13 @@ class Sports extends Controller{
                         [$st_competition.'.us_time','>',$this->commonFunction->qgmdate('Y-m-d H:i:s', '', -4)]
                     ])
                     ->where($st_competition.'.us_time','>',$this->commonFunction->qgmdate('Y-m-d H:i:s', '', -4))
-                    ->count('*');
+                    ->get()
+                    ->toArray();
+                    // ->count('*');
             }
+            //===获取当前赛事是否有赔率,如果没有则去除===
+            $matchData = $this->commonFunction->Handle_Odds_Null($matchData,$getModels);
+            $data['all']['count'] = count($matchData);
         //查询正在进行的和未开始的球类比赛
         $data['match'] = lm($st_competition,"Sports")
             ->join($st_league,$st_league.'.id',$st_competition.'.lg_id')

+ 2 - 0
Biz/Match/GetmatchData.php

@@ -748,6 +748,8 @@ class GetmatchData {
                     ->where($where)
                     ->orderBy('match_time','asc')
                     ->get()->toArray();
+                //===获取当前赛事是否有赔率,如果没有则去除===
+                $matchData = $this->commonFunction->Handle_Odds_Null($matchData,$model);
                 $matchNum = count($matchData);
 
                 $matchData = array_slice($matchData,0,6);