|
|
@@ -45,10 +45,16 @@ class GetmatchData {
|
|
|
$data = $this->getRollBall($source,$models,$where,$ret,$search);
|
|
|
break;
|
|
|
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;
|
|
|
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;
|
|
|
case 'StMorningPlate'://早盘
|
|
|
//默认当天
|
|
|
@@ -61,12 +67,17 @@ class GetmatchData {
|
|
|
$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;
|
|
|
case 'StStringScene'://串场
|
|
|
-
|
|
|
+ $oddsTypeWhere = [
|
|
|
+ [$models['model_odds'].'.is_stringscene','=',1],
|
|
|
+ ];
|
|
|
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){//参赛表
|
|
|
|
|
|
@@ -140,8 +151,8 @@ class GetmatchData {
|
|
|
->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')
|
|
|
->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){
|
|
|
$query->where($model_odds.'.odds_code','concede_home')
|
|
|
->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_odds = $models['model_odds'];
|
|
|
$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')
|
|
|
->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')
|
|
|
@@ -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_match = $models['model_match'];
|
|
|
@@ -293,7 +305,7 @@ class GetmatchData {
|
|
|
|
|
|
//根据联赛id 获取联赛下 赛事赔率数据
|
|
|
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;
|
|
|
}
|
|
|
|
|
|
@@ -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_match = $models['model_match'];
|
|
|
$model_odds = $models['model_odds'];
|
|
|
@@ -313,7 +325,7 @@ class GetmatchData {
|
|
|
|
|
|
//根据联赛id 获取联赛下 赛事赔率数据
|
|
|
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;
|
|
|
}
|
|
|
|
|
|
@@ -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_match = $models['model_match'];
|
|
|
@@ -334,7 +346,7 @@ class GetmatchData {
|
|
|
|
|
|
//根据联赛id 获取联赛下 赛事赔率数据
|
|
|
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;
|
|
|
}
|
|
|
|
|
|
@@ -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")
|
|
|
->select('lg_id','name_chinese as leagueName')
|
|
|
->where($source)
|
|
|
@@ -681,40 +693,58 @@ class GetmatchData {
|
|
|
->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->matchData = $matchData;
|
|
|
|
|
|
@@ -952,7 +982,7 @@ class GetmatchData {
|
|
|
})
|
|
|
->get()->toArray();
|
|
|
|
|
|
- $data = $this->getOddsData->getOddsZQ($matchData,$model_odds,$source);
|
|
|
+ $data = $this->getOddsData->getOddsZQ($matchData,$model_odds,$source,[]);
|
|
|
|
|
|
return $data;
|
|
|
}
|