|
|
@@ -48,7 +48,7 @@ class GetmatchData {
|
|
|
$oddsTypeWhere = [
|
|
|
[$models['model_odds'].'.is_morningplate','=',1],
|
|
|
];
|
|
|
- $data = $this->getSoon($source,$models,$where,$lg_id,$search,$oddsTypeWhere);
|
|
|
+ $data = $this->getSoon($source,$models,$where,$lg_id,$ret,$search,$oddsTypeWhere);
|
|
|
break;
|
|
|
case 'StToday'://今日
|
|
|
$oddsTypeWhere = [
|
|
|
@@ -199,7 +199,7 @@ class GetmatchData {
|
|
|
/**
|
|
|
* 获取即将数据
|
|
|
*/
|
|
|
- public function getSoon($source,$models,$where,$lg_id=0,$search='',$oddsTypeWhere=''){
|
|
|
+ public function getSoon($source,$models,$where,$lg_id=0,$ret,$search='',$oddsTypeWhere=''){
|
|
|
$model_match = $models['model_match'];
|
|
|
$model_odds = $models['model_odds'];
|
|
|
$model_league = $models['model_league'];
|
|
|
@@ -242,53 +242,78 @@ class GetmatchData {
|
|
|
->toarray();
|
|
|
}
|
|
|
|
|
|
- foreach($data as $k => $v){
|
|
|
- foreach($v['matchData'] as $kk => $vv){
|
|
|
- $wait_time = ceil(((strtotime( $vv['match_time']))-time())/60);
|
|
|
- $data[$k]['matchData'][$kk]['wait_time'] = $wait_time;//追加距离开赛时间
|
|
|
- $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])
|
|
|
+ //获取足球即将默认玩法赔率
|
|
|
+ if($ret['game_code'] == 'zq'){
|
|
|
+ foreach($data as $k => $v){
|
|
|
+ foreach($v['matchData'] as $kk => $vv){
|
|
|
+ $wait_time = ceil(((strtotime( $vv['match_time']))-time())/60);
|
|
|
+ $data[$k]['matchData'][$kk]['wait_time'] = $wait_time;//追加距离开赛时间
|
|
|
+ $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');
|
|
|
- })
|
|
|
- ->orWhere(function($query)use ($model_odds){
|
|
|
- $query->where($model_odds.'.odds_code','capot_home');
|
|
|
- })
|
|
|
- ->orWhere(function($query)use ($model_odds){
|
|
|
- $query->where($model_odds.'.odds_code','capot_dogfall');
|
|
|
- })
|
|
|
- ->orWhere(function($query)use ($model_odds){
|
|
|
- $query->where($model_odds.'.odds_code','capot_guest');
|
|
|
- });
|
|
|
- })
|
|
|
- ->get()
|
|
|
- ->toarray();
|
|
|
+ ->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');
|
|
|
+ })
|
|
|
+ ->orWhere(function($query)use ($model_odds){
|
|
|
+ $query->where($model_odds.'.odds_code','capot_home');
|
|
|
+ })
|
|
|
+ ->orWhere(function($query)use ($model_odds){
|
|
|
+ $query->where($model_odds.'.odds_code','capot_dogfall');
|
|
|
+ })
|
|
|
+ ->orWhere(function($query)use ($model_odds){
|
|
|
+ $query->where($model_odds.'.odds_code','capot_guest');
|
|
|
+ });
|
|
|
+ })
|
|
|
+ ->get()
|
|
|
+ ->toarray();
|
|
|
|
|
|
- //根据 排序 获取 最新让球/大小玩法赔率
|
|
|
- $sortData = array_column($oddsData,'sort');
|
|
|
- array_multisort($sortData,SORT_DESC,$oddsData);
|
|
|
+ //根据 排序 获取 最新让球/大小玩法赔率
|
|
|
+ $sortData = array_column($oddsData,'sort');
|
|
|
+ array_multisort($sortData,SORT_DESC,$oddsData);
|
|
|
|
|
|
- $zu = [];
|
|
|
- foreach ($oddsData as $key1 =>$item1){
|
|
|
- $zu[$item1['p_code']][] = $item1;
|
|
|
+ $zu = [];
|
|
|
+ foreach ($oddsData as $key1 =>$item1){
|
|
|
+ $zu[$item1['p_code']][] = $item1;
|
|
|
+ }
|
|
|
+ $c_s = array_slice($zu['concede_size'],0,4);//让球/大小 前四条 放入
|
|
|
+ $capot = $zu['capot'];//独赢
|
|
|
+
|
|
|
+ $data[$k]['matchData'][$kk]['oddsData'] = [$c_s,$capot];
|
|
|
}
|
|
|
- $c_s = array_slice($zu['concede_size'],0,4);//让球/大小 前四条 放入
|
|
|
- $capot = $zu['capot'];//独赢
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- $data[$k]['matchData'][$kk]['oddsData'] = [$c_s,$capot];
|
|
|
+ //获取网球即将默认玩法赔率
|
|
|
+ if($ret['game_code'] == 'wq'){
|
|
|
+ foreach($data as $k => $v){
|
|
|
+ $matchData = $this->getOddsData->getOddsWQ($v['matchData'], $model_odds, $source,$oddsTypeWhere);
|
|
|
+ $data[$k]['matchData'] = $matchData;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //获取网球即将默认玩法赔率
|
|
|
+ if($ret['game_code'] == 'lq'){
|
|
|
+ foreach($data as $k => $v){
|
|
|
+ $matchData = $this->getOddsData->getOddsLQ($v['matchData'], $model_odds, $source,$oddsTypeWhere);
|
|
|
+ $data[$k]['matchData'] = $matchData;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //获取网球即将默认玩法赔率
|
|
|
+ if($ret['game_code'] == 'bq'){
|
|
|
+ foreach($data as $k => $v){
|
|
|
+ $matchData = $this->getOddsData->getOddsBQ($v['matchData'], $model_odds, $source,$oddsTypeWhere);
|
|
|
+ $data[$k]['matchData'] = $matchData;
|
|
|
}
|
|
|
}
|
|
|
return $data;
|
|
|
@@ -450,10 +475,19 @@ class GetmatchData {
|
|
|
->get()
|
|
|
->toArray();
|
|
|
|
|
|
+ $timeWhere = [];
|
|
|
+ if(!empty($time)){
|
|
|
+ if($time == 'other'){
|
|
|
+ $timeWhere[] = ['match_date','>',date("Y-m-d",strtotime("+1weeks",strtotime(date('Y-m-d',time()))))];
|
|
|
+ }else{
|
|
|
+ $timeWhere[] = ['match_date',$time];
|
|
|
+ }
|
|
|
+ }
|
|
|
$matchData = lm($model_match,'Sports')
|
|
|
->select('id','lg_id','match_id')
|
|
|
->where($where)
|
|
|
->where($source)
|
|
|
+ ->where($timeWhere)
|
|
|
->get()
|
|
|
->toArray();
|
|
|
|
|
|
@@ -730,6 +764,7 @@ class GetmatchData {
|
|
|
})
|
|
|
->get()
|
|
|
->toarray();
|
|
|
+
|
|
|
}else{//早盘 今天以后
|
|
|
$matchData = lm($model_match,"Sports")
|
|
|
->select($model_match.'.match_id',$model_match.'.tag','match_date',$model_match.'.match_time',$model_match.'.home_team',$model_match.'.guest_team')
|