feat: M0-M2 骨架落地(服务端/前端/宿主/数据库/积分引擎)

- server: Go 单二进制骨架,embed 内嵌前端,配置/迁移/HTTP 路由
- store: system.db + event.db 两套迁移,业务表 + 种子数据
- domain: 积分引擎(并列三口径/计分通道/流水/排名/破纪录)+ 68 个测试
- web: Vite + Vue 三入口骨架 + shared 层(类型/API/WebSocket 客户端)
- console: Electron 宿主骨架(选屏/防熄屏/进程守护/托盘)
This commit is contained in:
AskaEth committed 2026-09-09 18:36:40 +08:00
1 parent a61d793d79
commit 7d5d94f815
76 files changed
+10131

No files matched your search

+16
View File
@@ -0,0 +1,16 @@
/**
* shared 层内部工具,不对外导出。
*
* HTTP / WebSocket 收到的一切都先当 unknown,再用这些收窄函数校验;
* 直接断言会把服务端字段改名这类问题推迟到运行期某个深处才炸。
*/
export function isRecord(value: unknown): value is Record<string, unknown> {
return typeof value === 'object' && value !== null && !Array.isArray(value)
}
export function readString(source: unknown, key: string): string | null {
if (!isRecord(source)) return null
const value = source[key]
return typeof value === 'string' ? value : null
}