浏览代码

新增更新 7/2

彭俊 6 年之前
父节点
当前提交
1190192bbe

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

@@ -494,11 +494,10 @@ class  MatchList extends Controller {
             $model_league = $models['model_league'];
             $model_result = $models['model_result'];
 
-
-            //取消按状态查询赔率数据
             $oddsData = lm($model_odds, 'Sports')
                 ->select('sort','p_code','id','odds_only','odds_code',$model_odds.'.status','odds','condition','sort','source','utime')
                 ->where([$model_odds.'.match_id'=>$matchID,$model_odds.'.type'=>0])
+                ->where(['status'=>0])
                 ->orderBy('sort', 'desc')
                 ->orderBy('p_code','desc')
                 ->orderBy('odds_code','desc')
@@ -734,6 +733,7 @@ where a.match_id = b.match_id and a.id = b.id ";
                 ->join($model_odds,$model_odds.'.match_id',$model_match.'.id')
                 ->select($model_match.'.id as match_id',$model_match.'.match_date',$model_match.'.home_team',$model_match.'.guest_team',$model_odds.'.id as odds_id',$model_odds.'.p_code',$model_odds.'.odds_code',$model_odds.'.condition',$model_odds.'.odds',$model_odds.'.odds_only',$model_odds.'.status',$model_odds.'.sort')
                 ->where($model_odds.'.type',0)
+                ->where([$model_odds.'.status'=>0])
                 ->where($where)
                 ->get()->toArray();
 

+ 8 - 28
Application/Sports/Controller/MatchListWeb.php

@@ -280,7 +280,8 @@ where a.match_id = b.match_id and a.id = b.id ";
         $match_odds = [];
         //如果是冠军盘口
         if($p_code == 'kemp'){
-            $matchData = $this->uniquArr($matchData,'lg_id');
+            //二维数组去重
+            $matchData =  $this->commonFunction->array_unset_tt($matchData,'lg_id');
 
             foreach ($oddsCodeNum as $k=>$v){
                 foreach ($matchData as $kk => $vv){
@@ -450,7 +451,7 @@ where a.match_id = b.match_id and a.id = b.id ";
             }
         }
         //赛事详细数据 去重
-        $matchData = $this->uniquArr($data,'lg_id');
+        $matchData =  $this->commonFunction->array_unset_tt($data,'lg_id');
 
         //国家数据
         $country = area_countryModel::getName('',2);
@@ -485,6 +486,7 @@ where a.match_id = b.match_id and a.id = b.id ";
             }
         }
         sort($areaList);
+        sort($matchData);
 
         //国家/地区 联赛列表
         $leagueList = array_merge($countryList,$areaList);
