fix: load hot league matches for all filter

This commit is contained in:
hajimi
2026-08-03 02:18:32 +08:00
parent a7c4e3f673
commit 9ad49bad57
3 changed files with 36 additions and 18 deletions
@@ -94,6 +94,7 @@ class MatchController extends BaseApiController
{
$sportType = $this->request->get('sport_type/d', 0);
$leagueName = $this->request->get('league_name/s', '');
$hotOnly = $this->request->get('hot_only/d', 0);
$endedPage = $this->request->get('ended_page/d', 1);
$endedPageSize = $this->request->get('ended_page_size/d', 20);
$endedOnly = $this->request->get('ended_only/d', 0);
@@ -107,6 +108,17 @@ class MatchController extends BaseApiController
}
if (!empty($leagueName)) {
$baseWhere[] = ['league_name', '=', $leagueName];
} elseif ($hotOnly) {
$hotLeagueQuery = League::where('is_show', 1)
->where('type', 'league')
->where('is_hot', 1);
if ($sportType > 0) {
$hotLeagueQuery->where('sport_type', $sportType);
}
$hotLeagues = $hotLeagueQuery->column('label');
$baseWhere[] = !empty($hotLeagues)
? ['league_name', 'in', $hotLeagues]
: ['id', '=', 0];
} elseif ($sportType <= 0) {
$validLeagues = League::where('is_show', 1)->where('type', 'league')->column('label');
if (!empty($validLeagues)) {