Skip to content

賽果查詢

最後更新:2026-04-09


功能說明

賽果查詢讓使用者查看已完賽賽事的最終比分與詳細數據,支援三個體育平台(FB/DB/UP)、多種球類篩選、聯賽篩選,以及各球類的詳細比賽數據(比分板、技術統計等)。入口位於「我的」→ 體育選單。

使用者流程

  1. 進入「我的」→「體育」→「賽事成績」→ NewMatchResultViewModel 管理的頁面
  2. 頂部顯示平台切換(FB/DB/UP,依後台設定顯示)
  3. 球類篩選(足球/籃球/網球等,電子競技排除)
  4. 聯賽篩選(LeagueFilterViewController
  5. 賽果列表顯示:主客隊、比分、賽事時間
  6. 下拉刷新 / 上拉載入更多
  7. 點擊賽事 → MatchResultDetailViewController 查看詳情

詳情頁數據

  • 頂部:比分板(依球類不同顯示方式)
  • 足球:半場/全場比分、角球、黃/紅牌等
  • 籃球:各節比分
  • 網球:各盤比分
  • 其他:排球/冰球/棒球/橄欖球/MMA/桌球/美式足球等

頁面跳轉

  • 「我的」→ 體育選單 → 賽事成績頁(NewMatchResultViewModel 驅動)
  • 賽果列表點擊賽事 → MatchResultDetailViewController(詳情)
  • 篩選按鈕 → LeagueFilterViewController(聯賽篩選)

技術視角(開發看這裡)

相關檔案

類型檔案路徑
ViewController(賽果列表)/Users/user/Work/bbsport-new/BBSport/Tab/我的/Mine/SportMenu/EventResult/New/NewMatchResultViewController.swift
View(賽果列表)/Users/user/Work/bbsport-new/BBSport/Tab/我的/Mine/SportMenu/EventResult/New/NewMatchResultView.swift
ViewModel(賽果列表)/Users/user/Work/bbsport-new/BBSport/Tab/我的/Mine/SportMenu/EventResult/New/NewMatchResultViewModel.swift
ViewController(詳情)/Users/user/Work/bbsport-new/BBSport/Tab/我的/Mine/SportMenu/EventResult/Detail/MatchResultDetailViewController.swift
ViewModel(詳情)/Users/user/Work/bbsport-new/BBSport/Tab/我的/Mine/SportMenu/EventResult/Detail/MatchResultDetailViewModel.swift
ViewController(聯賽篩選)/Users/user/Work/bbsport-new/BBSport/Tab/我的/Mine/SportMenu/EventResult/LeagueFilter/LeagueFilterViewController.swift
Model(足球詳情)/Users/user/Work/bbsport-new/BBSport/Tab/我的/Mine/SportMenu/EventResult/Detail/Model/MatchDetailModel+FootBall.swift
Model(籃球詳情)/Users/user/Work/bbsport-new/BBSport/Tab/我的/Mine/SportMenu/EventResult/Detail/Model/MatchDetailModel+BasketBall.swift
DB 基底類/Users/user/Work/bbsport-new/BBSport/Tab/我的/Mine/SportMenu/EventResult/DB/MatchResultDB.swift
DB(FB 快取)/Users/user/Work/bbsport-new/BBSport/Tab/我的/Mine/SportMenu/EventResult/DB/FBMatchResultDB.swift
DB(UP 快取)/Users/user/Work/bbsport-new/BBSport/Tab/我的/Mine/SportMenu/EventResult/DB/UPMatchResultDB.swift
DB(DB 快取)/Users/user/Work/bbsport-new/BBSport/Tab/我的/Mine/SportMenu/EventResult/DB/DBMatchResultDB.swift
API(FB 賽果列表)/Users/user/Work/bbsport-new/BBSport/API/FBSportAPI/MatchResult/FBSportAPI+MatchResultListRequest.swift
API(FB 賽果詳情)/Users/user/Work/bbsport-new/BBSport/API/FBSportAPI/MatchResult/FBSportAPI+MatchResultDetailRequest.swift
API(UP 賽果列表)/Users/user/Work/bbsport-new/BBSport/API/UPSportAPI/MatchResult/UPSportAPI+MatchResultListRequest.swift
API(UP 賽果詳情)/Users/user/Work/bbsport-new/BBSport/API/UPSportAPI/MatchResult/UPSportAPI+MatchResultDetailRequest.swift
API(DB 賽果)/Users/user/Work/bbsport-new/BBSport/API/DBSportAPI/Sport/DBSportAPI+MatcheResultRequest.swift
API(DB 冠軍賽果)/Users/user/Work/bbsport-new/BBSport/API/DBSportAPI/Sport/DBSportAPI+ChampionMatchResultRequest.swift

API

功能說明NamespaceEndpointMethod主要參數
FB 賽果列表FBSportAPIv1/match/matchResultPagePOST json分頁參數
FB 賽果詳情FBSportAPIv1/match/matchResultInfoPOST json賽事 ID
DB 賽果列表DBSportAPIyewu11/v1/m/matcheResultPBPOST json球類/日期等
DB 冠軍賽果DBSportAPIyewu11/api/result/championMatchResultPBPOST json賽事參數
UP 賽果列表UPSportAPIv1/match/matchResultPagePOST json分頁參數
UP 賽果詳情UPSportAPIv1/match/matchResultInfoPOST json賽事 ID

資料模型

FB MatchResultListRequest Response

欄位說明
records[STEventModel] 賽事列表
current當前頁碼
size每頁數量
total總筆數
isLastPage計算屬性,current >= ceil(total/size)

NewMatchResultViewModel 關鍵屬性

屬性說明
sourceType當前平台(STBindingVariable<GameType>
filterLeagueIds已選聯賽 ID(0筆=全選)
isRenew是否強制刷新
delayUpdate防連續呼叫的延遲更新

實作重點

  1. 平台切換supportSourceTypesGameStatusManager.shared.supportSportGameTypes 動態決定;切換平台時重置篩選條件

  2. 防抖更新filterLeagueIds 改變 → delayUpdate.call() 延遲執行,避免快速切換造成多次請求

  3. 多球類 Model 擴展:詳情頁各球類數據以 Swift Extension 分離(MatchDetailModel+FootBall.swift 等),共 10 種球類

  4. 本地快取(MatchResultDB):賽果數據有本地 DB 快取機制,優先顯示快取,背景更新

  5. 聯賽篩選LeagueFilterViewController 顯示所有聯賽(以首字母分組),使用 SectionIndexView 快速跳轉


API 呼叫流程

進入賽果頁面 (NewMatchResultViewController)

viewDidLoad
  └─ [並行, 三平台] 請求賽果列表
     ├─ FB: POST v1/match/matchResultPage
     │  {sportId:"", beginTime, endTime, currentPage:1, size:20, matchType}

     ├─ DB: POST DB 對應端點 (同結構)

     └─ UP: POST UP 對應端點 (同結構)
     
     → 回傳: records[STEventModel], total, isLastPage
     → 依聯賽分組顯示

篩選

切換球種/日期/聯賽
  └─ 更新 sportId, beginTime, endTime 參數
     └─ 重新請求 (currentPage = 1)

分頁

上拉載入更多 → currentPage += 1
  └─ 追加結果至列表