签入脚本

This commit is contained in:
小蚂蚁云
2026-10-20 11:37:25 +08:00
commit 7f5e8470af
909 changed files with 4045080 additions and 0 deletions
+59
View File
@@ -0,0 +1,59 @@
package consts
import "fmt"
// ============================== 缓存键 ==============================
// CacheKeyPrefix Redis缓存键统一前缀
const CacheKeyPrefix = "easygoadmin:"
// CacheKeyTokenBlacklist Token黑名单缓存键
// TTL 为 token 剩余有效期
func CacheKeyTokenBlacklist(jti string) string {
return fmt.Sprintf("%stoken:blacklist:%s", CacheKeyPrefix, jti)
}
// CacheKeyOnlineJtiSet 在线令牌有序集合键(score=访问令牌过期时间戳)
func CacheKeyOnlineJtiSet() string {
return fmt.Sprintf("%sonline:jti:set", CacheKeyPrefix)
}
// CacheKeyOnlineInfo 在线令牌详情键(value=在线信息 JSON)
func CacheKeyOnlineInfo(jti string) string {
return fmt.Sprintf("%sonline:info:%s", CacheKeyPrefix, jti)
}
// CacheKeyCaptcha 图形验证码缓存键
// TTL 为 captcha.expire 配置值
func CacheKeyCaptcha(uuid string) string {
return fmt.Sprintf("%scaptcha:%s", CacheKeyPrefix, uuid)
}
// CacheKeyDictItem 字典项集合缓存键
// 按字典编码缓存
func CacheKeyDictItem(code string) string {
return fmt.Sprintf("%sdict:item:%s", CacheKeyPrefix, code)
}
// CacheKeyTenantInfo 租户信息缓存键
// TTL 为 60 秒,用于状态与过期校验热路径
func CacheKeyTenantInfo(tenantID int) string {
return fmt.Sprintf("%stenant:info:%d", CacheKeyPrefix, tenantID)
}
// CacheKeyUserPerms 用户权限点集合缓存键
// 角色变更或菜单变更时删除
func CacheKeyUserPerms(userID int) string {
return fmt.Sprintf("%suser:perms:%d", CacheKeyPrefix, userID)
}
// CacheKeyUserRoles 用户角色编码集合缓存键
func CacheKeyUserRoles(userID int) string {
return fmt.Sprintf("%suser:roles:%d", CacheKeyPrefix, userID)
}
// CacheKeyUserIdentity 用户身份缓存键
// 由 roles 与 perms 合并为 JSON,TTL 为 300 秒,权限变更时删除
func CacheKeyUserIdentity(userID int) string {
return fmt.Sprintf("%suser:identity:%d", CacheKeyPrefix, userID)
}