Appearance
遊戲大廳(開發文檔)
最後更新:2026-04-10
📖 功能說明請參考 遊戲大廳
架構
相關檔案
ViewController(6 個)
| 檔案 | 說明 |
|---|---|
.../controller/BBHomeViewController.swift | 遊戲首頁 |
.../controller/BBSubGameViewController.swift | 子遊戲列表 |
.../controller/BBSearchSubGameViewController.swift | 搜索子遊戲 |
.../controller/BBHomeOtherHandler.swift | 維護狀態處理 |
.../controller/IFNewStaticWebViewController.m | 遊戲 WebView(OC) |
.../PushGameService.swift | 遊戲跳轉服務 |
基礎路徑:
BBSport/Tab/游戏/Amuse/
Handler(6 個)
| 檔案 | 說明 |
|---|---|
.../controller/BBHomeDaZhuanPanHander.swift | 大轉盤 |
.../controller/BBHomeLoginOrLogoutHander.swift | 登入登出 |
.../controller/BBHomeNoticeShower.swift | 公告顯示 |
.../controller/BBHomeScrollHaner.swift | 滾動處理 |
.../controller/BBHomeThemeStyleHandle.swift | 主題樣式 |
.../controller/BBNetworkHander.swift | 網路請求 |
基礎路徑:
BBSport/Tab/游戏/Amuse/
Model(10 個)
| 檔案 | 說明 |
|---|---|
.../model/HomeAllGameModel.h/.m | 遊戲分類(OC) |
.../model/GameItemModel.h/.m | 遊戲項目(OC) |
.../BBUserBannerModelItem.swift | Banner Model |
.../model/BBUserDialogModel.swift | 對話框 Model |
.../model/BBUserNoticeModel.swift | 公告 Model |
.../model/BBUserProductConfigModel.m | 產品設定(OC) |
.../model/IFAGGameModel.swift | AG 遊戲 Model |
| 以及其他 OC Model... |
基礎路徑:
BBSport/Tab/游戏/Amuse/
View(15 個)
| 檔案 | 說明 |
|---|---|
.../view/HomeCardView.swift | 遊戲卡片 |
.../view/CarItemView.swift | 卡片項目 |
.../view/BBUserHomeNavView.swift | 首頁導航 |
.../view/BBGotoSportAPPView.swift | 跳轉體育 |
.../view/BBSubGameChooseBar.swift | 子遊戲選擇欄 |
.../view/BBSubGameVCNav.swift | 子遊戲導航 |
.../view/NewUserSpinView.swift | 新人轉盤 |
.../view/NewUserSpinOverlay.swift | 轉盤遮罩 |
| 以及 Cell、HornView、公告控件等... |
基礎路徑:
BBSport/Tab/游戏/Amuse/
維護管理(2 個)
| 檔案 | 說明 |
|---|---|
BBSport/Tools/MaintenanceManager/GameMaintenanceManager.swift | 全域維護管理 |
BBSport/Tools/MaintenanceManager/GameMaintenanceStatusModel.swift | 維護狀態 Model |
API — 遊戲核心(7 個)
| 檔案 | 說明 |
|---|---|
.../Game/STAPI+HomeGameListRequest.swift | 首頁遊戲列表 |
.../Game/STAPI+ListSubGamesRequest.swift | 子遊戲列表 |
.../Game/STAPI+JumpGameUrlRequest.swift | 遊戲 URL 跳轉 |
.../Game/STAPI+GameJumpRequest.swift | 遊戲跳轉 |
.../Game/STAPI+GameJumpPreCheckRequest.swift | 跳轉預檢 |
.../Game/STAPI+GamebetConfigQueryRequest.swift | 圖示設定 |
.../Game/STAPI+GamePrizeListRequest.swift | 獎品列表 |
基礎路徑:
BBSport/API/STAPI/
API — 轉盤(4 個)
| 檔案 | 說明 |
|---|---|
.../Amuse/API/STAPI+WheelList.swift | 轉盤活動列表 |
.../Amuse/API/STAPI+WheelGet.swift | 轉盤獲取 |
.../Amuse/API/STAPI+WheelInfo.swift | 轉盤資訊 |
.../Amuse/API/STAPI+WheelUserInfo.swift | 轉盤用戶資訊 |
基礎路徑:
BBSport/Tab/游戏/
彩票模組(獨立 Moya 網路層)
彩票功能由 ML 前綴類管理,位於 BBSport/Tab/游戏/Amuse/Lottery/ 目錄,使用獨立 Moya 網路層。主要包含:
- 大廳:
MLLobbyMainViewController - 彩票主頁:
MLLotteryMainViewController - 快速投注:
LFastBetViewController - 開獎詳情:
MLRunLotteryDetailViewController - 投注記錄:
MLBetHistoryMainViewController - 彩票管理:
MLLotteryManageMainViewController - 網路層:
MLLTHttpService/MLLotteryPlatformRequestAction - 走勢圖:
LotteryChartViewController - 六合彩投注:
MLLHCBetViewController - 算法:
MLAlgorithmObject/MLBetCountAlgorithObject
baseURL 由 MLLTJumpManager.shared.baseUrl 動態設定。
API
遊戲大廳核心
首頁遊戲列表
POST api/forehead/gamebet/game/show/all — urlForm — STAPI.HomeGameListRequest
| 參數 | 型別 | 必填 | 說明 |
|---|---|---|---|
| showClient | Int | ✅ | 固定 2(App 端) |
Response:
| 欄位 | 型別 | 說明 |
|---|---|---|
| nav | [HomeGame] | 導航列遊戲分類 |
| recommend | [HomeGame] | 推薦遊戲分類 |
子遊戲列表
POST api/forehead/gamebet/game/listSubGames — urlForm — STAPI.ListSubGamesRequest
| 參數 | 型別 | 必填 | 說明 |
|---|---|---|---|
| channelId | Int | ✅ | 渠道 ID |
| subType | Int | ✅ | 遊戲子類型(-1=全部, 1=電動老虎機, 2=經典, 3=刮刮樂, 4=棋牌, 5=街機) |
| lineNum | Int | ✅ | 遊戲線數(-1=全部, 1=0~20, 2=20~50, 3=50~100, 4=多旋轉) |
| gameType | Int | ✅ | 固定 3 |
Response: [IFAGGameModel](gameName, logo, gameId, isFavourite)
遊戲跳轉(取 URL)
POST api/forehead/gamebet/game/jump — urlForm — STAPI.JumpGameUrlRequest
| 參數 | 型別 | 必填 | 說明 |
|---|---|---|---|
| gameId | Int | ✅ | 遊戲 ID |
| mobileDisplayOrientation | Int | 有值時帶入 | |
| type | String | ✅ | 固定 "0" |
Response: String(遊戲 URL)
遊戲跳轉預檢
POST api/forehead/gamebet/game/jump/preCheck — urlForm — STAPI.GameJumpPreCheckRequest
| 參數 | 型別 | 必填 | 說明 |
|---|---|---|---|
| gameId | Int | ✅ | 遊戲 ID |
Response:
| 欄位 | 型別 | 說明 |
|---|---|---|
| awardAmount | Int | 體驗金金額 |
| transferAvailable | Bool | false=彈窗提示首充 |
| userHasAwardAmount | Bool | 有體驗金 |
| userHasRecharge | Bool | 已充值 |
遊戲圖示設定
POST api/forehead/gamebet/config/query — urlForm — STAPI.GamebetConfigQueryRequest
| 參數 | 型別 | 必填 | 說明 |
|---|---|---|---|
| showClient | String | ✅ | 固定 "2" |
Response: [BBGameIconItem](channelId, gameIcon, gameId, name, maintenId 等)
產品維護設定
POST api/forehead/gamebet/product/productConfig — urlForm — STAPI.ProductConfigRequest
| 參數 | 型別 | 必填 | 說明 |
|---|---|---|---|
| type | Int | 2(非遊戲場景帶入) |
Response: String(維護設定 JSON,解析為 BBUserProductConfigModel)
錢包轉帳
錢包餘額資訊
POST api/forehead/gamebet/transfer/info — urlForm — STAPI.TransferInfoRequest
無參數。Response: balance([BBBalanceModel]), config(BBBalanceCofigModel)
提交轉帳
POST api/forehead/gamebet/transfer/submitsync — urlForm — STAPI.TransferSubmitRequest
| 參數 | 型別 | 必填 | 說明 |
|---|---|---|---|
| fromChannelId | Int | ✅ | 轉出渠道(0=中心錢包) |
| toChannelId | Int | ✅ | 轉入渠道 |
| amount | Double | ✅ | 轉帳金額 |
| type | Int | 1=後台取總金額 |
Response: 無 data。
各渠道餘額刷新
POST api/forehead/gamebet/balance/refreshByChannel — urlForm — STAPI.RefreshByChannelRequest
| 參數 | 型別 | 必填 | 說明 |
|---|---|---|---|
| channelId | Int | ✅ | 渠道 ID |
Response: 無 data。
大轉盤
轉盤活動列表
POST api/forehead/activity/wheel/list — urlForm — STAPI.WheelListRequest
無參數。Response: [ResponseModel](id, wheelId, status, startTime, endTime, mobilePic, floatPic, config, wheelName, wheelType)
彩票模組 API
彩票使用獨立 Moya 網路層,baseURL 動態設定。
彩票主要 API 列表(16 個)
| 功能 | Endpoint | Method |
|---|---|---|
| 遊戲菜單 | wps/api/game-menu | GET |
| 熱門彩種 | wps/api/game-hot | GET |
| 玩法菜單 | wps/api/play-menu | GET |
| 投注 | wps/api/bet | POST |
| 投注撤單 | wps/api/bet-cancel | POST |
| 投注記錄 | wps/api/bet-history | GET |
| 追號投注 | wps/api/better-chase-bet | POST |
| 追號記錄 | wps/api/chase-history | GET |
| 用戶餘額 | wps/api/account-get | GET |
| 開獎歷史 | wps/api/newest-result | GET |
| 走勢圖 | wps/api/analysis/run | GET |
| 六合彩生肖 | wps/api/6cj/animal | GET |
| 設定中心 | wps/api/config-center | GET |
| 首頁 Banner | wps/api/ad-list | GET |
| Token 續期 | wps/api/token-refresh | GET |
| 百家樂動畫 | wps/api/baccarat-ani | GET |
完整彩票 API 列表(36 個)
另含:play-multi, play-single, common-rule, single-newest-result, history, bet-history-order, chase-revoke, chase-bet-history, chase-result, chase-start-result, save-config-center, game-i18n, report/date, analysis/long, analysis/cold, analysis/lose, down5, long-batch-bet, optional-play-config, optional-play-get, optional-play-update, merchant-config, game-desc
彩票核心 API 參數說明
投注(bet)
POST wps/api/bet — 來源:MLLotteryPlatformRequestAction
| 參數 | 說明 |
|---|---|
| gameId | 彩種 ID |
| playId | 玩法 ID |
| betContent | 投注內容(號碼組合) |
| betAmount | 投注金額 |
| issueNo | 期號 |
| betCount | 注數 |
Response: 投注結果(含訂單號、投注狀態)。彩票使用獨立 Moya 網路層,Response 結構由 MLLTHttpService 統一解析。
投注記錄(bet-history)
GET wps/api/bet-history — 來源:MLLotteryPlatformRequestAction
| 參數 | 說明 |
|---|---|
| gameId | 彩種 ID(可選,不傳為全部) |
| page | 頁碼 |
| pageSize | 每頁數量 |
| startTime | 開始時間 |
| endTime | 結束時間 |
Response: 投注記錄列表(含訂單號、彩種、投注內容、金額、開獎結果、盈虧)。
用戶餘額(account-get)
GET wps/api/account-get — 來源:MLLotteryPlatformRequestAction
無參數,靠彩票模組 token 認證。
Response: 用戶在彩票平台的餘額資訊。
遊戲類型
| gameType | 說明 |
|---|---|
| 0 | 彩票 |
| 1 | 真人 |
| 2 | 體育 |
| 3 | 老虎機 |
| 4 | 捕魚 |
| 5 | 電競 |
| 6 | 棋牌 |
維護狀態
| MaintainType | 說明 |
|---|---|
| isMaintain | 維護中 |
| willMaintain | 即將維護 |
| noMaintain | 未維護 |
| unknowMaintain | 未知 |
關鍵數字
- 轉帳超時:3 秒後強制進入遊戲
- 遊戲列表快取:
NSKeyedArchiver存入UserDefaults(key:GAME_ARRAY_LIST) - 轉盤顯示:
status == 1且在 startTime~endTime 內
錯誤處理
遊戲 WebView 載入失敗
IFNewStaticWebViewController(OC)實作 WKNavigationDelegate,但未實作 webView:didFailProvisionalNavigation:withError: 回調。目前載入失敗的處理方式:
- URL 載入前先清除 Cookie(
WKWebsiteDataStore removeDataOfTypes),再重新 loadRequest - 有
UIProgressView進度條透過 KVO 監聽estimatedProgress顯示載入進度 - 彩票模組的
MLWebViewController有完整的didFail處理,顯示loadFailed空狀態文字 - 遊戲主 WebView 未有明確的錯誤重試 UI,載入失敗時用戶需手動返回重新進入
錢包轉帳失敗
PushGameService 的轉帳流程:
- 請求
TransferInfoRequest取得錢包資訊 - 呼叫
BBWalletService.finishedOnceTranser(transferModel:toChannelId:)執行一鍵轉帳 - 超時機制:
DispatchQueue.main.asyncAfter(deadline: .now() + 3)設定 3 秒超時,無論轉帳是否完成都強制進入遊戲頁面 - 使用
isEnterGame布林旗標防止重複推頁(轉帳成功和超時只執行一次) onError回調:僅執行STLoading.stop()停止載入動畫,不顯示額外提示- 轉帳失敗時 Socket 推送
STPushType.pushTypeTransferError(code 406),由全域推送 Toast 顯示「轉賬失敗」提示
OC 遺留代碼
以下 .m/.h 檔案為 Objective-C 歷史代碼,Swift 透過 Bridging Header 調用:
| 檔案 | 說明 |
|---|---|
IFNewStaticWebViewController.m/.h | 遊戲 WebView 載體(WKWebView) |
HomeAllGameModel.m/.h | 遊戲分類 Model |
GameItemModel.m/.h | 遊戲項目 Model |
BBUserProductConfigModel.m | 產品維護設定 Model |
SystemNoticeListModel.m/.h | 系統公告 Model |
PrizeModel.m/.h | 獎品 Model |
MainItemModel.m/.h | 主頁項目 Model |
BBUserSystemMessageModel.m/.h | 系統訊息 Model |
BBUserMoneyDetailModel.m/.h | 資金明細 Model |
BBUserMessageVmodel.m/.h | 訊息 ViewModel |
BBUserIndexTableViewModel.m/.h | 首頁 TableView Model |
BBUserGLBaseModel.m/.h | GL 基底 Model |
SKAutoScrollLabel.m/.h | 自動滾動標籤 |
HornView.m/.h / HornLabel.m/.h | 跑馬燈公告 |
BBUserSwiftOCAdapter.m/.h | Swift-OC 橋接 Adapter |
MLCommonTools.m/.h | 彩票通用工具(彩票模組) |
WebsocketStompKit.m/.h | WebSocket STOMP 協議(彩票模組) |
實作重點
- PushGameService 四道關卡:recommendType → 維護 → 登入 → 首次充值(PreCheck)
- 體驗金:
ExperCashHelper.showAlertIfNeeded處理未綁定提示 - 子遊戲分流:
subGameNum > 1→ push SubGameVC;gameId == 28→ MGJRouter 彩票模組 - 錢包轉帳:
TransferInfoRequest→BBWalletService.finishedOnceTranser→ 超時 3s 強制進入 - 遊戲頁載體:一般 →
IFNewStaticWebViewController;PG 電子 →loadHTMLString;MW 捕魚 → 外部瀏覽器 - 維護同步:
viewWillAppear呼叫requestProductConfig();Socket 即時推送STNotify.maintainID - GameMaintenanceManager:管理 app/fb/db/up 四平台;APP 級維護替換 rootVC 為
BBMaintainViewController - 彩票獨立性:
ML前綴、Moya 獨立網路層、MLBaseViewController基底、baseURL 動態設定 - 遊戲啟動記錄:
GameStatusManager.shared.updateSavedGameType(.bbAmuse),下次啟動預設選「遊戲」Tab - 本地快取:
NSKeyedArchiver存GAME_ARRAY_LIST,下次啟動先載入再請求更新