From 0fe680e0556ea574d9bb9427895d9690d08aa7c3 Mon Sep 17 00:00:00 2001 From: qian Date: Sat, 30 May 2026 12:45:47 +0800 Subject: [PATCH] =?UTF-8?q?fix(session):=E8=A1=A5=E5=85=85=E7=BC=BA?= =?UTF-8?q?=E5=A4=B1=E7=9A=84=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/dao/internal/sys_sessions.go | 2 ++ internal/model/do/sys_sessions.go | 1 + internal/model/entity/sys_sessions.go | 21 +++++++++++---------- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/internal/dao/internal/sys_sessions.go b/internal/dao/internal/sys_sessions.go index b022b41..be4ab8a 100644 --- a/internal/dao/internal/sys_sessions.go +++ b/internal/dao/internal/sys_sessions.go @@ -31,6 +31,7 @@ type SysSessionsColumns struct { ExpiresAt string // Token 过期时间 CreatedAt string // 创建时间 UpdatedAt string // 更新时间 + Jti string // JWT ID (jti),会话唯一标识符(UUID),用于 Redis 吊销缓存 } // sysSessionsColumns holds the columns for the table sys_sessions. @@ -45,6 +46,7 @@ var sysSessionsColumns = SysSessionsColumns{ ExpiresAt: "expires_at", CreatedAt: "created_at", UpdatedAt: "updated_at", + Jti: "jti", } // NewSysSessionsDao creates and returns a new DAO object for table data access. diff --git a/internal/model/do/sys_sessions.go b/internal/model/do/sys_sessions.go index a83ceec..da375ff 100644 --- a/internal/model/do/sys_sessions.go +++ b/internal/model/do/sys_sessions.go @@ -22,4 +22,5 @@ type SysSessions struct { ExpiresAt *gtime.Time // Token 过期时间 CreatedAt *gtime.Time // 创建时间 UpdatedAt *gtime.Time // 更新时间 + Jti any // JWT ID (jti),会话唯一标识符(UUID),用于 Redis 吊销缓存 } diff --git a/internal/model/entity/sys_sessions.go b/internal/model/entity/sys_sessions.go index 2801ecc..7f80d5c 100644 --- a/internal/model/entity/sys_sessions.go +++ b/internal/model/entity/sys_sessions.go @@ -10,14 +10,15 @@ import ( // SysSessions is the golang structure for table sys_sessions. type SysSessions struct { - Id int64 `json:"id" orm:"id" description:"主键ID"` // 主键ID - UserType string `json:"user_type" orm:"user_type" description:"用户类型:admin(管理后台)/ tenant(租户控制台)"` // 用户类型:admin(管理后台)/ tenant(租户控制台) - UserId int64 `json:"user_id" orm:"user_id" description:"用户ID"` // 用户ID - TenantId int64 `json:"tenant_id" orm:"tenant_id" description:"租户ID(admin类型时为NULL)"` // 租户ID(admin类型时为NULL) - RefreshTokenHash string `json:"refresh_token_hash" orm:"refresh_token_hash" description:"Refresh Token 哈希值"` // Refresh Token 哈希值 - DeviceInfo string `json:"device_info" orm:"device_info" description:"设备信息(JSONB:浏览器、操作系统等)"` // 设备信息(JSONB:浏览器、操作系统等) - IpAddress string `json:"ip_address" orm:"ip_address" description:"登录IP地址"` // 登录IP地址 - ExpiresAt *gtime.Time `json:"expires_at" orm:"expires_at" description:"Token 过期时间"` // Token 过期时间 - CreatedAt *gtime.Time `json:"created_at" orm:"created_at" description:"创建时间"` // 创建时间 - UpdatedAt *gtime.Time `json:"updated_at" orm:"updated_at" description:"更新时间"` // 更新时间 + Id int64 `json:"id" orm:"id" description:"主键ID"` // 主键ID + UserType string `json:"user_type" orm:"user_type" description:"用户类型:admin(管理后台)/ tenant(租户控制台)"` // 用户类型:admin(管理后台)/ tenant(租户控制台) + UserId int64 `json:"user_id" orm:"user_id" description:"用户ID"` // 用户ID + TenantId int64 `json:"tenant_id" orm:"tenant_id" description:"租户ID(admin类型时为NULL)"` // 租户ID(admin类型时为NULL) + RefreshTokenHash string `json:"refresh_token_hash" orm:"refresh_token_hash" description:"Refresh Token 哈希值"` // Refresh Token 哈希值 + DeviceInfo string `json:"device_info" orm:"device_info" description:"设备信息(JSONB:浏览器、操作系统等)"` // 设备信息(JSONB:浏览器、操作系统等) + IpAddress string `json:"ip_address" orm:"ip_address" description:"登录IP地址"` // 登录IP地址 + ExpiresAt *gtime.Time `json:"expires_at" orm:"expires_at" description:"Token 过期时间"` // Token 过期时间 + CreatedAt *gtime.Time `json:"created_at" orm:"created_at" description:"创建时间"` // 创建时间 + UpdatedAt *gtime.Time `json:"updated_at" orm:"updated_at" description:"更新时间"` // 更新时间 + Jti string `json:"jti" orm:"jti" description:"JWT ID (jti),会话唯一标识符(UUID),用于 Redis 吊销缓存"` // JWT ID (jti),会话唯一标识符(UUID),用于 Redis 吊销缓存 }