@@ -501,11 +503,11 @@ where a.match_id = b.match_id and a.id = b.id ";
         $whereOr = [];
         //有父级玩法,则获取该玩法下详细数据
         if($p_code){
-            $whereOr = [['sort','=',0]];
+            $whereOr = [['sort','=',0],['status','=',0]];
             $select = ['lg_id','match_id','id','p_code','odds_code','condition','odds','odds_only','sort','status','team'];
             //获取冠军盘口
             if($p_code == 'kemp'){
-                $whereOr = [['sort','=',0],['type','=',1]];
+                $whereOr = [['sort','=',0],['type','=',1],['status','=',0]];
                 $oddsData = ZQoddsModel::getOddsDataPC($model_odds,$select,$lg_ids,$whereOr,$p_code);
                 return $oddsData;
             }
@@ -529,7 +531,7 @@ where a.match_id = b.match_id and a.id = b.id ";
         //如果是滚球,则获取滚球下详细数据
         if($type == 'StRollBall'){
             $select = ['lg_id','match_id','id','p_code','odds_code','condition','odds','odds_only','sort','status','team'];
-            $whereOr = [['sort','=',0]];
+            $whereOr = [['sort','=',0],['status','=',0]];
             //获取滚球下,各球类默认玩法代码
             if($game_code == 'zq'){
                 $p_code = ['concede','goal_size','capot'];
@@ -561,35 +563,13 @@ where a.match_id = b.match_id and a.id = b.id ";
             $oddsCodeNum[$kkk]['game_code'] = $game_code;
             $oddsCodeNum[$kkk]['game_num'] = $game_num;
             $oddsCodeNum[$kkk]['p_code'] = $kkk;
-            $oddsCodeNum[$kkk]['code_num'] = count($this->uniquArr($vvv,'match_id'));
+            $oddsCodeNum[$kkk]['code_num'] = count($this->commonFunction->array_unset_tt($vvv,'match_id'));
         }
 
         sort($oddsCodeNum);
         return $oddsCodeNum;
     }
 
-    /**
-     * 二维数组根据某个字段去重
-     * @param array $array  二维数组
-     * @para array  去重后的数组
-     */
-     function uniquArr($array,$key){
-        $result = array();
-        foreach($array as $k=>$val){
-            $code = false;
-            foreach($result as $_val){
-                if($_val[$key] == $val[$key]){
-                    $code = true;
-                    break;
-                }
-            }
-            if(!$code){
-                $result[]=$val;
-            }
-        }
-        return $result;
-    }
-
     //获取直播数据
     public function getBroadcast(){
          //球类代码

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

@@ -25,18 +25,35 @@ class RollingBall extends Controller{
         $model_result = $models['model_result'];
         $model_match = $models['model_match'];
         $model_league = $models['model_league'];
+        $result_record = $models['model_result_record'];
 
         //获取 滚球查询条件
         $where = $this->commonFunction->getState('StRollBall',$model_match);
 
+//        $result =lm($model_match,"Sports")
+//            ->join($model_result,$model_result.'.match_id',$model_match.'.id')
+//            ->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','home_score','guest_score',$model_result.'.match_time','match_process')
+//            ->where([[$model_league.'.name_chinese','!=','']])
+//            ->where($where)
+//            ->get()
+//            ->toarray();
+
         $result =lm($model_match,"Sports")
-            ->join($model_result,$model_result.'.match_id',$model_match.'.id')
             ->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','home_score','guest_score',$model_result.'.match_time','match_process')
+            ->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')
             ->where([[$model_league.'.name_chinese','!=','']])
             ->where($where)
             ->get()
             ->toarray();
+        foreach ($result as $k=>$v){
+            $v['home_score'] = 0;
+            $v['guest_score'] = 0;
+            $v['match_time'] = 0;
+            $v['match_process'] = '';
+
+            $result[$k] = $v;
+        }
 
         $data = [
             'game_code'=>'zq',
@@ -45,7 +62,6 @@ class RollingBall extends Controller{
         ];
 
         return $data;
-//        Render($data, '1', lang('Tips','Sports')->get('success'));
 
     }
 
@@ -61,22 +77,37 @@ class RollingBall extends Controller{
         $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.'.id')
+//            ->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','home_score','guest_score',$model_result.'.match_time','match_process')
+//            ->where($where)
+//            ->where([[$model_league.'.name_chinese','!=','']])
+//            ->get()
+//            ->toarray();
         $result =lm($model_match,"Sports")
-            ->join($model_result,$model_result.'.match_id',$model_match.'.id')
             ->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','home_score','guest_score',$model_result.'.match_time','match_process')
+            ->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')
             ->where($where)
             ->where([[$model_league.'.name_chinese','!=','']])
             ->get()
             ->toarray();
 
+        foreach ($result as $k=>$v){
+            $v['home_score'] = 0;
+            $v['guest_score'] = 0;
+            $v['match_time'] = 0;
+            $v['match_process'] = '';
+
+            $result[$k] = $v;
+        }
+
         $data = [
             'game_code'=>'lq',
             'gameName'=>'篮球',
             'matchData'=>$result
         ];
         return $data;
-//        Render($data, '1', lang('Tips','Sports')->get('success'));
     }
 
     public function wqrollingball(){
@@ -87,22 +118,38 @@ class RollingBall extends Controller{
         $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.'.id')
+//            ->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','home_player_name','guest_player_name','first_inning_score','second_inning_score','third_inning_score',$model_result.'.match_time','match_process')
+//            ->where($where)
+//            ->where([[$model_league.'.name_chinese','!=','']])
+//            ->get()
+//            ->toarray();
         $result =lm($model_match,"Sports")
-            ->join($model_result,$model_result.'.match_id',$model_match.'.id')
             ->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','home_player_name','guest_player_name','first_inning_score','second_inning_score','third_inning_score',$model_result.'.match_time','match_process')
+            ->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')
             ->where($where)
             ->where([[$model_league.'.name_chinese','!=','']])
             ->get()
             ->toarray();
 
+        foreach ($result as $k=>$v){
+            $v['first_inning_score'] = 0;
+            $v['second_inning_score'] = 0;
+            $v['third_inning_score'] = 0;
+            $v['match_time'] = 0;
+            $v['match_process'] = '';
+
+            $result[$k] = $v;
+        }
+
         $data = [
             'game_code'=>'wq',
             'gameName'=>'网球',
             'matchData'=>$result
         ];
         return $data;
-//        Render($data, '1', lang('Tips','Sports')->get('success'));
     }
 
     public function bqrollingball(){
@@ -113,22 +160,38 @@ class RollingBall extends Controller{
         $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.'.id')
+//            ->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','home_score','guest_score',$model_result.'.match_time','match_process')
+//            ->where($where)
+//            ->where([[$model_league.'.name_chinese','!=','']])
+//            ->get()
+//            ->toarray();
         $result =lm($model_match,"Sports")
-            ->join($model_result,$model_result.'.match_id',$model_match.'.id')
             ->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','home_score','guest_score',$model_result.'.match_time','match_process')
+            ->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')
             ->where($where)
             ->where([[$model_league.'.name_chinese','!=','']])
             ->get()
             ->toarray();
 
+        foreach ($result as $k=>$v){
+            $v['home_score'] = 0;
+            $v['guest_score'] = 0;
+            $v['match_time'] = 0;
+            $v['match_process'] = '';
+
+            $result[$k] = $v;
+        }
+
+
         $data = [
             'game_code'=>'bq',
             'gameName'=>'棒球',
             'matchData'=>$result
         ];
         return $data;
-//        Render($data, '1', lang('Tips','Sports')->get('success'));
 
     }
 

+ 1 - 0
Application/Sports/Model/St_bq_odds.php

@@ -31,6 +31,7 @@ class St_bq_odds extends Model
         $oddsData = self::select('match_id','id','p_code','odds_code','status','odds','condition','sort','odds_only')
 //            ->where($source)
             ->whereIn('match_id',$match_ids)
+            ->where(['type'=>0,'status'=>0])//查询滚球赔率
             ->where(function($query){
                 $query->where('odds_code','concede_home')
                     ->orWhere(function($query){

+ 1 - 0
Application/Sports/Model/St_lq_odds.php

@@ -31,6 +31,7 @@ class St_lq_odds extends Model
         $oddsData = self::select('match_id','id','p_code','odds_code','status','odds','condition','sort','odds_only')
 //            ->where($source)
             ->whereIn('match_id',$match_ids)
+            ->where(['type'=>0,'status'=>0])//查询滚球赔率
             ->where(function($query){
                 $query->where('odds_code','concede_home')
                     ->orWhere(function($query){

+ 1 - 0
Application/Sports/Model/St_wq_odds.php

@@ -31,6 +31,7 @@ class St_wq_odds extends Model
         $oddsData = self::select('match_id','id','p_code','odds_code','status','odds','condition','sort','odds_only')
 //            ->where($source)
             ->whereIn('match_id',$match_ids)
+            ->where(['type'=>0,'status'=>0])//查询滚球赔率
             ->where(
                 function($query){
                     $query->where('odds_code','dishes_home')

+ 1 - 1
Application/Sports/Model/St_zq_odds.php

@@ -62,7 +62,7 @@ class St_zq_odds extends Model
             ->select($model_odds.'.match_id',$model_odds.'.id','p_code','odds_code',$model_odds.'.status','odds','condition','odds_only','sort')
 //            ->where($model_odds.'.source',$source['source'])
             ->whereIn($model_odds.'.match_id',$match_ids)
-            ->where([$model_odds.'.type'=>0])//查询滚球赔率
+            ->where([$model_odds.'.type'=>0,$model_odds.'.status'=>0])//查询滚球赔率
             //->where($model_odds.'.expire_time','>',date("Y-m-d H:i:s"))
             ->where(function($query)use ($model_odds){
                 $query->where($model_odds.'.odds_code','concede_home')

+ 1 - 0
Biz/Common/CommonFunction.php

@@ -915,6 +915,7 @@ class CommonFunction {
         return $res;
     }
 
+
     /**
      * 处理冠军盘口 数组结构
      */

+ 4 - 0
Biz/Match/GetOddsData.php

@@ -97,6 +97,7 @@ class GetOddsData {
         $oddsData = lm($model_odds, 'Sports')
             ->select('match_id','id','p_code','odds_code','status','odds','condition','sort','odds_only')
             ->whereIn('match_id',$match_ids)
+            ->where(['status'=>0])
             ->where(
                 function($query)use ($model_odds){
                     $query->where($model_odds.'.odds_code','concede_home')
@@ -145,6 +146,7 @@ class GetOddsData {
         $oddsData = lm($model_odds, 'Sports')
             ->select('match_id','id','p_code','odds_code','status','odds','condition','sort','odds_only')
             ->whereIn('match_id',$match_ids)
+            ->where(['status'=>0])
             ->where(
                 function($query)use ($model_odds){
                     $query->where($model_odds.'.odds_code','concede_home')
@@ -192,6 +194,7 @@ class GetOddsData {
         $oddsData = lm($model_odds, 'Sports')
             ->select('match_id','id','p_code','odds_code','status','odds','condition','sort','odds_only')
             ->whereIn('match_id',$match_ids)
+            ->where(['status'=>0])
             ->where(
                 function($query)use ($model_odds){
                     $query->where($model_odds.'.odds_code','dishes_home')
@@ -238,6 +241,7 @@ class GetOddsData {
         $oddsData = lm($model_odds, 'Sports')
             ->select('match_id','id','p_code','odds_code','status','odds','condition','sort','odds_only')
             ->whereIn('match_id',$match_ids)
+            ->where(['status'=>0])
             ->where(
                 function($query)use ($model_odds){
                     $query->where($model_odds.'.odds_code','capot_home')

+ 4 - 0
Biz/Match/GetmatchData.php

@@ -403,6 +403,7 @@ class GetmatchData {
                 ->select("id","lg_id","match_id","p_code","odds_code","team","odds","sort","status","odds_only")
                 ->where('lg_id',$lg_id)
                 ->where($where)
+                ->where(['status'=>0])
                 ->groupBy("id","lg_id","match_id","p_code","odds_code","team","odds","sort","status","odds_only")
                 ->get()->toArray();
 
@@ -553,6 +554,7 @@ class GetmatchData {
             ->select('id','lg_id','p_code')
             ->distinct("p_code")//去重
             ->where($where)
+            ->where(['status'=>0])
             ->get()
             ->toArray();
 
@@ -848,6 +850,7 @@ class GetmatchData {
         $oddsData = lm($model_odds, "Sports")
             ->select( 'id','p_code', 'odds_code','odds_only','status', 'odds', 'condition', 'sort','match_id')
             ->whereIn('match_id', $match_ids)
+            ->where(['status'=>0])
             ->groupBy($model_odds . '.id','p_code', 'odds_code','odds_only', $model_odds . '.status', 'odds', 'condition', 'sort','match_id')
             ->orderBy($model_odds . '.id','desc')
             ->get()
@@ -899,6 +902,7 @@ class GetmatchData {
             ->select("id","lg_id","match_id","p_code","odds_code","team","odds","sort","status","odds_only")
             ->where('lg_id',$lg_id)
             ->where($where)
+            ->where(['status'=>0])
             ->groupBy("id","lg_id","match_id","p_code","odds_code","team","odds","sort","status","odds_only")
             ->get()->toArray();