|
|
@@ -165,20 +165,35 @@ class MatchListWeb extends Controller{
|
|
|
}
|
|
|
$model_match = $models['model_match'];
|
|
|
//赛事数据
|
|
|
- $matchNum = lm($models['model_league'],"Sports")
|
|
|
- ->join($models['model_match'],$models['model_match'].'.lg_id',$models['model_league'].'.lg_id')
|
|
|
- ->select($select)
|
|
|
- ->where($models['model_match'].'.source',$this->source['source'])
|
|
|
- ->where($where)
|
|
|
- ->whereIn($models['model_league'].'.lg_id',$lg_ids)//联赛id筛选
|
|
|
- ->where($timeWhere)//时间条件
|
|
|
- ->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(!empty($lg_ids)){
|
|
|
+ $matchNum = lm($models['model_league'],"Sports")
|
|
|
+ ->join($model_match,$model_match.'.lg_id',$models['model_league'].'.lg_id')
|
|
|
+ ->select($select)
|
|
|
+ ->where($where)//状态条件
|
|
|
+ ->whereIn($models['model_league'].'.lg_id',$lg_ids)//联赛id筛选
|
|
|
+ ->where($timeWhere)//时间条件
|
|
|
+ ->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{
|
|
|
+ $matchNum = lm($models['model_league'],"Sports")
|
|
|
+ ->join($model_match,$model_match.'.lg_id',$models['model_league'].'.lg_id')
|
|
|
+ ->select($select)
|
|
|
+ ->where($where)//状态条件
|
|
|
+ ->where($timeWhere)//时间条件
|
|
|
+ ->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(empty($matchNum)) return $matchNum;
|
|
|
|
|
|
//赔率数据
|