|
@@ -49,7 +49,11 @@ class GetmatchData {
|
|
|
if(empty($ret['match_date'])){
|
|
if(empty($ret['match_date'])){
|
|
|
$match_date = date("Y-m-d");
|
|
$match_date = date("Y-m-d");
|
|
|
}else{
|
|
}else{
|
|
|
- $match_date = $ret['match_date'];
|
|
|
|
|
|
|
+ if($ret['match_date'] == 'other'){
|
|
|
|
|
+ $match_date = $ret['match_date'];
|
|
|
|
|
+ }else{
|
|
|
|
|
+ $match_date = date("Y-m-d");
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
$data = $this->getMorningPlate($source,$models,$where,$lg_id,$search,$match_date);
|
|
$data = $this->getMorningPlate($source,$models,$where,$lg_id,$search,$match_date);
|
|
|
break;
|
|
break;
|
|
@@ -343,6 +347,12 @@ class GetmatchData {
|
|
|
|
|
|
|
|
//根据联赛id 获取联赛下 冠军玩法盘口
|
|
//根据联赛id 获取联赛下 冠军玩法盘口
|
|
|
if($lg_id >0){
|
|
if($lg_id >0){
|
|
|
|
|
+ $last_time = lm($model_league, 'Sports')
|
|
|
|
|
+ ->select('last_time')
|
|
|
|
|
+// ->where($model_odds.'.expire_time','>',date("Y-m-d H:i:s"))
|
|
|
|
|
+ ->where($source)
|
|
|
|
|
+ ->where('lg_id',$lg_id)
|
|
|
|
|
+ ->first()->last_time;
|
|
|
$championData = lm($model_odds, 'Sports')
|
|
$championData = lm($model_odds, 'Sports')
|
|
|
->select("id","lg_id","p_code","odds_code","team","odds","sort","status","odds_only")
|
|
->select("id","lg_id","p_code","odds_code","team","odds","sort","status","odds_only")
|
|
|
// ->where($model_odds.'.expire_time','>',date("Y-m-d H:i:s"))
|
|
// ->where($model_odds.'.expire_time','>',date("Y-m-d H:i:s"))
|
|
@@ -361,6 +371,7 @@ class GetmatchData {
|
|
|
$sd = [];
|
|
$sd = [];
|
|
|
foreach ($p_code as $k1=>$v1){
|
|
foreach ($p_code as $k1=>$v1){
|
|
|
foreach ($v1 as $k2=>$v2){
|
|
foreach ($v1 as $k2=>$v2){
|
|
|
|
|
+ $sd[$v2['p_code']]['last_time'] =$last_time;
|
|
|
$sd[$v2['p_code']][$v2['odds_code']][] = $v2;
|
|
$sd[$v2['p_code']][$v2['odds_code']][] = $v2;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -380,6 +391,7 @@ class GetmatchData {
|
|
|
$country = lm($model_league,"Sports")
|
|
$country = lm($model_league,"Sports")
|
|
|
->leftjoin('st_country','st_country.country_id',$model_league.'.country_id')
|
|
->leftjoin('st_country','st_country.country_id',$model_league.'.country_id')
|
|
|
->select('st_country.country_id as region_id','st_country.name_chinese as region')
|
|
->select('st_country.country_id as region_id','st_country.name_chinese as region')
|
|
|
|
|
+// ->select('st_country.country_id as region_id','st_country.name_chinese as region',$model_league.'.lg_id', $model_league.'.name_chinese as league')
|
|
|
->distinct('st_country.name_chinese')
|
|
->distinct('st_country.name_chinese')
|
|
|
->where($model_league.'.source',$source['source'])
|
|
->where($model_league.'.source',$source['source'])
|
|
|
->where($model_league.'.name_chinese','like','%'.$search.'%')
|
|
->where($model_league.'.name_chinese','like','%'.$search.'%')
|
|
@@ -389,6 +401,7 @@ class GetmatchData {
|
|
|
$area = lm($model_league,"Sports")
|
|
$area = lm($model_league,"Sports")
|
|
|
->leftjoin('st_area','st_area.id',$model_league.'.area_id')
|
|
->leftjoin('st_area','st_area.id',$model_league.'.area_id')
|
|
|
->select('st_area.id as region_id','st_area.title as region')
|
|
->select('st_area.id as region_id','st_area.title as region')
|
|
|
|
|
+// ->select('st_area.id as region_id','st_area.title as region',$model_league.'.lg_id', $model_league.'.name_chinese as league')
|
|
|
->distinct('st_area.title')
|
|
->distinct('st_area.title')
|
|
|
->where($model_league.'.source',$source['source'])
|
|
->where($model_league.'.source',$source['source'])
|
|
|
->where($model_league.'.name_chinese','like','%'.$search.'%')
|
|
->where($model_league.'.name_chinese','like','%'.$search.'%')
|
|
@@ -419,13 +432,16 @@ class GetmatchData {
|
|
|
foreach($v['league_count'] as $kk => $vv ){
|
|
foreach($v['league_count'] as $kk => $vv ){
|
|
|
if(!empty($model_odds)){//冠军玩法,获取赔率盘口数量
|
|
if(!empty($model_odds)){//冠军玩法,获取赔率盘口数量
|
|
|
$where = getState('StChampion');
|
|
$where = getState('StChampion');
|
|
|
- $country[$k]['league_count'][$kk]['count'] = lm($model_odds, 'Sports')->select("p_code")
|
|
|
|
|
|
|
+ $country[$k]['league_count'][$kk]['count'] = lm($model_odds, 'Sports')
|
|
|
|
|
+ ->select("p_code")
|
|
|
->where($source)
|
|
->where($source)
|
|
|
->where('lg_id',$vv['lg_id'])
|
|
->where('lg_id',$vv['lg_id'])
|
|
|
->where($where)
|
|
->where($where)
|
|
|
// ->where($model_odds.'.expire_time','>',date("Y-m-d H:i:s"))
|
|
// ->where($model_odds.'.expire_time','>',date("Y-m-d H:i:s"))
|
|
|
- ->groupby("p_code")->count("*");
|
|
|
|
|
|
|
+ ->distinct("p_code")
|
|
|
|
|
+ ->count("p_code");
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
if(!empty($model_match)){//非冠军玩法,获取联赛下赛事数量
|
|
if(!empty($model_match)){//非冠军玩法,获取联赛下赛事数量
|
|
|
if(empty($time)){
|
|
if(empty($time)){
|
|
|
$country[$k]['league_count'][$kk]['count'] = lm($model_match, 'Sports')
|
|
$country[$k]['league_count'][$kk]['count'] = lm($model_match, 'Sports')
|
|
@@ -435,13 +451,24 @@ class GetmatchData {
|
|
|
->where($where)
|
|
->where($where)
|
|
|
->count("*");
|
|
->count("*");
|
|
|
}else{
|
|
}else{
|
|
|
- $country[$k]['league_count'][$kk]['count'] = lm($model_match, 'Sports')
|
|
|
|
|
- ->select("match_id")
|
|
|
|
|
- ->where($source)
|
|
|
|
|
- ->where('lg_id',$vv['lg_id'])
|
|
|
|
|
- ->where($where)
|
|
|
|
|
- ->where('match_date',$time)
|
|
|
|
|
- ->count("*");
|
|
|
|
|
|
|
+ if($time == 'other'){
|
|
|
|
|
+ $country[$k]['league_count'][$kk]['count'] = lm($model_match, 'Sports')
|
|
|
|
|
+ ->select("match_id")
|
|
|
|
|
+ ->where($source)
|
|
|
|
|
+ ->where('lg_id',$vv['lg_id'])
|
|
|
|
|
+ ->where($where)
|
|
|
|
|
+ ->where('match_date','>',date("Y-m-d",strtotime("+1weeks",strtotime(date('Y-m-d',time())))))
|
|
|
|
|
+ ->count("*");
|
|
|
|
|
+ }else{
|
|
|
|
|
+ $country[$k]['league_count'][$kk]['count'] = lm($model_match, 'Sports')
|
|
|
|
|
+ ->select("match_id")
|
|
|
|
|
+ ->where($source)
|
|
|
|
|
+ ->where('lg_id',$vv['lg_id'])
|
|
|
|
|
+ ->where($where)
|
|
|
|
|
+ ->where('match_date','>',date("Y-m-d",strtotime("+1weeks",strtotime(date('Y-m-d',time())))))
|
|
|
|
|
+ ->count("*");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
if($country[$k]['league_count'][$kk]['count'] == 0){
|
|
if($country[$k]['league_count'][$kk]['count'] == 0){
|
|
@@ -450,6 +477,7 @@ class GetmatchData {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
//统计 地区 联赛-赛事/盘口数量
|
|
//统计 地区 联赛-赛事/盘口数量
|
|
|
if(!empty($area)){
|
|
if(!empty($area)){
|
|
|
foreach($area as $k => $v) {
|
|
foreach($area as $k => $v) {
|
|
@@ -470,7 +498,8 @@ class GetmatchData {
|
|
|
->where('lg_id',$vv['lg_id'])
|
|
->where('lg_id',$vv['lg_id'])
|
|
|
->where($where)
|
|
->where($where)
|
|
|
// ->where($model_odds.'.expire_time','>',date("Y-m-d H:i:s"))
|
|
// ->where($model_odds.'.expire_time','>',date("Y-m-d H:i:s"))
|
|
|
- ->groupby("p_code")->count("*");
|
|
|
|
|
|
|
+ ->distinct("p_code")
|
|
|
|
|
+ ->count("p_code");
|
|
|
}
|
|
}
|
|
|
if(!empty($model_match)){//非冠军玩法,获取联赛下赛事数量
|
|
if(!empty($model_match)){//非冠军玩法,获取联赛下赛事数量
|
|
|
if(empty($time)){
|
|
if(empty($time)){
|
|
@@ -480,15 +509,26 @@ class GetmatchData {
|
|
|
->where('lg_id',$vv['lg_id'])
|
|
->where('lg_id',$vv['lg_id'])
|
|
|
->where($where)
|
|
->where($where)
|
|
|
->count("*");
|
|
->count("*");
|
|
|
- }else{
|
|
|
|
|
- $area[$k]['league_count'][$kk]['count'] = lm($model_match, 'Sports')
|
|
|
|
|
- ->select("match_id")
|
|
|
|
|
- ->where($source)
|
|
|
|
|
- ->where('lg_id',$vv['lg_id'])
|
|
|
|
|
- ->where($where)
|
|
|
|
|
- ->where('match_date',$time)
|
|
|
|
|
- ->count("*");
|
|
|
|
|
- } }
|
|
|
|
|
|
|
+ }else {
|
|
|
|
|
+ if ($time == 'other') {
|
|
|
|
|
+ $area[$k]['league_count'][$kk]['count'] = lm($model_match, 'Sports')
|
|
|
|
|
+ ->select("match_id")
|
|
|
|
|
+ ->where($source)
|
|
|
|
|
+ ->where('lg_id', $vv['lg_id'])
|
|
|
|
|
+ ->where($where)
|
|
|
|
|
+ ->where('match_date', '>', date("Y-m-d", strtotime("+1weeks", strtotime(date('Y-m-d', time())))))
|
|
|
|
|
+ ->count("*");
|
|
|
|
|
+ } else {
|
|
|
|
|
+ $area[$k]['league_count'][$kk]['count'] = lm($model_match, 'Sports')
|
|
|
|
|
+ ->select("match_id")
|
|
|
|
|
+ ->where($source)
|
|
|
|
|
+ ->where('lg_id', $vv['lg_id'])
|
|
|
|
|
+ ->where('match_date','>',date("Y-m-d",strtotime("+1weeks",strtotime(date('Y-m-d',time())))))
|
|
|
|
|
+ ->where('match_date', $time)
|
|
|
|
|
+ ->count("*");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
if($area[$k]['league_count'][$kk]['count'] == 0){
|
|
if($area[$k]['league_count'][$kk]['count'] == 0){
|
|
|
unset($area[$k]['league_count'][$kk]);
|
|
unset($area[$k]['league_count'][$kk]);
|
|
|
}
|
|
}
|
|
@@ -516,20 +556,38 @@ class GetmatchData {
|
|
|
->where('lg_id',$lg_id)
|
|
->where('lg_id',$lg_id)
|
|
|
->first();
|
|
->first();
|
|
|
if(!empty($time)){
|
|
if(!empty($time)){
|
|
|
- $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')
|
|
|
|
|
- ->where($source)
|
|
|
|
|
- ->where($model_match.'.lg_id',$lg_id)
|
|
|
|
|
- ->where($where)
|
|
|
|
|
- ->where('match_date',$time)
|
|
|
|
|
- ->where(function($query)use ($model_match,$search){
|
|
|
|
|
- $query->where($model_match.'.home_team','like','%'.$search.'%')
|
|
|
|
|
- ->orWhere(function($query)use ($model_match,$search) {
|
|
|
|
|
- $query->where($model_match . '.guest_team', 'like', '%' . $search . '%');
|
|
|
|
|
- });
|
|
|
|
|
- })
|
|
|
|
|
- ->get()
|
|
|
|
|
- ->toarray();
|
|
|
|
|
|
|
+ if($time == 'other'){
|
|
|
|
|
+ $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')
|
|
|
|
|
+ ->where($source)
|
|
|
|
|
+ ->where($model_match.'.lg_id',$lg_id)
|
|
|
|
|
+ ->where($where)
|
|
|
|
|
+ ->where('match_date','>',date("Y-m-d",strtotime("+1weeks",strtotime(date('Y-m-d',time())))))
|
|
|
|
|
+ ->where(function($query)use ($model_match,$search){
|
|
|
|
|
+ $query->where($model_match.'.home_team','like','%'.$search.'%')
|
|
|
|
|
+ ->orWhere(function($query)use ($model_match,$search) {
|
|
|
|
|
+ $query->where($model_match . '.guest_team', 'like', '%' . $search . '%');
|
|
|
|
|
+ });
|
|
|
|
|
+ })
|
|
|
|
|
+ ->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')
|
|
|
|
|
+ ->where($source)
|
|
|
|
|
+ ->where($model_match.'.lg_id',$lg_id)
|
|
|
|
|
+ ->where($where)
|
|
|
|
|
+ ->where('match_date',$time)
|
|
|
|
|
+ ->where(function($query)use ($model_match,$search){
|
|
|
|
|
+ $query->where($model_match.'.home_team','like','%'.$search.'%')
|
|
|
|
|
+ ->orWhere(function($query)use ($model_match,$search) {
|
|
|
|
|
+ $query->where($model_match . '.guest_team', 'like', '%' . $search . '%');
|
|
|
|
|
+ });
|
|
|
|
|
+ })
|
|
|
|
|
+ ->get()
|
|
|
|
|
+ ->toarray();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}else{
|
|
}else{
|
|
|
$matchData = lm($model_match,"Sports")
|
|
$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')
|
|
->select($model_match.'.match_id',$model_match.'.tag','match_date',$model_match.'.match_time',$model_match.'.home_team',$model_match.'.guest_team')
|
|
@@ -630,4 +688,84 @@ class GetmatchData {
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 获取欧冠 赛事数据
|
|
|
|
|
+ */
|
|
|
|
|
+ public function getUEFAChampions($source){
|
|
|
|
|
+ $model = getModels('gj',1);
|
|
|
|
|
+ //获取滚球数据
|
|
|
|
|
+ $StRollBall = $this->getUEFAMatchData($model,'StRollBall',$source);
|
|
|
|
|
+ //获取滚球数据
|
|
|
|
|
+ $StToday = $this->getUEFAMatchData($model,'StToday',$source);
|
|
|
|
|
+ //获取滚球数据
|
|
|
|
|
+ $StMorningPlate = $this->getUEFAMatchData($model,'StMorningPlate',$source);
|
|
|
|
|
+ //获取滚球数据
|
|
|
|
|
+ $StChampion = $this->getUEFAMatchData($model,'StChampion',$source);
|
|
|
|
|
+
|
|
|
|
|
+ $data = [
|
|
|
|
|
+ 'StRollBall'=>[//滚球数据
|
|
|
|
|
+ 'typeName'=>'滚球',
|
|
|
|
|
+ 'matchNum'=>count($StRollBall),
|
|
|
|
|
+ 'matchData'=>$StRollBall
|
|
|
|
|
+ ],
|
|
|
|
|
+ 'StToday'=>[//今日数据
|
|
|
|
|
+ 'typeName'=>'今日',
|
|
|
|
|
+ 'matchNum'=>count($StToday),
|
|
|
|
|
+ 'matchData'=>$StToday
|
|
|
|
|
+ ],
|
|
|
|
|
+ 'StMorningPlate'=>[//早盘数据
|
|
|
|
|
+ 'typeName'=>'早盘',
|
|
|
|
|
+ 'matchNum'=>count($StMorningPlate),
|
|
|
|
|
+ 'matchData'=>$StMorningPlate
|
|
|
|
|
+ ],
|
|
|
|
|
+ 'StChampion'=>[//冠军盘口
|
|
|
|
|
+ 'typeName'=>'冠军盘口',
|
|
|
|
|
+ 'matchNum'=>count($StChampion),
|
|
|
|
|
+ 'matchData'=>$StChampion
|
|
|
|
|
+ ]
|
|
|
|
|
+ ];
|
|
|
|
|
+
|
|
|
|
|
+ return $data;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 获取欧冠 各状态赛事及赔率数据
|
|
|
|
|
+ */
|
|
|
|
|
+ public function getUEFAMatchData($model,$type_code,$source){
|
|
|
|
|
+ $model_league = $model['model_league'];
|
|
|
|
|
+ $model_match = $model['model_match'];
|
|
|
|
|
+ $model_odds = $model['model_odds'];
|
|
|
|
|
+
|
|
|
|
|
+ $where = getState($type_code,$model_match);
|
|
|
|
|
+
|
|
|
|
|
+ if($type_code != 'StChampion'){
|
|
|
|
|
+ $matchData = lm($model_match,'Sports')
|
|
|
|
|
+ ->leftjoin($model_league,$model_league.'.lg_id',$model_match.'.lg_id')
|
|
|
|
|
+ ->select($model_league.'.name_chinese',$model_match.'.match_id','match_date','match_time','tag','home_team','guest_team')
|
|
|
|
|
+ ->where($model_match.'.source',$source['source'])
|
|
|
|
|
+ ->where($where)
|
|
|
|
|
+ ->where($model_league.'.name_chinese','欧洲冠军杯')
|
|
|
|
|
+
|
|
|
|
|
+ ->get()->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','p_code', 'odds_code','odds_only', $model_odds . '.status', 'odds', 'condition', 'sort')
|
|
|
|
|
+ ->where($model_match.'.source',$source['source'])
|
|
|
|
|
+ ->where([$model_odds . '.match_id' => $vv['match_id']])
|
|
|
|
|
+// ->where($model_odds.'.expire_time','>',date("Y-m-d H:i:s"))
|
|
|
|
|
+ ->groupBy($model_odds . '.id','p_code', 'odds_code','odds_only', $model_odds . '.status', 'odds', 'condition', 'sort')
|
|
|
|
|
+ ->orderBy($model_odds . '.id','desc')
|
|
|
|
|
+ ->get()
|
|
|
|
|
+ ->toarray();
|
|
|
|
|
+ $matchData[$kk]['oddsData'] = $oddsData;
|
|
|
|
|
+ }
|
|
|
|
|
+ }else{
|
|
|
|
|
+ $matchData = [];
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return $matchData;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|