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

View File

@@ -0,0 +1,74 @@
import type {
AuthSessionDto,
AuthSessionInput,
AuthUser,
AuthUserDto,
AuthUserProfileDto,
RefreshTokenDto,
} from '@/type'
export function normalizeAuthUser(dto: AuthUserDto): AuthUser {
return {
channelId: dto.channel_id,
coin: dto.coin,
id: dto.uuid,
name: dto.username,
phone: dto.phone,
riskFlags: dto.risk_flags,
username: dto.username,
uuid: dto.uuid,
}
}
export function normalizeAuthUserProfile(dto: AuthUserProfileDto): AuthUser {
return {
channelId: dto.channel_id,
coin: dto.coin,
createTime: dto.create_time,
currentStreak: dto.current_streak,
email: dto.email,
headImage: dto.head_image,
id: dto.uuid,
lastBetPeriodNo: dto.last_bet_period_no,
name: dto.username,
phone: dto.phone,
registerInviteCode: dto.register_invite_code,
riskFlags: dto.risk_flags,
username: dto.username,
uuid: dto.uuid,
}
}
export function mergeAuthUsers(
baseUser: AuthUser | null | undefined,
profileUser: AuthUser | null | undefined,
): AuthUser | null {
if (!baseUser && !profileUser) {
return null
}
return {
...baseUser,
...profileUser,
id: profileUser?.id ?? baseUser?.id ?? '',
}
}
export function normalizeAuthSession(dto: AuthSessionDto): AuthSessionInput {
return {
accessToken: dto['user-token'],
accessTokenExpiresAt: Date.now() + dto.expires_in * 1000,
currentUser: normalizeAuthUser(dto.user),
refreshToken: dto.refresh_token ?? null,
}
}
export function normalizeRefreshAuthSession(
dto: RefreshTokenDto,
): AuthSessionInput {
return {
accessToken: dto['user-token'],
accessTokenExpiresAt: Date.now() + dto.expires_in * 1000,
refreshToken: dto.refresh_token ?? null,
}
}