Appearance
賽果查詢
最後更新:2026-04-09
功能說明
賽果查詢讓使用者查看已完賽賽事的最終比分與詳細數據,支援三個體育平台(FB/DB/UP)、多種球類篩選、聯賽篩選,以及各球類的詳細比賽數據(比分板、技術統計等)。入口位於「我的」→ 體育選單。
使用者流程
- 進入「我的」→「體育」→「賽事成績」→
NewMatchResultViewModel管理的頁面 - 頂部顯示平台切換(FB/DB/UP,依後台設定顯示)
- 球類篩選(足球/籃球/網球等,電子競技排除)
- 聯賽篩選(
LeagueFilterViewController) - 賽果列表顯示:主客隊、比分、賽事時間
- 下拉刷新 / 上拉載入更多
- 點擊賽事 →
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
| 功能說明 | Namespace | Endpoint | Method | 主要參數 |
|---|---|---|---|---|
| FB 賽果列表 | FBSportAPI | v1/match/matchResultPage | POST json | 分頁參數 |
| FB 賽果詳情 | FBSportAPI | v1/match/matchResultInfo | POST json | 賽事 ID |
| DB 賽果列表 | DBSportAPI | yewu11/v1/m/matcheResultPB | POST json | 球類/日期等 |
| DB 冠軍賽果 | DBSportAPI | yewu11/api/result/championMatchResultPB | POST json | 賽事參數 |
| UP 賽果列表 | UPSportAPI | v1/match/matchResultPage | POST json | 分頁參數 |
| UP 賽果詳情 | UPSportAPI | v1/match/matchResultInfo | POST json | 賽事 ID |
資料模型
FB MatchResultListRequest Response
| 欄位 | 說明 |
|---|---|
records | [STEventModel] 賽事列表 |
current | 當前頁碼 |
size | 每頁數量 |
total | 總筆數 |
isLastPage | 計算屬性,current >= ceil(total/size) |
NewMatchResultViewModel 關鍵屬性
| 屬性 | 說明 |
|---|---|
sourceType | 當前平台(STBindingVariable<GameType>) |
filterLeagueIds | 已選聯賽 ID(0筆=全選) |
isRenew | 是否強制刷新 |
delayUpdate | 防連續呼叫的延遲更新 |
實作重點
平台切換:
supportSourceTypes依GameStatusManager.shared.supportSportGameTypes動態決定;切換平台時重置篩選條件防抖更新:
filterLeagueIds改變 →delayUpdate.call()延遲執行,避免快速切換造成多次請求多球類 Model 擴展:詳情頁各球類數據以 Swift Extension 分離(
MatchDetailModel+FootBall.swift等),共 10 種球類本地快取(MatchResultDB):賽果數據有本地 DB 快取機制,優先顯示快取,背景更新
聯賽篩選:
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
└─ 追加結果至列表