refactor(game): 重构项目结构,优化链路, 移动端适配

- 移除 useGameBoardVm 数据层实施说明文档
- 移除核心玩法与前端规则摘要文档
- 移除游戏模块数据与界面分层第一阶段实施稿文档
- 清理与数据层重构相关的技术方案说明
- 删除关于 PC 和 Mobile 界面分离的设计规划
- 移除 view-model hooks 架构设计相关内容
This commit is contained in:
JiaJun
2026-06-03 17:21:13 +08:00
parent 3efcb3bba6
commit bfb4b76611
129 changed files with 4534 additions and 4227 deletions

174
src/type/auth.type.ts Normal file
View File

@@ -0,0 +1,174 @@
import type { SMS_SEND_EVENT_REGISTER } from '@/constants'
export type AuthStatus = 'anonymous' | 'authenticated' | 'restoring'
export type AuthSubmitContext = 'login' | 'register'
export interface AuthUser {
createTime?: number
channelId?: number
coin?: string
currentStreak?: number
email?: string
headImage?: string
id: string
isJackpot?: boolean
lastBetPeriodNo?: string
name?: string
oddsFactor?: number
phone?: string
registerInviteCode?: string
riskFlags?: number
roles?: string[]
streakLevel?: number
username?: string
uuid?: string
}
export interface AuthSessionInput {
accessToken: string
accessTokenExpiresAt?: number | null
currentUser?: AuthUser | null
refreshToken?: string | null
}
export interface AuthApiEnvelope<T> {
code: number
data: T
message?: string
msg?: string
}
export interface AuthTokenDto {
auth_token: string
expires_in: number
server_time: number
}
export interface AuthUserDto {
channel_id: number
coin: string
phone?: string
risk_flags: number
username: string
uuid: string
}
export interface AuthSessionDto {
expires_in: number
refresh_token?: string | null
user: AuthUserDto
'user-token': string
}
export interface RefreshTokenDto {
expires_in: number
refresh_token?: string | null
'user-token': string
}
export interface AuthUserProfileDto {
channel_id: number
coin: string
create_time: number
current_streak: number
email: string
head_image: string
last_bet_period_no: string
phone: string
register_invite_code: string
risk_flags: number
username: string
uuid: string
}
export interface LoginRequestDto {
device_id?: string
password: string
username: string
}
export interface LogoutRequestDto {
password: string
username: string
}
export interface RegisterRequestDto {
captcha: string
device_id?: string
invite_code: string
password: string
username: string
}
export interface SendSmsCodeRequestDto {
event: typeof SMS_SEND_EVENT_REGISTER
mobile: string
}
export interface SendSmsCodeDto {
expires_in: number
message_id: string
}
export interface RefreshTokenRequestDto {
refresh_token: string
}
export interface LoginPayload {
password: string
username: string
}
export type LogoutPayload = LoginPayload
export interface RegisterPayload {
captcha: string
inviteCode: string
mobile: string
password: string
}
export interface SendSmsCodePayload {
mobile: string
}
export interface SendSmsCodeResult {
expiresIn: number
messageId: string
}
export type LoginFormValues = { password: string; username: string }
export type RegisterFormValues = {
captcha: string
confirmPassword: string
inviteCode: string
mobile: string
password: string
}
export interface UseLoginFormOptions {
onSuccess?: () => void
}
export interface UseRegisterFormOptions {
onSuccess?: () => void
}
export interface ClearAuthenticatedSessionOptions {
clearBrowserStorage?: boolean
clearQueryCache?: boolean
}
export interface UnauthorizedSessionOptions
extends ClearAuthenticatedSessionOptions {
openLoginModal?: boolean
showLoginRequiredToast?: boolean
}
export type CurrentUserInitializer = () => Promise<AuthUser | null>
export type RefreshSessionHandler = (
refreshToken: string,
) => Promise<AuthSessionInput | null>