From 9ad49bad57102f101521dd17d45d181aaceabc0c Mon Sep 17 00:00:00 2001 From: hajimi Date: Mon, 3 Aug 2026 02:18:32 +0800 Subject: [PATCH] fix: load hot league matches for all filter --- server/app/api/controller/MatchController.php | 12 +++++++ uniapp/src/api/match.ts | 11 ++++++- .../components/MatchCenterTabsPanel.vue | 31 +++++++++---------- 3 files changed, 36 insertions(+), 18 deletions(-) diff --git a/server/app/api/controller/MatchController.php b/server/app/api/controller/MatchController.php index 8f1d2a1..5222914 100644 --- a/server/app/api/controller/MatchController.php +++ b/server/app/api/controller/MatchController.php @@ -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)) { diff --git a/uniapp/src/api/match.ts b/uniapp/src/api/match.ts index 646a85d..ba746cb 100644 --- a/uniapp/src/api/match.ts +++ b/uniapp/src/api/match.ts @@ -128,7 +128,16 @@ export interface WorldCupOddsMatchItem { export type MatchLiveCardItem = WorldCupLiveCardItem export type MatchOddsMatchItem = WorldCupOddsMatchItem -export function getMatchList(data?: Record) { +export interface MatchListParams { + sport_type?: number + league_name?: string + hot_only?: 0 | 1 + ended_page?: number + ended_page_size?: number + ended_only?: 0 | 1 +} + +export function getMatchList(data?: MatchListParams) { return request.get({ url: '/match/lists', data: data }, { withToken: false }) } diff --git a/uniapp/src/packages_match/components/MatchCenterTabsPanel.vue b/uniapp/src/packages_match/components/MatchCenterTabsPanel.vue index 1017ab6..27b5efe 100644 --- a/uniapp/src/packages_match/components/MatchCenterTabsPanel.vue +++ b/uniapp/src/packages_match/components/MatchCenterTabsPanel.vue @@ -44,7 +44,7 @@ - {{ hotLeagueMode ? '全部热门' : '全部' }} + 全部 - + @@ -79,8 +79,7 @@ 加载中... - + 没有更多赛事了 @@ -131,8 +130,10 @@ {{ liveAnchorName(live) }} - 观看 {{ formatLiveCount(live.room_view_count) }} - 关注 {{ formatLiveCount(live.room_focus_count) }} + 观看 {{ formatLiveCount(live.room_view_count) + }} + 关注 {{ formatLiveCount(live.room_focus_count) + }} {{ liveRoomNotice(live) }} @@ -145,12 +146,10 @@ - - {{ item.label }} @@ -225,7 +224,7 @@ {{ platform.show_type_text }} {{ formatOddsUpdateTime(platform.update_time) - }} + }} { } const filterScheduleItems = (items: any[]) => { - const dateFiltered = selectedDateKey.value + return selectedDateKey.value ? items.filter((item: any) => getMatchDateKey(item) === selectedDateKey.value) : items - if (!hotLeagueMode.value || currentLeague.value) return dateFiltered - const hotLeagueNames = new Set(leagueTabs.value.map((item: any) => String(item?.league_name || ''))) - return dateFiltered.filter((item: any) => hotLeagueNames.has(String(item?.league_name || ''))) } const leagueTabs = computed(() => { @@ -505,6 +501,7 @@ const fetchMatchList = async (refresh = false) => { } if (currentSport.value > 0) params.sport_type = currentSport.value if (currentLeague.value) params.league_name = currentLeague.value + if (hotLeagueMode.value && !currentLeague.value) params.hot_only = 1 if (!refresh) params.ended_only = 1 const data = await getMatchList(params) if (refresh) { @@ -1455,7 +1452,7 @@ onMounted(() => { padding-top: 14rpx; border-top: 1rpx solid #eef2f7; - & + & { + &+& { margin-top: 14rpx; } }