join($model_match,$model_match.'.lg_id',$model_league.'.id') ->select($model_league.'.id as lg_id',$model_league.'.name_chinese as leagueName') ->distinct($model_league.'.name_chinese') ->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.'.id') ->select($model_league.'.id as lg_id',$model_league.'.name_chinese as leagueName') ->distinct($model_league.'.name_chinese') ->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']; $model_odds = $models['model_odds']; //当前状态下所有联赛 $data = lm($model_league,"Sports") ->join($model_match,$model_match.'.lg_id',$model_league.'.id') ->select($model_league.'.id as lg_id',$model_league.'.name_chinese as leagueName',$model_match.'.id as 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',$model_match.'.is_rollball',$model_match.'.is_today') ->where([[$model_league.'.name_chinese','!=','']]) ->where([[$model_match.'.status','<',2]]) ->get() ->toArray(); return $data; } }