彭俊 6 роки тому
батько
коміт
fd26acd5cc

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

@@ -31,7 +31,7 @@ class  MatchList extends Controller {
          $where_search = [];
         //查询今日赛事
          $match_model = $this->commonFunction->getModels($data['game_code'],1);
-         $where = $this->commonFunction->getState('StToday',$match_model['model_match']);
+         $where = $this->commonFunction->getState('StToday',$match_model['model_match'],$data['game_code']);
          $Orwhere = [];
          $data['info'][0]['name'] = '今日赛事';
          $data['info'][0]['code'] = 'today';
@@ -97,7 +97,7 @@ class  MatchList extends Controller {
          $data['info'][0]['code'] = 'all';
          $data['info'][0]['count'] = $this->getMatchCount($where,$Orwhere,$where_search,$data['game_code']);
          //今日赛事
-         $where = $this->commonFunction->getState('StToday',$st_competition);
+         $where = $this->commonFunction->getState('StToday',$st_competition,$typeGame);
          $Orwhere = [];
          $data['info'][1]['name'] = '今日赛事';
          $data['info'][1]['code'] = 'today';
@@ -142,7 +142,7 @@ class  MatchList extends Controller {
         switch ($code)
         {
         case $code == 'today':
-            $where =$this->commonFunction->getState('StToday',$st_competition);
+            $where =$this->commonFunction->getState('StToday',$st_competition,$game_code);
             //查询今日赛事
             $data  = $this->getMatchInfo($where,$Orwhere,$where_search,$game_code);
         break;
@@ -252,7 +252,7 @@ class  MatchList extends Controller {
                 $where=[[$st_competition.'.is_morningplate',1],
                 [$st_competition.'.match_date','>',date("Y-m-d",strtotime("+6 day"))]];
             }else if($date == 'today'){
-                $where  = $this->commonFunction->getState('StToday',$st_competition);
+                $where  = $this->commonFunction->getState('StToday',$st_competition,$gameType);
             }else {
                 $where[$st_competition.'.match_date'] = $date;
             }
@@ -407,7 +407,7 @@ class  MatchList extends Controller {
             foreach ($game as $key=>$type){
                 $matchModel = $this->commonFunction->getModels($type['game_code']);
                 //获取 不同状态的查询条件
-                $where = $this->commonFunction->getState($type_code,$matchModel['model_match']);
+                $where = $this->commonFunction->getState($type_code,$matchModel['model_match'],$type['game_code']);
                 if($type_code != 'StChampion'){
                     $matchNum = lm($matchModel['model_league'],"Sports")
                         ->join($matchModel['model_match'],$matchModel['model_match'].'.lg_id',$matchModel['model_league'].'.id')
@@ -612,7 +612,7 @@ where a.match_id = b.match_id and a.id = b.id ";
                     [$model_league.'.name_chinese','!=',''],
                 ];
                 if($oddsType !='home'){
-                   $getState =  $this->commonFunction->getState($oddsType,$model_match);
+                   $getState =  $this->commonFunction->getState($oddsType,$model_match,$game_code);
                 }else{
                     $getState = [];
                 }

+ 2 - 2
Application/Sports/Controller/MatchListWeb.php

@@ -91,7 +91,7 @@ class MatchListWeb extends Controller{
         foreach ($game as $k=>$v){
             if($v['game_code'] !='gj'){
                 $models = $this->commonFunction->getModels($v['game_code'],1);
-                $where = $this->commonFunction->getState($type,$models['model_match']);
+                $where = $this->commonFunction->getState($type,$models['model_match'],$game_code);
                 $matchData = lm($models['model_league'],"Sports")
                     ->join($models['model_match'],$models['model_match'].'.lg_id',$models['model_league'].'.id')
                     ->select($models['model_match'].'.id as match_id')
@@ -154,7 +154,7 @@ class MatchListWeb extends Controller{
     public function getMatchData($type,$game_code,$p_code='',$time='',$lg_ids=[],$search=''){
         //$p_code 获取具体玩法下的赛事数据
         $models = $this->commonFunction->getModels($game_code,1);
-        $where = $this->commonFunction->getState($type,$models['model_match']);
+        $where = $this->commonFunction->getState($type,$models['model_match'],$game_code);
 
         $select = [$models['model_match'].'.id as match_id',$models['model_match'].'.lg_id'];
         $timeWhere = [];

+ 8 - 8
Application/Sports/Controller/RollingBall.php

@@ -26,7 +26,7 @@ class RollingBall extends Controller{
         $model_match = $models['model_match'];
 
         //获取 滚球查询条件
-        $where = $this->commonFunction->getState('StRollBall',$model_match);
+        $where = $this->commonFunction->getState('StRollBall',$model_match,'zq');
 
         //统计联赛下的赛事及查询赛事
         $ret['game_code'] = 'zq';
@@ -56,7 +56,7 @@ class RollingBall extends Controller{
         $result_record = $models['model_result_record'];
 
         //获取 滚球查询条件
-        $where = $this->commonFunction->getState('StRollBall',$model_match);
+        $where = $this->commonFunction->getState('StRollBall',$model_match,'zq');
 
         $result =lm($model_match,"Sports")
             ->join($model_league,$model_league.'.id',$model_match.'.lg_id')
@@ -96,7 +96,7 @@ class RollingBall extends Controller{
         $model_match = $models['model_match'];
 
         //获取 滚球查询条件
-        $where = $this->commonFunction->getState('StRollBall',$model_match);
+        $where = $this->commonFunction->getState('StRollBall',$model_match,'lq');
 
         //统计联赛下的赛事及查询赛事
         $ret['game_code'] = 'lq';
@@ -123,7 +123,7 @@ class RollingBall extends Controller{
         $model_match = $models['model_match'];
         $model_league = $models['model_league'];
         //获取 滚球查询条件
-        $where = $this->commonFunction->getState('StRollBall',$model_match);
+        $where = $this->commonFunction->getState('StRollBall',$model_match,'lq');
         $result =lm($model_match,"Sports")
             ->join($model_league,$model_league.'.id',$model_match.'.lg_id')
             ->select($model_match.'.id as 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')
@@ -158,7 +158,7 @@ class RollingBall extends Controller{
         $model_match = $models['model_match'];
 
         //获取 滚球查询条件
-        $where = $this->commonFunction->getState('StRollBall',$model_match);
+        $where = $this->commonFunction->getState('StRollBall',$model_match,'wq');
 
         //统计联赛下的赛事及查询赛事
         $ret['game_code'] = 'wq';
@@ -185,7 +185,7 @@ class RollingBall extends Controller{
         $model_match = $models['model_match'];
         $model_league = $models['model_league'];
         //获取 滚球查询条件
-        $where = $this->commonFunction->getState('StRollBall',$model_match);
+        $where = $this->commonFunction->getState('StRollBall',$model_match,'wq');
         $result =lm($model_match,"Sports")
             ->join($model_league,$model_league.'.id',$model_match.'.lg_id')
             ->select($model_match.'.id as match_id',$model_match.'.tag','match_date as start_date',$model_match.'.match_time as start_time',$model_match.'.home_team as home_player_name',$model_match.'.guest_team as guest_player_name')
@@ -220,7 +220,7 @@ class RollingBall extends Controller{
         $model_match = $models['model_match'];
 
         //获取 滚球查询条件
-        $where = $this->commonFunction->getState('StRollBall',$model_match);
+        $where = $this->commonFunction->getState('StRollBall',$model_match,'bq');
 
         //统计联赛下的赛事及查询赛事
         $ret['game_code'] = 'bq';
@@ -247,7 +247,7 @@ class RollingBall extends Controller{
         $model_match = $models['model_match'];
         $model_league = $models['model_league'];
         //获取 滚球查询条件
-        $where = $this->commonFunction->getState('StRollBall',$model_match);
+        $where = $this->commonFunction->getState('StRollBall',$model_match,'bq');
 
         $result =lm($model_match,"Sports")
             ->join($model_league,$model_league.'.id',$model_match.'.lg_id')

+ 80 - 16
Biz/Common/CommonFunction.php

@@ -711,22 +711,55 @@ class CommonFunction {
     }
 
     /**
-     * @param $type_code
+     * @param $type_code 状态码
+     * @param $model_match 赛事表名
+     * @param $game_code 球类代码
      * @return array
      * @throws \Exception
      * 获取不同状态下的 查询条件
      */
-    function getState($type_code,$model_match = ''){
+    function getState($type_code,$model_match = '',$game_code){
         if($model_match == ''){
             switch ($type_code){
                 case 'StRollBall'://滚球 正在进行
-                    $where = [
-                        // ['is_rollball','=',1],
-                        ['status','<','2'],
-                        ['match_date','=',date("Y-m-d")],
-                        ['match_time','>',date("H:i:s", time()-(90*60))],
-                        ['match_time','<',date("H:i:s", time())]
-                    ];
+                    //追加不同球类的滚球时间
+                    if($game_code == 'zq'){
+                        $where = [
+                            // ['is_rollball','=',1],
+                            ['status','<','2'],
+                            ['match_date','=',date("Y-m-d")],
+                            ['match_time','>',date("H:i:s", time()-(90*60))],
+                            ['match_time','<',date("H:i:s", time())]
+                        ];
+                    }
+                    if($game_code == 'lq'){
+                        $where = [
+                            // ['is_rollball','=',1],
+                            ['status','<','2'],
+                            ['match_date','=',date("Y-m-d")],
+                            ['match_time','>',date("H:i:s", time()-(90*60))],
+                            ['match_time','<',date("H:i:s", time())]
+                        ];
+                    }
+                    if($game_code == 'wq'){
+                        $where = [
+                            // ['is_rollball','=',1],
+                            ['status','<','2'],
+                            ['match_date','=',date("Y-m-d")],
+                            ['match_time','>',date("H:i:s", time()-(300*60))],
+                            ['match_time','<',date("H:i:s", time())]
+                        ];
+                    }
+                    if($game_code == 'bq'){
+                        $where = [
+                            // ['is_rollball','=',1],
+                            ['status','<','2'],
+                            ['match_date','=',date("Y-m-d")],
+                            ['match_time','>',date("H:i:s", time()-(300*60))],
+                            ['match_time','<',date("H:i:s", time())]
+                        ];
+                    }
+                    
                     break;
                 case 'StSoon'://即将 今日两小时内开始
                     $where = [
@@ -788,13 +821,44 @@ class CommonFunction {
         }else{
             switch ($type_code){
                 case 'StRollBall'://滚球 正在进行
-                    $where = [
-                        // [$model_match.'.is_rollball','=',1],
-                        [$model_match.'.status','<','2'],
-                        [$model_match.'.match_date','=',date("Y-m-d")],
-                        [$model_match.'.match_time','>',date("H:i:s", time()-(90*60))],
-                        [$model_match.'.match_time','<',date("H:i:s", time())]  
-                    ];
+                    //追加不同球类的滚球时间
+                    if($game_code == 'zq'){
+                        $where = [
+                            // [$model_match.'.is_rollball','=',1],
+                            [$model_match.'.status','<','2'],
+                            [$model_match.'.match_date','=',date("Y-m-d")],
+                            [$model_match.'.match_time','>',date("H:i:s", time()-(90*60))],
+                            [$model_match.'.match_time','<',date("H:i:s", time())]  
+                        ];
+                    }
+                    if($game_code == 'lq'){
+                        $where = [
+                            // [$model_match.'.is_rollball','=',1],
+                            [$model_match.'.status','<','2'],
+                            [$model_match.'.match_date','=',date("Y-m-d")],
+                            [$model_match.'.match_time','>',date("H:i:s", time()-(90*60))],
+                            [$model_match.'.match_time','<',date("H:i:s", time())]  
+                        ];
+                    }
+                    if($game_code == 'wq'){
+                        $where = [
+                            // [$model_match.'.is_rollball','=',1],
+                            [$model_match.'.status','<','2'],
+                            [$model_match.'.match_date','=',date("Y-m-d")],
+                            [$model_match.'.match_time','>',date("H:i:s", time()-(300*60))],
+                            [$model_match.'.match_time','<',date("H:i:s", time())]  
+                        ];
+                    }
+                    if($game_code == 'bq'){
+                        $where = [
+                            // [$model_match.'.is_rollball','=',1],
+                            [$model_match.'.status','<','2'],
+                            [$model_match.'.match_date','=',date("Y-m-d")],
+                            [$model_match.'.match_time','>',date("H:i:s", time()-(300*60))],
+                            [$model_match.'.match_time','<',date("H:i:s", time())]  
+                        ];
+                    }
+                   
                     break;
                 case 'StSoon'://即将 今日两小时内开始
                     $where = [

+ 73 - 4
Biz/Match/GetOddsData.php

@@ -125,9 +125,28 @@ class GetOddsData {
             $odds = [];
             foreach ($oddsData as $kkk=>$vvv) {
                 if ($vv['match_id'] == $vvv['match_id'] and $vvv['sort']==0) {
-                    $odds[] = $vvv;
+                    if($vvv['odds_code'] == 'concede_guest'){
+                        $concede_g = $vvv;
+                    }
+                    if($vvv['odds_code'] == 'concede_home'){
+                        $concede_h = $vvv;
+                    }
+                    if($vvv['odds_code'] == 'goal_size_big'){
+                        $size_s = $vvv;
+                    }
+                    if($vvv['odds_code'] == 'goal_size_small'){
+                        $size_b = $vvv;
+                    }
                 }
             }
+            $concede_size = [$concede_g,$concede_h,$size_s,$size_b];
+            foreach ($concede_size as $key => $vaule){
+                if($vaule == null) unset($concede_size[$key]);
+            }
+
+          
+            sort($concede_size);
+            $odds = $concede_size;
             $matchData[$kk]['oddsData'] = $odds;
         }
 
@@ -174,9 +193,28 @@ class GetOddsData {
             $odds = [];
             foreach ($oddsData as $kkk=>$vvv) {
                 if ($vv['match_id'] == $vvv['match_id'] and $vvv['sort']==0) {
-                    $odds[] = $vvv;
+                    if($vvv['odds_code'] == 'concede_guest'){
+                        $concede_g = $vvv;
+                    }
+                    if($vvv['odds_code'] == 'concede_home'){
+                        $concede_h = $vvv;
+                    }
+                    if($vvv['odds_code'] == 'total_size_big'){
+                        $size_s = $vvv;
+                    }
+                    if($vvv['odds_code'] == 'total_size_small'){
+                        $size_b = $vvv;
+                    }
                 }
             }
+            $concede_size = [$concede_g,$concede_h,$size_s,$size_b];
+            foreach ($concede_size as $key => $vaule){
+                if($vaule == null) unset($concede_size[$key]);
+            }
+
+          
+            sort($concede_size);
+            $odds = $concede_size;
             $matchData[$kk]['oddsData'] = $odds;
         }
 
@@ -223,9 +261,28 @@ class GetOddsData {
             $odds = [];
             foreach ($oddsData as $kkk=>$vvv) {
                 if ($vv['match_id'] == $vvv['match_id'] and $vvv['sort']==0) {
-                    $odds[] = $vvv;
+                    if($vvv['odds_code'] == 'dishes_home'){
+                        $concede_g = $vvv;
+                    }
+                    if($vvv['odds_code'] == 'dishes_guest'){
+                        $concede_h = $vvv;
+                    }
+                    if($vvv['odds_code'] == 'kemp_home'){
+                        $size_s = $vvv;
+                    }
+                    if($vvv['odds_code'] == 'kemp_guest'){
+                        $size_b = $vvv;
+                    }
                 }
             }
+            $concede_size = [$concede_g,$concede_h,$size_s,$size_b];
+            foreach ($concede_size as $key => $vaule){
+                if($vaule == null) unset($concede_size[$key]);
+            }
+
+          
+            sort($concede_size);
+            $odds = $concede_size;
             $matchData[$kk]['oddsData'] = $odds;
         }
         return $matchData;
@@ -265,9 +322,21 @@ class GetOddsData {
             $odds = [];
             foreach ($oddsData as $kkk=>$vvv) {
                 if ($vv['match_id'] == $vvv['match_id'] and $vvv['sort']==0) {
-                    $odds[] = $vvv;
+                    if($vvv['odds_code'] == 'capot_home'){
+                        $concede_g = $vvv;
+                    }
+                    if($vvv['odds_code'] == 'capot_guest'){
+                        $concede_h = $vvv;
+                    }
                 }
             }
+            $concede_size = [$concede_g,$concede_h];
+            foreach ($concede_size as $key => $vaule){
+                if($vaule == null) unset($concede_size[$key]);
+            }
+
+            sort($concede_size);
+            $odds = $concede_size;
             $matchData[$kk]['oddsData'] = $odds;
         }
         return $matchData;