feat: 新增 snowid(雪花ID+GORM钩子模板,吸收go-hua); wsc新增SessionClient会话层(吸收两端internal/cloud); jwtx重写为标准三段式HS256+密钥显式传参

This commit is contained in:
w11
2026-09-19 21:12:44 +08:00
parent 9ef71f51d4
commit 83679e2080
8 changed files with 452 additions and 42 deletions
+24
View File
@@ -0,0 +1,24 @@
// session_protocol.go 定义会话层协议:会话级 action 常量与心跳/注册消息。
// 业务 action(业务消息)由各业务模块自行定义,不放在框架层。
package wsc
// 会话级 action 常量:心跳与注册(所有业务共用)。
const (
ActionPing = "ping"
ActionPong = "pong"
ActionRegister = "register"
)
// PingReq 心跳请求(无业务字段)。
type PingReq struct{}
// PingResp 心跳响应(action=pong)。
type PingResp struct {
Time int64 `json:"time"`
}
// RegisterResp 注册(上线)响应(action=register,与请求共用同一 action)。
type RegisterResp struct {
Success bool `json:"success"`
Message string `json:"message"`
}