join($model_match,$model_match.'.lg_id',$model_league.'.lg_id') ->join($model_result,$model_result.'.match_id',$model_match.'.match_id') ->select($model_league.'.lg_id',$model_league.'.name_chinese as leagueName') ->distinct($model_league.'.name_chinese') ->where($model_league.'.source',$source['source']) ->where([[$model_league.'.name_chinese','!=','']]) ->where($where) ->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(); return $data; } //获取即将 联赛数据 public static function getSoonLeagueData($source,$models,$where,$search=''){ $model_match = $models['model_match']; $model_league = $models['model_league']; $model_result = $models['model_result']; //当前状态下所有联赛 $data = lm($model_league,"Sports") ->join($model_match,$model_match.'.lg_id',$model_league.'.lg_id') ->select($model_league.'.lg_id',$model_league.'.name_chinese as leagueName') ->distinct($model_league.'.name_chinese') ->where($model_league.'.source',$source['source']) ->where([[$model_league.'.name_chinese','!=','']]) ->where($where) ->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(); return $data; } //获取非滚球 联赛下赛事数据 用于统计数量 public static function getLeagueMatchData($models,$where){ $model_match = $models['model_match']; $model_league = $models['model_league']; $model_result = $models['model_result']; //当前状态下所有联赛 $data = lm($model_league,"Sports") ->join($model_match,$model_match.'.lg_id',$model_league.'.lg_id') ->select($model_league.'.lg_id',$model_league.'.name_chinese as leagueName',$model_match.'.id',$model_match.'.match_id',$model_match.'.status',$model_match.'.match_date',$model_match.'.match_time',$model_match.'.us_time',$model_match.'.is_morningplate',$model_match.'.is_stringscene') ->where([[$model_league.'.name_chinese','!=','']]) ->where([[$model_match.'.status','<',2]]) ->get() ->toarray(); return $data; } }