feat: 心跳接口改用JWT token获取用户设备信息

- JWT Claims 增加 device_id 和 instance_id 字段
- 登录时将设备信息编码到 token
- 心跳接口从 token 自动获取用户和设备信息
- 心跳路由移到需要 JWT 认证的路由组
- 更新 API 文档

优点:
- 更安全:无法伪造设备信息
- 请求更简洁:心跳无需传递参数
- 符合业界标准做法

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-06-16 02:25:53 +08:00
parent 5bbae23bca
commit 113c01e89f
6 changed files with 58 additions and 36 deletions
+1 -1
View File
@@ -6,7 +6,6 @@ import (
func SetupRoutes(r *gin.RouterGroup) {
SetupPaymentRoutes(r)
SetupAccountRoutes(r)
SetupDynamicRoutes(r)
SetupUserRoutes(r)
SetupTicketRoutes(r)
@@ -14,4 +13,5 @@ func SetupRoutes(r *gin.RouterGroup) {
func SetupAuthRoutes(r *gin.RouterGroup) {
SetupDeviceRoutes(r)
SetupAccountRoutes(r)
}