Skip to content

登入與注冊(開發文檔)

最後更新: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.swiftFace 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.swiftTab 切換
.../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.mOC 登入核心
.../ModuleApi.mOC 模組路由
BBSport/Tab/我的/Mine/Helpers/HttpService.swiftHTTP 請求橋接

基礎路徑: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/.mUI 工廠
.../Manager/BBUIFactory.h/.mUI 工廠基類
.../Manager/UITapGestureRecognizer+Extand.h/.m手勢擴展
.../Maind/ChatLiveViewController.h/.mLiveChat
BBSport/STUIKit/.../ThisPlatformRequestAction.swiftAPI 路徑映射

基礎路徑:BBSport/Tab/我的/Mine/Login_Register/登录注册/(除最後一項)


API

登入


帳號密碼登入(v2)

POST api/forehead/user/login/username/v2 — urlForm — STAPI.UsernameLoginRequest

Request:

參數型別必填說明
usernameString帳號(6-16 字元)
passwordString密碼(8-20 字元)
lotNumberString滑動驗證結果
captchaOutputString滑動驗證輸出
passTokenString驗證通過令牌
genTimeString驗證生成時間戳

Response:(JSON String → logonDataProcessingIFUserModel.refreshUserInfo

欄位型別說明
tokenString登入 Token
idInt使用者 ID
tokenExpireTimeIntToken 過期時間
usernameString帳號
nickNameString暱稱
telephoneString手機號碼
vipLevelStringVIP 等級
完整 Response(18 個額外欄位)
欄位型別說明
reallyNameString真實姓名
sexInt性別
telAreaString區號
emailString電子信箱
headUrlString頭像 URL
birthdayString生日
memberNameString會員等級名稱
memberImagesString會員等級圖片
memberTitleIdInt會員稱號 ID
userTitleInfoObject稱號資訊
gameJumpConfigObject場館 jump 配置
loginIpString登入 IP
registerIp / registerDateString註冊資訊
userFundLevelIdInt資金等級 ID
parentIdInt上級 ID
isShowContactBool顯示聯絡方式
privacyModeInt隱私模式
isRelatedProxyBool關聯代理

code=500001

異常設備 → 回傳 accessToken + smsCode(測試環境),需二次驗證。


手機驗證碼登入

POST api/forehead/user/login/submit/validate/mobile/code/v2 — OC ThisPlatformRequestAction.loginMobileGl

Request:

參數型別必填說明
mobileString手機號碼
telAreaString區號
codeString簡訊驗證碼
lotNumber / captchaOutput / passToken / genTimeString滑動驗證(code=20003 時需要)

Response:帳號密碼登入(v2)


二次驗證(異常設備)

POST api/forehead/user/login/abnormal/device/login/check — urlForm — STAPI.LoginCheckRequest

參數型別必填說明
accessTokenString登入回應中的臨時令牌
codeString簡訊驗證碼

Response:帳號密碼登入(v2)


重發二次驗證碼

POST api/forehead/user/login/abnormal/device/login/resend — urlForm — STAPI.ResendLoginRequest

參數型別必填說明
accessTokenString臨時令牌

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

參數型別必填說明
telAreaString區號
mobileString手機號碼

Response: String — 驗證碼 ID。


手機登入取得驗證碼

POST api/forehead/user/login/code/v2 — OC ThisPlatformRequestAction.loginCodeGl

參數型別必填說明
mobileString手機號碼
telAreaString區號
lotNumber / captchaOutput / passToken / genTimeString滑動驗證四件組

通用手機驗證碼

POST api/forehead/user/mobile/code — OC ThisPlatformRequestAction.mobileCode

參數型別必填說明
mobileString手機號碼
telAreaString區號
typeStringlogin / register

注冊


用戶名注冊(v2)

POST api/forehead/user/register/username/v2 — OC ThisPlatformRequestAction.registerUserNameGl

參數型別必填說明
usernameString用戶名(6-16 字元)
passwordString密碼(8-20 字元)
inviterCodeString邀請碼
lotNumber / captchaOutput / passToken / genTimeString滑動驗證四件組

Response:帳號密碼登入(v2)(自動登入)。


手機號注冊

POST api/forehead/user/register/mobile — OC ThisPlatformRequestAction.registerMobile

參數型別必填說明
mobileString手機號碼
telAreaString區號
codeString簡訊驗證碼
usernameString用戶名
passwordString密碼

Response:帳號密碼登入(v2)(自動登入)。


注冊取得驗證碼(v2)

POST api/forehead/user/register/code/v2 — OC ThisPlatformRequestAction.registerCode

參數型別必填說明
mobileString手機號碼
telAreaString區號
lotNumber / captchaOutput / passToken / genTimeString滑動驗證四件組

驗證用戶名

POST api/forehead/user/register/username/validate — OC ThisPlatformRequestAction.registerUserNameValidate

參數型別必填說明
usernameString待驗證帳號
telAreaString區號

驗證手機驗證碼

POST api/forehead/user/register/code/validate — OC ThisPlatformRequestAction.registerCodeValidate

參數型別必填說明
mobileString手機號碼
telAreaString區號
codeString驗證碼

綁定帳號

POST api/forehead/user/login/submit/bind/or/create — OC ThisPlatformRequestAction.bindingAccount

手機登入的新用戶,綁定或創建帳號。

參數型別必填說明
mobileString手機號碼
telAreaString區號
accessTokenString臨時令牌
operationTypeString0=綁定現有,1=創建新帳號
usernameString用戶名
passwordString密碼

Response:帳號密碼登入(v2)


找回密碼


取得綁定資訊(v2)

POST api/forehead/user/forget/info/v2 — OC ThisPlatformRequestAction.forgetInfoGl

參數型別必填說明
usernameString用戶名
lotNumber / captchaOutput / passToken / genTimeString滑動驗證四件組

Response: 綁定的手機/信箱(脫敏)+ accessToken。


發送驗證碼

POST api/forehead/user/forget/get/validate/code — OC ThisPlatformRequestAction.forgetCodeOld

參數型別必填說明
accessTokenString臨時令牌
typeStringsms / email

重設密碼

POST api/forehead/user/forget/submit/reset/password — OC ThisPlatformRequestAction.forgetResetPasswordGl

參數型別必填說明
accessTokenString臨時令牌
codeString驗證碼
typeStringsms / email
passwordString新密碼

其他


取得 / 重置使用者識別碼

APIEndpoint
取得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/infoSTAPI.UserSecurityInfoRequest

無參數。Response:

欄位型別說明
mobileString手機號(含 + 區號)
withdrawValInt提款驗證(>0 = 已設定)
cardCountInt銀行卡數量
emailString電子信箱
reallyNameString真實姓名
usdtCountIntUSDT 地址數
ebCountIntEB 地址數

體驗金列表

POST api/forehead/activity/welfare/experienceCash/listSTAPI.ExperienceCashRequest

無參數。Response: [ExperCashModel]?

欄位型別說明
awardNameString?獎品名稱
amountDouble?金額
unlockCondString?解鎖條件類型
unlockTimeString?解鎖時間說明
imageUrlString?圖片 URL
idInt?ID

賠率設定

GET api/forehead/system/cfg/get?collect=UserConfig

無參數。Response: 使用者賠率配置 JSON。

GameJump API 見 場館登入


Token 管理

無 Refresh Token

靠心跳 60s 保活。Token 失效 → 用本地帳密自動重登。

關鍵儲存:

Key用途
KEY_TOKEN / KEY_UIDToken 和用戶 ID
TOKENTIMEToken 過期時間
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,不完成登入