Browse Source

追加推送 4/29

彭俊 6 years ago
parent
commit
0d2a73cf0a

+ 4 - 3
Application/Api/Controller/BetOrder.php

@@ -203,7 +203,7 @@ class Betorder extends BaseController{
             $prize_money = 0; //可赢额
             $prize_money = 0; //可赢额
             foreach($v as $kk => $vv){
             foreach($v as $kk => $vv){
                 $bet_money += $vv['bet_amount'];
                 $bet_money += $vv['bet_amount'];
-                $prize_money += ($vv['odds']-1) * $vv['bet_amount'] - $vv['bet_amount'];
+                $prize_money +=  $vv['odds']* $vv['bet_amount'];
                 $matchData =[
                 $matchData =[
                     'odds_id' =>$vv['id'],
                     'odds_id' =>$vv['id'],
                     'home_team' => $vv['home_team'],
                     'home_team' => $vv['home_team'],
@@ -219,8 +219,8 @@ class Betorder extends BaseController{
                     'batch_id' => $batch_id,
                     'batch_id' => $batch_id,
                     'bet_type' => 1,
                     'bet_type' => 1,
                     'bet_money' => $vv['bet_amount'],
                     'bet_money' => $vv['bet_amount'],
-                    'ctime' => date('Y-m-d H:i:s',time()),
-                    'utime' => date('Y-m-d H:i:s',time())
+                    'ctime' => $this->time,
+                    'utime' => $this->time
                 ];
                 ];
                 //插入数据源
                 //插入数据源
                 $moneyBuyMatch = lm('MoneyBuyMatch','Api')->insert($matchData);
                 $moneyBuyMatch = lm('MoneyBuyMatch','Api')->insert($matchData);
@@ -554,6 +554,7 @@ class Betorder extends BaseController{
                 'game_code'=>$vv['ballId'],
                 'game_code'=>$vv['ballId'],
                 'lg_id'=>lm($model_match,"Sports")->select('lg_id')->where('match_id',$vv['match_id'])->first()->lg_id,
                 'lg_id'=>lm($model_match,"Sports")->select('lg_id')->where('match_id',$vv['match_id'])->first()->lg_id,
                 'ctime'=>$this->time,//写入时间
                 'ctime'=>$this->time,//写入时间
+                'utime' => $this->time,
                 'bet_type'=>2
                 'bet_type'=>2
             ];
             ];
         }
         }

+ 27 - 1
Application/Sports/Controller/MatchList.php

@@ -660,9 +660,10 @@ class  MatchList extends Controller {
         $game_code = $_REQUEST['game_code'];
         $game_code = $_REQUEST['game_code'];
         $matchID = $_REQUEST['matchID'];
         $matchID = $_REQUEST['matchID'];
         $status = $_REQUEST['status'];
         $status = $_REQUEST['status'];
+        $oddsType = $_REQUEST['oddsType'];
 
 
         try {
         try {
-            if(empty($game_code) || empty($matchID)){
+            if(empty($game_code) || empty($matchID) || empty($oddsType)){
                 throw new \Exception(Render([], '10001', lang('Tips','Sports')->get('PARAM_ERROR')));
                 throw new \Exception(Render([], '10001', lang('Tips','Sports')->get('PARAM_ERROR')));
             }
             }
 
 
@@ -673,9 +674,34 @@ class  MatchList extends Controller {
             $model_league = $models['model_league'];
             $model_league = $models['model_league'];
             $model_result = $models['model_result'];
             $model_result = $models['model_result'];
 
 
+            //获取赛事不同状态下的赔率
+            if(!empty($oddsType)){
+                switch ($oddsType)
+                {
+                    case 'StRollBall'://滚球
+                        $oddsTypeWhere = [[$model_odds.'.is_rollball','=',1],];
+                        break;
+                    case 'StSoon'://即将
+                        $oddsTypeWhere = [[$model_odds.'.is_morningplate','=',1],];
+                        break;
+                    case 'StToday'://今日
+                        $oddsTypeWhere = [[$model_odds.'.is_today','=',1],];
+                        break;
+                    case 'StMorningPlate'://早盘
+                        $oddsTypeWhere = [[$model_odds.'.is_morningplate','=',1],];
+                        break;
+                    case 'StStringScene'://串场
+                        $oddsTypeWhere = [[$model_odds.'.is_stringscene','=',1],];
+                        break;
+                    default:
+                        $oddsTypeWhere = [];
+                }
+            }
+
             $oddsData = lm($model_odds, 'Sports')
             $oddsData = lm($model_odds, 'Sports')
                 ->select('id','odds_only','p_code','odds_code',$model_odds.'.status','odds','condition','sort','source','utime')
                 ->select('id','odds_only','p_code','odds_code',$model_odds.'.status','odds','condition','sort','source','utime')
                 ->where($this->source)
                 ->where($this->source)
+                ->where($oddsTypeWhere)
 //                ->where($model_odds.'.expire_time','>',date("Y-m-d H:i:s"))
 //                ->where($model_odds.'.expire_time','>',date("Y-m-d H:i:s"))
                 ->where([$model_odds.'.match_id'=>$matchID,$model_odds.'.type'=>0])//,$model_odds.'.expire_time'=>$utime
                 ->where([$model_odds.'.match_id'=>$matchID,$model_odds.'.type'=>0])//,$model_odds.'.expire_time'=>$utime
                 ->groupBy('id','odds_only','p_code','odds_code',$model_odds.'.status','odds','condition','sort','source','utime')
                 ->groupBy('id','odds_only','p_code','odds_code',$model_odds.'.status','odds','condition','sort','source','utime')

+ 11 - 10
Application/Sports/Controller/Sports.php

@@ -20,26 +20,27 @@ class Sports extends Controller{
     private function Sports_info($game_code,$where,$limit_mt = 3,$limit_lg = 3){
     private function Sports_info($game_code,$where,$limit_mt = 3,$limit_lg = 3){
         $data=[];
         $data=[];
         $data['name'] = lm('GameType','Sports')->where('game_code',$game_code)->value('game_name');
         $data['name'] = lm('GameType','Sports')->where('game_code',$game_code)->value('game_name');
-        $data['game_code'] = 'zq';
         //===查询该球类Models===
         //===查询该球类Models===
         $getModels = getModels($game_code);
         $getModels = getModels($game_code);
         $st_league = $getModels['model_league'];
         $st_league = $getModels['model_league'];
         $st_competition = $getModels['model_match'];
         $st_competition = $getModels['model_match'];
         //查询足球早盘其他球的所有赛事
         //查询足球早盘其他球的所有赛事
-        if ($data['game_code'] == 'zq'){
+        if ($game_code == 'zq'){
             $data['today']['name'] ='今日赛事';
             $data['today']['name'] ='今日赛事';
-            $data['today']['count'] = lm('st_zq_competition','Sports')
-                ->join('st_zq_league','st_zq_league.lg_id','st_zq_competition.lg_id')
+            $data['today']['code'] = $game_code;
+            $data['today']['count'] = lm($st_competition,'Sports')
+                ->join($st_league,$st_league.'.lg_id',$st_competition.'.lg_id')
                 ->where(getState('StToday'))
                 ->where(getState('StToday'))
-                ->where('st_zq_competition.source',$this->source['source'])
-                ->distinct('st_zq_competition.match_id')
+                ->where($st_competition.'.source',$this->source['source'])
+                ->distinct($st_competition.'.match_id')
                 ->count('*');
                 ->count('*');
             } else {
             } else {
                 $data['all']['name'] = '所有赛事';
                 $data['all']['name'] = '所有赛事';
-                $data['today']['count'] = lm($st_competition,'Sports')
+                $data['all']['code'] = $game_code;
+                $data['all']['count'] = lm($st_competition,'Sports')
                     ->where([[$st_competition.'.status', '<', '2'],
                     ->where([[$st_competition.'.status', '<', '2'],
                         [$st_competition.'.source',$this->source['source']]])
                         [$st_competition.'.source',$this->source['source']]])
-                    ->where('st_zq_competition.us_time','>',qgmdate('Y-m-d H:i:s', '', -4))
+                    ->where($st_competition.'.us_time','>',qgmdate('Y-m-d H:i:s', '', -4))
                     ->count('*');
                     ->count('*');
             }
             }
         //查询正在进行的和未开始的球类比赛
         //查询正在进行的和未开始的球类比赛
@@ -54,8 +55,7 @@ class Sports extends Controller{
         if(!empty($data['match'])){
         if(!empty($data['match'])){
             $data['match'] = $data['match']->toarray();
             $data['match'] = $data['match']->toarray();
         }
         }
-
-        //获取正在进行的和未开始联赛
+//        获取正在进行的和未开始联赛
         $data['league'] = lm($st_competition,"Sports")
         $data['league'] = lm($st_competition,"Sports")
             ->join($st_league,$st_league.'.lg_id',$st_competition.'.lg_id')
             ->join($st_league,$st_league.'.lg_id',$st_competition.'.lg_id')
             ->select($st_league.'.lg_id',$st_league.'.name_chinese')
             ->select($st_league.'.lg_id',$st_league.'.name_chinese')
@@ -69,6 +69,7 @@ class Sports extends Controller{
             $data['league'] = $data['league']->toarray();
             $data['league'] = $data['league']->toarray();
             foreach($data['league'] as $k => $v){
             foreach($data['league'] as $k => $v){
                 //统计当前联赛下的联赛
                 //统计当前联赛下的联赛
+                $data['league'][$k]['code'] = $game_code;
                 $data['league'][$k]['count'] = lm($st_competition,'Sports')
                 $data['league'][$k]['count'] = lm($st_competition,'Sports')
                     ->where([[$st_competition.'.status','<',2],[$st_competition.'.source',$this->source]])
                     ->where([[$st_competition.'.status','<',2],[$st_competition.'.source',$this->source]])
                     ->where('lg_id',$v['lg_id'])
                     ->where('lg_id',$v['lg_id'])

+ 18 - 14
Biz/Match/GetOddsData.php

@@ -89,13 +89,14 @@ class GetOddsData {
      * @throws \Exception
      * @throws \Exception
      * 获取足球默认赔率数据
      * 获取足球默认赔率数据
      */
      */
-    public function getOddsZQ($matchData,$model_odds,$source){
+    public function getOddsZQ($matchData,$model_odds,$source,$oddsTypeWhere=''){
         $list = array();
         $list = array();
         foreach ($matchData as $key=>$item){
         foreach ($matchData as $key=>$item){
             $list[$key] = $item;
             $list[$key] = $item;
             $oddsData = lm($model_odds, 'Sports')
             $oddsData = lm($model_odds, 'Sports')
                 ->select('id','p_code','odds_code','status','odds','condition','sort','odds_only')
                 ->select('id','p_code','odds_code','status','odds','condition','sort','odds_only')
                 ->where($source)
                 ->where($source)
+                ->where($oddsTypeWhere)
                 ->where(['match_id'=>$item['match_id'],'type'=>0])
                 ->where(['match_id'=>$item['match_id'],'type'=>0])
 //                    ->where($model_odds.'.expire_time','>',date("Y-m-d H:i:s"))//追加查询有效时间
 //                    ->where($model_odds.'.expire_time','>',date("Y-m-d H:i:s"))//追加查询有效时间
                 ->where(
                 ->where(
@@ -133,26 +134,27 @@ class GetOddsData {
      * @throws \Exception
      * @throws \Exception
      * 获取篮球默认赔率数据
      * 获取篮球默认赔率数据
      */
      */
-    public function getOddsLQ($matchData,$model_odds,$source){
+    public function getOddsLQ($matchData,$model_odds,$source,$oddsTypeWhere=''){
         $list = array();
         $list = array();
         foreach ($matchData as $key=>$item){
         foreach ($matchData as $key=>$item){
             $list[$key] = $item;
             $list[$key] = $item;
             $oddsData = lm($model_odds, 'Sports')
             $oddsData = lm($model_odds, 'Sports')
                 ->select('id','p_code','odds_code','status','odds','condition','sort','odds_only')
                 ->select('id','p_code','odds_code','status','odds','condition','sort','odds_only')
                 ->where($source)
                 ->where($source)
+                ->where($oddsTypeWhere)
                 ->where(['match_id'=>$item['match_id'],'type'=>0])
                 ->where(['match_id'=>$item['match_id'],'type'=>0])
 //                    ->where($model_odds.'.expire_time','>',date("Y-m-d H:i:s"))//追加查询有效时间
 //                    ->where($model_odds.'.expire_time','>',date("Y-m-d H:i:s"))//追加查询有效时间
                 ->where(
                 ->where(
                     function($query)use ($model_odds){
                     function($query)use ($model_odds){
-                        $query->where($model_odds.'.odds_code','concede_home')
+                        $query->where($model_odds.'.odds_code','lq_concede_home')
                             ->orWhere(function($query)use ($model_odds){
                             ->orWhere(function($query)use ($model_odds){
-                                $query->where($model_odds.'.odds_code','concede_guest');
+                                $query->where($model_odds.'.odds_code','lq_concede_guest');
                             })
                             })
                             ->orWhere(function($query)use ($model_odds){
                             ->orWhere(function($query)use ($model_odds){
-                                $query->where($model_odds.'.odds_code','size_home');
+                                $query->where($model_odds.'.odds_code','lq_total_sizes_big');
                             })
                             })
                             ->orWhere(function($query)use ($model_odds){
                             ->orWhere(function($query)use ($model_odds){
-                                $query->where($model_odds.'.odds_code','size_guest');
+                                $query->where($model_odds.'.odds_code','lq_total_sizes_small');
                             });
                             });
                     }
                     }
                 )
                 )
@@ -177,26 +179,27 @@ class GetOddsData {
      * @throws \Exception
      * @throws \Exception
      * 获取网球默认赔率数据
      * 获取网球默认赔率数据
      */
      */
-    public function getOddsWQ($matchData,$model_odds,$source){
+    public function getOddsWQ($matchData,$model_odds,$source,$oddsTypeWhere=''){
         $list = array();
         $list = array();
         foreach ($matchData as $key=>$item){
         foreach ($matchData as $key=>$item){
             $list[$key] = $item;
             $list[$key] = $item;
             $oddsData = lm($model_odds, 'Sports')
             $oddsData = lm($model_odds, 'Sports')
                 ->select('id','p_code','odds_code','status','odds','condition','sort','odds_only')
                 ->select('id','p_code','odds_code','status','odds','condition','sort','odds_only')
                 ->where($source)
                 ->where($source)
+                ->where($oddsTypeWhere)
                 ->where(['match_id'=>$item['match_id'],'type'=>0])
                 ->where(['match_id'=>$item['match_id'],'type'=>0])
 //                    ->where($model_odds.'.expire_time','>',date("Y-m-d H:i:s"))//追加查询有效时间
 //                    ->where($model_odds.'.expire_time','>',date("Y-m-d H:i:s"))//追加查询有效时间
                 ->where(
                 ->where(
                     function($query)use ($model_odds){
                     function($query)use ($model_odds){
-                        $query->where($model_odds.'.odds_code','capot_home')
+                        $query->where($model_odds.'.odds_code','wq_concede_home')
                             ->orWhere(function($query)use ($model_odds){
                             ->orWhere(function($query)use ($model_odds){
-                                $query->where($model_odds.'.odds_code','capot_guest');
+                                $query->where($model_odds.'.odds_code','wq_concede_guest');
                             })
                             })
                             ->orWhere(function($query)use ($model_odds){
                             ->orWhere(function($query)use ($model_odds){
-                                $query->where($model_odds.'.odds_code','concede_home');
+                                $query->where($model_odds.'.odds_code','wq_kemp_home');
                             })
                             })
                             ->orWhere(function($query)use ($model_odds){
                             ->orWhere(function($query)use ($model_odds){
-                                $query->where($model_odds.'.odds_code','concede_guest');
+                                $query->where($model_odds.'.odds_code','wq_kemp_guest');
                             });
                             });
                     }
                     }
                 )
                 )
@@ -221,20 +224,21 @@ class GetOddsData {
      * @throws \Exception
      * @throws \Exception
      * 获取棒球默认赔率数据
      * 获取棒球默认赔率数据
      */
      */
-    public function getOddsBQ($matchData,$model_odds,$source){
+    public function getOddsBQ($matchData,$model_odds,$source,$oddsTypeWhere=''){
         $list = array();
         $list = array();
         foreach ($matchData as $key=>$item){
         foreach ($matchData as $key=>$item){
             $list[$key] = $item;
             $list[$key] = $item;
             $oddsData = lm($model_odds, 'Sports')
             $oddsData = lm($model_odds, 'Sports')
                 ->select('id','p_code','odds_code','status','odds','condition','sort','odds_only')
                 ->select('id','p_code','odds_code','status','odds','condition','sort','odds_only')
                 ->where($source)
                 ->where($source)
+                ->where($oddsTypeWhere)
                 ->where(['match_id'=>$item['match_id'],'type'=>0])
                 ->where(['match_id'=>$item['match_id'],'type'=>0])
 //                    ->where($model_odds.'.expire_time','>',date("Y-m-d H:i:s"))//追加查询有效时间
 //                    ->where($model_odds.'.expire_time','>',date("Y-m-d H:i:s"))//追加查询有效时间
                 ->where(
                 ->where(
                     function($query)use ($model_odds){
                     function($query)use ($model_odds){
-                        $query->where($model_odds.'.odds_code','capot_home')
+                        $query->where($model_odds.'.odds_code','bq_capot_home')
                             ->orWhere(function($query)use ($model_odds){
                             ->orWhere(function($query)use ($model_odds){
-                                $query->where($model_odds.'.odds_code','capot_guest');
+                                $query->where($model_odds.'.odds_code','bq_capot_guest');
                             });
                             });
                     }
                     }
                 )
                 )

+ 78 - 48
Biz/Match/GetmatchData.php

@@ -45,10 +45,16 @@ class GetmatchData {
                 $data = $this->getRollBall($source,$models,$where,$ret,$search);
                 $data = $this->getRollBall($source,$models,$where,$ret,$search);
                 break;
                 break;
             case 'StSoon'://即将
             case 'StSoon'://即将
-                $data = $this->getSoon($source,$models,$where,$lg_id,$search);
+                $oddsTypeWhere = [
+                    [$models['model_odds'].'.is_morningplate','=',1],
+                ];
+                $data = $this->getSoon($source,$models,$where,$lg_id,$search,$oddsTypeWhere);
                 break;
                 break;
             case 'StToday'://今日
             case 'StToday'://今日
-                $data = $this->getToday($source,$models,$where,$lg_id,$search);
+                $oddsTypeWhere = [
+                    [$models['model_odds'].'.is_today','=',1],
+                ];
+                $data = $this->getToday($source,$models,$where,$lg_id,$search,$oddsTypeWhere);
                 break;
                 break;
             case 'StMorningPlate'://早盘
             case 'StMorningPlate'://早盘
                 //默认当天
                 //默认当天
@@ -61,12 +67,17 @@ class GetmatchData {
                         $match_date = 'other';
                         $match_date = 'other';
                     }
                     }
                 }
                 }
-                $data = $this->getMorningPlate($source,$models,$where,$lg_id,$search,$match_date);
+                $oddsTypeWhere = [
+                    [$models['model_odds'].'.is_morningplate','=',1],
+                ];
+                $data = $this->getMorningPlate($source,$models,$where,$lg_id,$search,$match_date,$oddsTypeWhere);
                 break;
                 break;
             case 'StStringScene'://串场
             case 'StStringScene'://串场
-
+                $oddsTypeWhere = [
+                    [$models['model_odds'].'.is_stringscene','=',1],
+                ];
                 if(empty($ret['str_type']) || $ret['str_type'] ==0){//赛事
                 if(empty($ret['str_type']) || $ret['str_type'] ==0){//赛事
-                    $data = $this->getStringScene($source,$models,$where,$lg_id,$search);
+                    $data = $this->getStringScene($source,$models,$where,$lg_id,$search,'',$oddsTypeWhere);
                 }
                 }
                 if($ret['str_type'] == 1){//参赛表
                 if($ret['str_type'] == 1){//参赛表
 
 
@@ -140,8 +151,8 @@ class GetmatchData {
                     ->leftjoin($model_odds,$model_odds.'.match_id',$model_match.'.match_id')
                     ->leftjoin($model_odds,$model_odds.'.match_id',$model_match.'.match_id')
                     ->select($model_odds.'.id','p_code','odds_code',$model_odds.'.status','odds','condition','sort')
                     ->select($model_odds.'.id','p_code','odds_code',$model_odds.'.status','odds','condition','sort')
                     ->where($model_match.'.source',$source['source'])
                     ->where($model_match.'.source',$source['source'])
-                    ->where([$model_odds.'.match_id' => $vv['match_id'],$model_odds.'.type'=>0])
-//                        ->where($model_odds.'.expire_time','>',date("Y-m-d H:i:s"))
+                    ->where([$model_odds.'.match_id' => $vv['match_id'],$model_odds.'.is_rollball'=>1,$model_odds.'.type'=>0])//查询滚球赔率
+                    //->where($model_odds.'.expire_time','>',date("Y-m-d H:i:s"))
                     ->where(function($query)use ($model_odds){
                     ->where(function($query)use ($model_odds){
                         $query->where($model_odds.'.odds_code','concede_home')
                         $query->where($model_odds.'.odds_code','concede_home')
                             ->orWhere(function($query)use ($model_odds){
                             ->orWhere(function($query)use ($model_odds){
@@ -187,7 +198,7 @@ class GetmatchData {
     /**
     /**
      * 获取即将数据
      * 获取即将数据
      */
      */
-    public function getSoon($source,$models,$where,$lg_id=0,$search=''){
+    public function getSoon($source,$models,$where,$lg_id=0,$search='',$oddsTypeWhere=''){
         $model_match = $models['model_match'];
         $model_match = $models['model_match'];
         $model_odds = $models['model_odds'];
         $model_odds = $models['model_odds'];
         $model_league = $models['model_league'];
         $model_league = $models['model_league'];
@@ -238,6 +249,7 @@ class GetmatchData {
                     ->select($model_odds.'.id','odds_only','p_code','odds_code',$model_odds.'.status','odds','condition','sort')
                     ->select($model_odds.'.id','odds_only','p_code','odds_code',$model_odds.'.status','odds','condition','sort')
                     ->where($model_match.'.source',$source['source'])
                     ->where($model_match.'.source',$source['source'])
                     ->where([$model_odds.'.match_id' => $vv['match_id'],$model_odds.'.type'=>0])
                     ->where([$model_odds.'.match_id' => $vv['match_id'],$model_odds.'.type'=>0])
+                    ->where($oddsTypeWhere)
 //                        ->where($model_odds.'.expire_time','>',date("Y-m-d H:i:s"))
 //                        ->where($model_odds.'.expire_time','>',date("Y-m-d H:i:s"))
                     ->where(function($query)use ($model_odds){
                     ->where(function($query)use ($model_odds){
                         $query->where($model_odds.'.odds_code','concede_home')
                         $query->where($model_odds.'.odds_code','concede_home')
@@ -283,7 +295,7 @@ class GetmatchData {
     /**
     /**
      * 获取今日数据
      * 获取今日数据
      */
      */
-    public function getToday($source,$models,$where,$lg_id=0,$search=''){
+    public function getToday($source,$models,$where,$lg_id=0,$search='',$oddsTypeWhere=[]){
         //获取model
         //获取model
 
 
         $model_match = $models['model_match'];
         $model_match = $models['model_match'];
@@ -293,7 +305,7 @@ class GetmatchData {
 
 
         //根据联赛id 获取联赛下 赛事赔率数据
         //根据联赛id 获取联赛下 赛事赔率数据
         if($lg_id >0){
         if($lg_id >0){
-            $leagueData = $this->getMatchOdds($source,$model_league,$model_match,$model_odds,$where,$search,$lg_id);
+            $leagueData = $this->getMatchOdds($source,$model_league,$model_match,$model_odds,$where,$search,$lg_id,'',$oddsTypeWhere);
             return $leagueData;
             return $leagueData;
         }
         }
 
 
@@ -304,7 +316,7 @@ class GetmatchData {
     /**
     /**
      * 获取早盘数据
      * 获取早盘数据
      */
      */
-    public function getMorningPlate($source,$models,$where,$lg_id=0,$search='',$time=''){
+    public function getMorningPlate($source,$models,$where,$lg_id=0,$search='',$time='',$oddsTypeWhere=''){
         //获取model
         //获取model
         $model_match = $models['model_match'];
         $model_match = $models['model_match'];
         $model_odds = $models['model_odds'];
         $model_odds = $models['model_odds'];
@@ -313,7 +325,7 @@ class GetmatchData {
 
 
         //根据联赛id 获取联赛下 赛事赔率数据
         //根据联赛id 获取联赛下 赛事赔率数据
         if($lg_id >0){
         if($lg_id >0){
-            $leagueData = $this->getMatchOdds($source,$model_league,$model_match,$model_odds,$where,$search,$lg_id,$time);
+            $leagueData = $this->getMatchOdds($source,$model_league,$model_match,$model_odds,$where,$search,$lg_id,$time,$oddsTypeWhere);
             return $leagueData;
             return $leagueData;
         }
         }
 
 
@@ -324,7 +336,7 @@ class GetmatchData {
     /**
     /**
      * 获取串场数据
      * 获取串场数据
      */
      */
-    public function getStringScene($source,$models,$where,$lg_id=0,$search='',$time){
+    public function getStringScene($source,$models,$where,$lg_id=0,$search='',$time='',$oddsTypeWhere=''){
 
 
         //获取model
         //获取model
         $model_match = $models['model_match'];
         $model_match = $models['model_match'];
@@ -334,7 +346,7 @@ class GetmatchData {
 
 
         //根据联赛id 获取联赛下 赛事赔率数据
         //根据联赛id 获取联赛下 赛事赔率数据
         if($lg_id >0){
         if($lg_id >0){
-            $leagueData = $this->getMatchOdds($source,$model_league,$model_match,$model_odds,$where,$search,$lg_id,$time);
+            $leagueData = $this->getMatchOdds($source,$model_league,$model_match,$model_odds,$where,$search,$lg_id,$time,$oddsTypeWhere);
             return $leagueData;
             return $leagueData;
         }
         }
 
 
@@ -608,7 +620,7 @@ class GetmatchData {
     /**
     /**
      * 获取联赛下 赛事赔率
      * 获取联赛下 赛事赔率
      */
      */
-    public function getMatchOdds($source,$model_league,$model_match,$model_odds,$where,$search,$lg_id,$time=''){
+    public function getMatchOdds($source,$model_league,$model_match,$model_odds,$where,$search,$lg_id,$time='',$oddsTypeWhere=[]){
         $leagueData = lm($model_league,"Sports")
         $leagueData = lm($model_league,"Sports")
             ->select('lg_id','name_chinese as leagueName')
             ->select('lg_id','name_chinese as leagueName')
             ->where($source)
             ->where($source)
@@ -681,40 +693,58 @@ class GetmatchData {
                 ->toarray();
                 ->toarray();
         }
         }
 
 
-        foreach($matchData as $kk => $vv) {
-            $oddsData = lm($model_match, "Sports")
-                ->leftjoin($model_odds, $model_odds . '.match_id', $model_match . '.match_id')
-                ->select($model_odds . '.id', 'odds_only','p_code', 'odds_code', $model_odds . '.status', 'odds', 'condition', 'sort')
-                ->where($model_match.'.source',$source['source'])
-                ->where([$model_odds . '.match_id' => $vv['match_id'], $model_odds . '.type' => 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')
-                        ->orWhere(function ($query) use ($model_odds) {
-                            $query->where($model_odds . '.odds_code', 'concede_guest');
-                        })
-                        ->orWhere(function ($query) use ($model_odds) {
-                            $query->where($model_odds . '.odds_code', 'size_home');
-                        })
-                        ->orWhere(function ($query) use ($model_odds) {
-                            $query->where($model_odds . '.odds_code', 'size_guest');
-                        });
-                })
-                ->get()
-                ->toarray();
-            //根据 排序 获取 最新让球/大小玩法赔率
-            $sortData = array_column($oddsData,'sort');
-            array_multisort($sortData,SORT_DESC,$oddsData);
-
-            $zu = [];
-            foreach ($oddsData as $key1 =>$item1){
-                $zu[$item1['p_code']][] = $item1;
-            }
-            $c_s = array_slice($zu['concede_size'],0,4);//让球/大小 前四条 放入
 
 
-            $matchData[$kk]['oddsData'] = $c_s;
+//        foreach($matchData as $kk => $vv) {
+//            $oddsData = lm($model_match, "Sports")
+//                ->leftjoin($model_odds, $model_odds . '.match_id', $model_match . '.match_id')
+//                ->select($model_odds . '.id', 'odds_only','p_code', 'odds_code', $model_odds . '.status', 'odds', 'condition', 'sort')
+//                ->where($model_match.'.source',$source['source'])
+//                ->where([$model_odds . '.match_id' => $vv['match_id'], $model_odds . '.type' => 0])
+//                ->where($oddsTypeWhere)//追加查询各状态不同的赔率
+////                ->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')
+//                        ->orWhere(function ($query) use ($model_odds) {
+//                            $query->where($model_odds . '.odds_code', 'concede_guest');
+//                        })
+//                        ->orWhere(function ($query) use ($model_odds) {
+//                            $query->where($model_odds . '.odds_code', 'size_home');
+//                        })
+//                        ->orWhere(function ($query) use ($model_odds) {
+//                            $query->where($model_odds . '.odds_code', 'size_guest');
+//                        });
+//                })
+//                ->get()
+//                ->toarray();
+//            //根据 排序 获取 最新让球/大小玩法赔率
+//            $sortData = array_column($oddsData,'sort');
+//            array_multisort($sortData,SORT_DESC,$oddsData);
+//
+//            $zu = [];
+//            foreach ($oddsData as $key1 =>$item1){
+//                $zu[$item1['p_code']][] = $item1;
+//            }
+//            $c_s = array_slice($zu['concede_size'],0,4);//让球/大小 前四条 放入
+//
+//            $matchData[$kk]['oddsData'] = $c_s;
+//        }
+
+        //获取各球类默认赔率
+        $game_code = $_REQUEST['game_code'];
+        switch ($game_code) {
+            case 'zq'://足球
+                $matchData = $this->getOddsData->getOddsZQ($matchData, $model_odds, $source,$oddsTypeWhere);
+                break;
+            case 'lq'://篮球
+                $matchData = $this->getOddsData->getOddsLQ($matchData, $model_odds, $source,$oddsTypeWhere);
+                break;
+            case 'wq'://网球
+                $matchData = $this->getOddsData->getOddsWQ($matchData, $model_odds, $source,$oddsTypeWhere);
+                break;
+            case 'bq'://棒球
+                $matchData = $this->getOddsData->getOddsBQ($matchData, $model_odds, $source,$oddsTypeWhere);
+                break;
         }
         }
-
         $leagueData->matchNum = count($matchData);
         $leagueData->matchNum = count($matchData);
         $leagueData->matchData = $matchData;
         $leagueData->matchData = $matchData;
 
 
@@ -952,7 +982,7 @@ class GetmatchData {
             })
             })
             ->get()->toArray();
             ->get()->toArray();
 
 
-        $data = $this->getOddsData->getOddsZQ($matchData,$model_odds,$source);
+        $data = $this->getOddsData->getOddsZQ($matchData,$model_odds,$source,[]);
 
 
         return $data;
         return $data;
     }
     }