Commit Graph

7 Commits

Author SHA1 Message Date
hhs
f172e6c468 feat: 实现内存版 SessionManager(TTL 30 分钟,历史上限 20 条) 2026-06-13 15:25:23 +08:00
hhs
6b8bd3c554 feat: 定义 SessionManager 接口 + SessionConfigPatch 模型 2026-06-13 15:24:07 +08:00
hhs
da87ec776b feat: main.go 接入配置 + graceful shutdown + logger 迁移
- main.go: 接入 config.Load() 替换硬编码 :8080
- main.go: 添加 signal.NotifyContext + http.Server.Shutdown(10s drain)
- main.go: 初始化 Zap 日志,prod 环境切换 Gin release 模式
- ws/handler.go: 所有 log.Printf 替换为 logger.Log 结构化日志
- 修复 .gitignore 排除规则(/server 仅匹配根目录二进制)
- 新增 zap、viper 依赖
2026-06-13 15:18:03 +08:00
hhs
c523f53724 feat: 实现配置管理(Viper)
- 新增 internal/config/config.go,定义完整配置结构体
- 支持 YAML 文件 + 环境变量覆盖(CAMTALK_ 前缀)
- 新增 config.yaml 默认配置文件
2026-06-13 15:17:37 +08:00
hhs
bce3b73480 feat: 实现错误码常量 + WS 错误发送工具
- 新增 internal/errors/codes.go
- 定义 10 个错误码常量(与接口文档一致)
- 提供 SendWSError 工具函数
2026-06-13 15:17:31 +08:00
hhs
d5d584c93b feat: 实现 Zap 日志封装
- 新增 internal/logger/logger.go
- 提供 Init(level, format) 初始化全局 SugaredLogger
- 支持 json/console 两种格式
- 提供 Sync() 刷新缓冲区
2026-06-13 15:17:26 +08:00
hhs
9f876df816 feat: 初始化 Go 后端项目骨架
- 使用 Gin 框架替代原始 net/http,方便调试
- 实现 WebSocket 端点 (/ws),支持 ping/query/config/interrupt 消息
- 实现健康检查 REST 接口 (/api/health)
- 定义协议数据结构 (models)
- 心跳检测(60 秒超时断开)
2026-06-12 17:34:43 +08:00