Appearance
登入與注冊(開發文檔)
最後更新:2026-04-10
📖 功能說明請參考 登入與注冊
架構
相關檔案
ViewController(9 個)
| 檔案 | 說明 |
|---|---|
.../Login/C/STLoginViewController.swift | 登入主頁 |
.../Register/C/RegisterViewController.swift | 註冊頁 |
.../FindPassword/C/FindPasswordViewController.swift | 找回密碼 |
.../FindPassword/C/ChangePaawordViewController.swift | 修改密碼 |
.../FindPassword/C/SendMessageViewController.swift | 發送驗證碼 |
.../Login/C/BindingAccountViewController.swift | 綁定帳號 |
.../Login/C/SetAccountViewController.swift | 設定帳號 |
.../Register/C/BBSetFaceIDViewController.swift | Face ID 設定 |
.../Register/C/RegSetNickNameViewController.swift | 設定暱稱 |
基礎路徑:
BBSport/Tab/我的/Mine/Login_Register/登录注册/
View(15 個)
| 檔案 | 說明 |
|---|---|
.../Login/V/LoginView.swift | 登入主視圖 |
.../Login/V/LoginBaseView.swift | 登入基礎視圖 |
.../Login/V/LoginUserNameView.swift | 帳號密碼輸入 |
.../Login/V/LoginPhoneCodeView.swift | 手機驗證碼輸入 |
.../Login/V/MLAllUserNameView.swift | 帳號列表下拉 |
.../Login/V/MLUsernameTableViewCell.swift | 帳號 Cell |
.../Login/V/BBLoginAvPlayer.swift | 登入背景影片 |
.../Register/V/RegisterView.swift | 注冊主視圖 |
.../Register/V/RegisterByUserNameView.swift | 帳號密碼注冊 |
.../Register/V/SetUserNameAndPasswordView.swift | 設定帳密 |
.../Register/V/SetHeadImageAndNickNameView.swift | 設定頭像暱稱 |
.../Register/V/RegSuccessSetBaseView.swift | 注冊成功基礎 |
.../Maind/STTabSelectView.swift | Tab 切換 |
.../Maind/STNewTimeButton.swift | 倒計時按鈕 |
.../Maind/DeviceInformationView.swift | 裝置資訊 |
基礎路徑:
BBSport/Tab/我的/Mine/Login_Register/登录注册/
Service / Manager(6 個)
| 檔案 | 說明 |
|---|---|
.../Manager/STLoginManager.swift | 登入流程管理 |
.../Manager/STNewLoginUIManager.swift | 登入 UI 管理 |
.../Manager/CustomerChatManager.swift | 客服管理 |
.../IFLoginService.m | OC 登入核心 |
.../ModuleApi.m | OC 模組路由 |
BBSport/Tab/我的/Mine/Helpers/HttpService.swift | HTTP 請求橋接 |
基礎路徑:
BBSport/Tab/我的/Mine/Login_Register/登录注册/(除 HttpService)
API Request(7 個)
| 檔案 | 說明 |
|---|---|
BBSport/API/STAPI/User/Login/STAPI+UsernameLoginRequest.swift | 帳密登入 |
BBSport/API/STAPI/User/Login/STAPI+LoginCheckRequest.swift | 二次驗證 |
BBSport/API/STAPI/User/Login/STAPI+LoginHeartbeatRequest.swift | 心跳 |
BBSport/API/STAPI/User/Login/STAPI+LoginCaptchaIdRequest.swift | 驗證碼 ID |
BBSport/API/STAPI/User/Login/STAPI+ExperienceCashRequest.swift | 體驗金 |
BBSport/API/STAPI/User/Login/STAPI+UpdateLoginRecordRequest.swift | 更新登入紀錄 |
BBSport/API/STAPI/STAPI+ResendLoginRequest.swift | 重發驗證碼 |
Helper / Model / OC 基礎(28 個)
| 檔案 | 說明 |
|---|---|
.../SavedAccountManager.swift | 帳號儲存 |
.../Manager/BBNewCommonConstant.swift | 常數定義 |
.../Manager/BBShowMessageView.swift | 訊息提示 |
.../Maind/BBInfoAvatarPicker.swift | 頭像選擇器 |
.../Maind/BBInfoAvatarPickerViewModel.swift | 頭像 ViewModel |
.../Maind/BBLoginInfoAvatarImageCellModel.swift | 頭像 Cell Model |
.../Maind/BBNewBackWebViewController.swift | 內嵌 WebView |
.../Maind/BBMaintain/BBMaintainViewController.swift | 維護模式 |
.../Protocol/BBMaindProtocol.swift | 主頁 Protocol |
.../Protocol/FindFastProtocol.swift | 域名探測 |
.../Protocol/STStatusBarStyleProtocol.swift | 狀態列樣式 |
.../Model/STVersionInfoModel.h/.m | 版本資訊 |
.../ModuleApi.h | 路由註冊 Header |
.../Maind/ErrorInternetVC/InternetManager.h/.m | 網路偵測 |
.../Maind/ErrorInternetVC/NetErrorViewController.h/.m | 網路錯誤頁 |
.../Maind/ErrorInternetVC/Reachability.h/.m | 網路可達性 |
.../Manager/BBLoginUIFactory.h/.m | UI 工廠 |
.../Manager/BBUIFactory.h/.m | UI 工廠基類 |
.../Manager/UITapGestureRecognizer+Extand.h/.m | 手勢擴展 |
.../Maind/ChatLiveViewController.h/.m | LiveChat |
BBSport/STUIKit/.../ThisPlatformRequestAction.swift | API 路徑映射 |
基礎路徑:
BBSport/Tab/我的/Mine/Login_Register/登录注册/(除最後一項)
API
登入
帳號密碼登入(v2)
POST api/forehead/user/login/username/v2 — urlForm — STAPI.UsernameLoginRequest
Request:
| 參數 | 型別 | 必填 | 說明 |
|---|---|---|---|
| username | String | ✅ | 帳號(6-16 字元) |
| password | String | ✅ | 密碼(8-20 字元) |
| lotNumber | String | ✅ | 滑動驗證結果 |
| captchaOutput | String | ✅ | 滑動驗證輸出 |
| passToken | String | ✅ | 驗證通過令牌 |
| genTime | String | ✅ | 驗證生成時間戳 |
Response:(JSON String → logonDataProcessing → IFUserModel.refreshUserInfo)
| 欄位 | 型別 | 說明 |
|---|---|---|
| token | String | 登入 Token |
| id | Int | 使用者 ID |
| tokenExpireTime | Int | Token 過期時間 |
| username | String | 帳號 |
| nickName | String | 暱稱 |
| telephone | String | 手機號碼 |
| vipLevel | String | VIP 等級 |
完整 Response(18 個額外欄位)
| 欄位 | 型別 | 說明 |
|---|---|---|
| reallyName | String | 真實姓名 |
| sex | Int | 性別 |
| telArea | String | 區號 |
| String | 電子信箱 | |
| headUrl | String | 頭像 URL |
| birthday | String | 生日 |
| memberName | String | 會員等級名稱 |
| memberImages | String | 會員等級圖片 |
| memberTitleId | Int | 會員稱號 ID |
| userTitleInfo | Object | 稱號資訊 |
| gameJumpConfig | Object | 場館 jump 配置 |
| loginIp | String | 登入 IP |
| registerIp / registerDate | String | 註冊資訊 |
| userFundLevelId | Int | 資金等級 ID |
| parentId | Int | 上級 ID |
| isShowContact | Bool | 顯示聯絡方式 |
| privacyMode | Int | 隱私模式 |
| isRelatedProxy | Bool | 關聯代理 |
code=500001
異常設備 → 回傳 accessToken + smsCode(測試環境),需二次驗證。
手機驗證碼登入
POST api/forehead/user/login/submit/validate/mobile/code/v2 — OC ThisPlatformRequestAction.loginMobileGl
Request:
| 參數 | 型別 | 必填 | 說明 |
|---|---|---|---|
| mobile | String | ✅ | 手機號碼 |
| telArea | String | ✅ | 區號 |
| code | String | ✅ | 簡訊驗證碼 |
| lotNumber / captchaOutput / passToken / genTime | String | 滑動驗證(code=20003 時需要) |
Response: 同 帳號密碼登入(v2)。
二次驗證(異常設備)
POST api/forehead/user/login/abnormal/device/login/check — urlForm — STAPI.LoginCheckRequest
| 參數 | 型別 | 必填 | 說明 |
|---|---|---|---|
| accessToken | String | ✅ | 登入回應中的臨時令牌 |
| code | String | ✅ | 簡訊驗證碼 |
Response: 同 帳號密碼登入(v2)。
重發二次驗證碼
POST api/forehead/user/login/abnormal/device/login/resend — urlForm — STAPI.ResendLoginRequest
| 參數 | 型別 | 必填 | 說明 |
|---|---|---|---|
| accessToken | String | ✅ | 臨時令牌 |
Response: 無 data(STEmptyResponse)。
心跳
POST api/forehead/user/login/heartbeat — urlForm — STAPI.LoginHeartbeatRequest
無參數,靠 Header token/uid 認證。每 60 秒輪詢,保持 Token 有效。
驗證碼
取得驗證碼 ID
POST api/forehead/user/login/captchaOutput/id — urlForm — STAPI.LoginCaptchaIdRequest
| 參數 | 型別 | 必填 | 說明 |
|---|---|---|---|
| telArea | String | ✅ | 區號 |
| mobile | String | ✅ | 手機號碼 |
Response: String — 驗證碼 ID。
手機登入取得驗證碼
POST api/forehead/user/login/code/v2 — OC ThisPlatformRequestAction.loginCodeGl
| 參數 | 型別 | 必填 | 說明 |
|---|---|---|---|
| mobile | String | ✅ | 手機號碼 |
| telArea | String | ✅ | 區號 |
| lotNumber / captchaOutput / passToken / genTime | String | ✅ | 滑動驗證四件組 |
通用手機驗證碼
POST api/forehead/user/mobile/code — OC ThisPlatformRequestAction.mobileCode
| 參數 | 型別 | 必填 | 說明 |
|---|---|---|---|
| mobile | String | ✅ | 手機號碼 |
| telArea | String | ✅ | 區號 |
| type | String | ✅ | login / register |
注冊
用戶名注冊(v2)
POST api/forehead/user/register/username/v2 — OC ThisPlatformRequestAction.registerUserNameGl
| 參數 | 型別 | 必填 | 說明 |
|---|---|---|---|
| username | String | ✅ | 用戶名(6-16 字元) |
| password | String | ✅ | 密碼(8-20 字元) |
| inviterCode | String | 邀請碼 | |
| lotNumber / captchaOutput / passToken / genTime | String | ✅ | 滑動驗證四件組 |
Response: 同 帳號密碼登入(v2)(自動登入)。
手機號注冊
POST api/forehead/user/register/mobile — OC ThisPlatformRequestAction.registerMobile
| 參數 | 型別 | 必填 | 說明 |
|---|---|---|---|
| mobile | String | ✅ | 手機號碼 |
| telArea | String | ✅ | 區號 |
| code | String | ✅ | 簡訊驗證碼 |
| username | String | ✅ | 用戶名 |
| password | String | ✅ | 密碼 |
Response: 同 帳號密碼登入(v2)(自動登入)。
注冊取得驗證碼(v2)
POST api/forehead/user/register/code/v2 — OC ThisPlatformRequestAction.registerCode
| 參數 | 型別 | 必填 | 說明 |
|---|---|---|---|
| mobile | String | ✅ | 手機號碼 |
| telArea | String | ✅ | 區號 |
| lotNumber / captchaOutput / passToken / genTime | String | ✅ | 滑動驗證四件組 |
驗證用戶名
POST api/forehead/user/register/username/validate — OC ThisPlatformRequestAction.registerUserNameValidate
| 參數 | 型別 | 必填 | 說明 |
|---|---|---|---|
| username | String | ✅ | 待驗證帳號 |
| telArea | String | ✅ | 區號 |
驗證手機驗證碼
POST api/forehead/user/register/code/validate — OC ThisPlatformRequestAction.registerCodeValidate
| 參數 | 型別 | 必填 | 說明 |
|---|---|---|---|
| mobile | String | ✅ | 手機號碼 |
| telArea | String | ✅ | 區號 |
| code | String | ✅ | 驗證碼 |
綁定帳號
POST api/forehead/user/login/submit/bind/or/create — OC ThisPlatformRequestAction.bindingAccount
手機登入的新用戶,綁定或創建帳號。
| 參數 | 型別 | 必填 | 說明 |
|---|---|---|---|
| mobile | String | ✅ | 手機號碼 |
| telArea | String | ✅ | 區號 |
| accessToken | String | ✅ | 臨時令牌 |
| operationType | String | ✅ | 0=綁定現有,1=創建新帳號 |
| username | String | ✅ | 用戶名 |
| password | String | ✅ | 密碼 |
Response: 同 帳號密碼登入(v2)。
找回密碼
取得綁定資訊(v2)
POST api/forehead/user/forget/info/v2 — OC ThisPlatformRequestAction.forgetInfoGl
| 參數 | 型別 | 必填 | 說明 |
|---|---|---|---|
| username | String | ✅ | 用戶名 |
| lotNumber / captchaOutput / passToken / genTime | String | ✅ | 滑動驗證四件組 |
Response: 綁定的手機/信箱(脫敏)+ accessToken。
發送驗證碼
POST api/forehead/user/forget/get/validate/code — OC ThisPlatformRequestAction.forgetCodeOld
| 參數 | 型別 | 必填 | 說明 |
|---|---|---|---|
| accessToken | String | ✅ | 臨時令牌 |
| type | String | ✅ | sms / email |
重設密碼
POST api/forehead/user/forget/submit/reset/password — OC ThisPlatformRequestAction.forgetResetPasswordGl
| 參數 | 型別 | 必填 | 說明 |
|---|---|---|---|
| accessToken | String | ✅ | 臨時令牌 |
| code | String | ✅ | 驗證碼 |
| type | String | ✅ | sms / email |
| password | String | ✅ | 新密碼 |
其他
取得 / 重置使用者識別碼
| API | Endpoint |
|---|---|
| 取得 | POST api/forehead/user/security/get/user/valid/code |
| 重置 | POST api/forehead/user/security/submit/reset/user/valid/code |
無參數,靠 Header token/uid 認證。Response: String。
使用者安全資訊
POST api/forehead/user/security/load/info — STAPI.UserSecurityInfoRequest
無參數。Response:
| 欄位 | 型別 | 說明 |
|---|---|---|
| mobile | String | 手機號(含 + 區號) |
| withdrawVal | Int | 提款驗證(>0 = 已設定) |
| cardCount | Int | 銀行卡數量 |
| String | 電子信箱 | |
| reallyName | String | 真實姓名 |
| usdtCount | Int | USDT 地址數 |
| ebCount | Int | EB 地址數 |
體驗金列表
POST api/forehead/activity/welfare/experienceCash/list — STAPI.ExperienceCashRequest
無參數。Response: [ExperCashModel]?
| 欄位 | 型別 | 說明 |
|---|---|---|
| awardName | String? | 獎品名稱 |
| amount | Double? | 金額 |
| unlockCond | String? | 解鎖條件類型 |
| unlockTime | String? | 解鎖時間說明 |
| imageUrl | String? | 圖片 URL |
| id | Int? | ID |
賠率設定
GET api/forehead/system/cfg/get?collect=UserConfig
無參數。Response: 使用者賠率配置 JSON。
GameJump API 見 場館登入
Token 管理
無 Refresh Token
靠心跳 60s 保活。Token 失效 → 用本地帳密自動重登。
關鍵儲存:
| Key | 用途 |
|---|---|
KEY_TOKEN / KEY_UID | Token 和用戶 ID |
TOKENTIME | Token 過期時間 |
KEY_USERNAME / KEY_PASSWORD | 本地帳密(自動登入用) |
loginTime | 上次登入時間戳(3 小時門檻) |
Accounts | 多帳號列表(最多 5 個) |
Caches/UserInfo.plist | 完整登入回應快取(冷啟動 TOKEN 登入用) |
實作重點
- 自動登入:記住密碼 + 非手機登入 + 3 小時內 →
STLoginManager.canAutoLoginAuto()靜默登入 - TOKEN 冷啟動:讀
UserInfo.plist快取 → 直接走logonDataProcessing - 手機登入:不存密碼、
isPhoneLogin=true;新用戶 → 設定帳號頁 - Face ID 引導:首次登入 + 未開啟 + 已記住密碼 → 彈窗引導
- 登出:橫屏先退出 → 清 UserModel → 清浮層 → 切預設 Tab → 清 Token
錯誤碼速查
| 錯誤碼 | 處理 |
|---|---|
1 | 成功 |
500001 | 異常設備 → 簡訊二次驗證 |
20003 / 200025 | 需滑動驗證 → 下次登入先觸發 |
| 帳號密碼為空 | 前端攔截,Toast 提示 |
| 網路錯誤 | 錯誤訊息 + 紅色提示條 |
| 維護/強更 | isManualLoginOut=true,不完成登入 |