Ver código fonte

头部状态统计接口调整

彭俊 6 anos atrás
pai
commit
e1ba005397

+ 6 - 5
Application/Sports/Controller/Head.php

@@ -10,6 +10,8 @@ use App\Sports\Model\St_zq_odds as ZQoddsModel;
 use App\Sports\Model\St_lq_odds as LQoddsModel;
 use App\Sports\Model\St_wq_odds as WQoddsModel;
 use App\Sports\Model\St_bq_odds as BQoddsModel;
+use App\Sports\Model\St_zq_league as leagueModel;
+
 
 /**
  * Class Head
@@ -40,11 +42,10 @@ class Head extends Controller{
         $where = [
             ['status','<','2']
         ];
-        $select = ['id','match_id','status','match_date','match_time','us_time','is_morningplate','is_stringscene'];
-        $ZQmatchData = ZQmatchModel::getMatchData($where,$select)->toarray();
-        $LQmatchData = LQmatchModel::getMatchData($where,$select)->toarray();
-        $WQmatchData = WQmatchModel::getMatchData($where,$select)->toarray();
-        $BQmatchData = BQmatchModel::getMatchData($where,$select)->toarray();
+        $ZQmatchData = leagueModel::getLeagueMatchData($this->commonFunction->getModels('zq'),$where);
+        $LQmatchData = leagueModel::getLeagueMatchData($this->commonFunction->getModels('lq'),$where);
+        $WQmatchData = leagueModel::getLeagueMatchData($this->commonFunction->getModels('wq'),$where);
+        $BQmatchData = leagueModel::getLeagueMatchData($this->commonFunction->getModels('bq'),$where);
         //合并所有球类赛事
         $matchAll = array_merge_recursive($ZQmatchData,$LQmatchData,$WQmatchData,$BQmatchData);
 

+ 12 - 3
Application/Sports/Controller/RollingBall.php

@@ -24,14 +24,17 @@ class RollingBall extends Controller{
 
         $model_result = $models['model_result'];
         $model_match = $models['model_match'];
+        $model_league = $models['model_league'];
 
         //获取 滚球查询条件
         $where = $this->commonFunction->getState('StRollBall',$model_match);
 
         $result =lm($model_match,"Sports")
             ->join($model_result,$model_result.'.match_id',$model_match.'.match_id')
+            ->join($model_league,$model_league.'.lg_id',$model_match.'.lg_id')
             ->select($model_match.'.match_id',$model_match.'.tag','match_date as start_date',$model_match.'.match_time as start_time',$model_match.'.home_team',$model_match.'.guest_team','home_score','guest_score',$model_result.'.match_time','match_process')
             ->where($model_match.'.source',$this->source['source'])
+            ->where([[$model_league.'.name_chinese','!=','']])
             ->where($where)
             ->get()
             ->toarray();
@@ -56,14 +59,16 @@ class RollingBall extends Controller{
 
         $model_result = $models['model_result'];
         $model_match = $models['model_match'];
-
+        $model_league = $models['model_league'];
         //获取 滚球查询条件
         $where = $this->commonFunction->getState('StRollBall',$model_match);
         $result =lm($model_match,"Sports")
             ->join($model_result,$model_result.'.match_id',$model_match.'.match_id')
+            ->join($model_league,$model_league.'.lg_id',$model_match.'.lg_id')
             ->select($model_match.'.match_id',$model_match.'.tag','match_date as start_date',$model_match.'.match_time as start_time',$model_match.'.home_team',$model_match.'.guest_team','home_score','guest_score',$model_result.'.match_time','match_process')
             ->where($model_match.'.source',$this->source['source'])
             ->where($where)
+            ->where([[$model_league.'.name_chinese','!=','']])
             ->get()
             ->toarray();
 
@@ -81,14 +86,16 @@ class RollingBall extends Controller{
 
         $model_result = $models['model_result'];
         $model_match = $models['model_match'];
-
+        $model_league = $models['model_league'];
         //获取 滚球查询条件
         $where = $this->commonFunction->getState('StRollBall',$model_match);
         $result =lm($model_match,"Sports")
             ->join($model_result,$model_result.'.match_id',$model_match.'.match_id')
+            ->join($model_league,$model_league.'.lg_id',$model_match.'.lg_id')
             ->select($model_match.'.match_id',$model_match.'.tag','match_date as start_date',$model_match.'.match_time as start_time','home_player_name','guest_player_name','first_inning_score','second_inning_score','third_inning_score',$model_result.'.match_time','match_process')
             ->where($model_match.'.source',$this->source['source'])
             ->where($where)
+            ->where([[$model_league.'.name_chinese','!=','']])
             ->get()
             ->toarray();
 
@@ -106,14 +113,16 @@ class RollingBall extends Controller{
 
         $model_result = $models['model_result'];
         $model_match = $models['model_match'];
-
+        $model_league = $models['model_league'];
         //获取 滚球查询条件
         $where = $this->commonFunction->getState('StRollBall',$model_match);
         $result =lm($model_match,"Sports")
             ->join($model_result,$model_result.'.match_id',$model_match.'.match_id')
+            ->join($model_league,$model_league.'.lg_id',$model_match.'.lg_id')
             ->select($model_match.'.match_id',$model_match.'.tag','match_date as start_date',$model_match.'.match_time as start_time',$model_match.'.home_team',$model_match.'.guest_team','home_score','guest_score',$model_result.'.match_time','match_process')
             ->where($model_match.'.source',$this->source['source'])
             ->where($where)
+            ->where([[$model_league.'.name_chinese','!=','']])
             ->get()
             ->toarray();
 

+ 17 - 0
Application/Sports/Model/St_zq_league.php

@@ -63,4 +63,21 @@ class St_zq_league extends Model
 
         return $data;
     }
+
+    //获取非滚球 联赛下赛事数据 用于统计数量
+    public static function getLeagueMatchData($models,$where){
+        $model_match = $models['model_match'];
+        $model_league = $models['model_league'];
+        $model_result = $models['model_result'];
+        //当前状态下所有联赛
+        $data = lm($model_league,"Sports")
+            ->join($model_match,$model_match.'.lg_id',$model_league.'.lg_id')
+            ->select($model_league.'.lg_id',$model_league.'.name_chinese as leagueName',$model_match.'.id',$model_match.'.match_id',$model_match.'.status',$model_match.'.match_date',$model_match.'.match_time',$model_match.'.us_time',$model_match.'.is_morningplate',$model_match.'.is_stringscene')
+            ->where([[$model_league.'.name_chinese','!=','']])
+            ->where($where)
+            ->get()
+            ->toarray();
+
+        return $data;
+    }
 }