From a8a678a5f605ee661725cfb2477471e44cf63536 Mon Sep 17 00:00:00 2001 From: hajimi Date: Sun, 21 Jun 2026 13:02:22 +0800 Subject: [PATCH] fix: map live fetch status failure code --- qa/frontend/test_match_detail_live_static.py | 12 ++++++++++++ .../components/match-live-popup/match-live-popup.vue | 4 ++-- uniapp/src/pages/match_detail/match_detail.vue | 4 ++-- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/qa/frontend/test_match_detail_live_static.py b/qa/frontend/test_match_detail_live_static.py index 8a0cc35..5020f82 100644 --- a/qa/frontend/test_match_detail_live_static.py +++ b/qa/frontend/test_match_detail_live_static.py @@ -45,6 +45,18 @@ def main() -> None: "popup selection reset should prefer default_play_url" assert re.search(r"fetch_status.*last_fetch_at", popup_source, re.S) or "update_time" in popup_source, \ "popup metadata should use fetch_status and last_fetch_at/update_time" + assert re.search(r"normalized === '0'.*待抓取", popup_source, re.S), \ + "popup should map fetch_status 0 to pending label" + assert re.search(r"normalized === '1'.*已抓取", popup_source, re.S), \ + "popup should map fetch_status 1 to success label" + assert re.search(r"normalized === '2'.*抓取失败", popup_source, re.S), \ + "popup should map fetch_status 2 to failure label" + assert re.search(r"normalized === '0'.*待抓取", detail_source, re.S), \ + "page should map fetch_status 0 to pending label" + assert re.search(r"normalized === '1'.*已抓取", detail_source, re.S), \ + "page should map fetch_status 1 to success label" + assert re.search(r"normalized === '2'.*抓取失败", detail_source, re.S), \ + "page should map fetch_status 2 to failure label" assert "/match/detail" in api_source, "match detail API path should stay on /match/detail" diff --git a/uniapp/src/components/match-live-popup/match-live-popup.vue b/uniapp/src/components/match-live-popup/match-live-popup.vue index 44ef0ec..2c23caa 100644 --- a/uniapp/src/components/match-live-popup/match-live-popup.vue +++ b/uniapp/src/components/match-live-popup/match-live-popup.vue @@ -71,9 +71,9 @@ const getFetchStatusText = (value: unknown) => { const text = normalizeText(value) if (!text) return '' const normalized = text.toLowerCase() - if (normalized === 'success' || normalized === '1') return '已抓取' if (normalized === 'pending' || normalized === '0') return '待抓取' - if (normalized === 'failed' || normalized === '-1') return '抓取失败' + if (normalized === 'success' || normalized === '1') return '已抓取' + if (normalized === 'failed' || normalized === 'error' || normalized === '2') return '抓取失败' return text } diff --git a/uniapp/src/pages/match_detail/match_detail.vue b/uniapp/src/pages/match_detail/match_detail.vue index add4972..1b18d44 100644 --- a/uniapp/src/pages/match_detail/match_detail.vue +++ b/uniapp/src/pages/match_detail/match_detail.vue @@ -518,9 +518,9 @@ const getLiveFetchStatusText = (value: unknown) => { const text = normalizeLiveText(value) if (!text) return '' const normalized = text.toLowerCase() - if (normalized === 'success' || normalized === '1') return '已抓取' if (normalized === 'pending' || normalized === '0') return '待抓取' - if (normalized === 'failed' || normalized === '-1') return '抓取失败' + if (normalized === 'success' || normalized === '1') return '已抓取' + if (normalized === 'failed' || normalized === 'error' || normalized === '2') return '抓取失败' return text }