From b4cd51a6dcd3f381fa3906f5e2856d7e9e968101 Mon Sep 17 00:00:00 2001 From: yanweidong Date: Fri, 12 Sep 2025 20:11:49 +0800 Subject: [PATCH] =?UTF-8?q?refactor(encipher):=20=E6=9B=B4=E6=96=B0=20JWT?= =?UTF-8?q?=20=E8=BF=87=E6=9C=9F=E6=97=B6=E9=97=B4=E5=8F=98=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将 vars.JwtExpireDay 更改为 vars.JwtExpire,使代码更具通用性 - 优化了 GenerateTokenAes 函数中的过期时间计算逻辑 --- crypto/encipher/encipher.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crypto/encipher/encipher.go b/crypto/encipher/encipher.go index 873418e..e1ef884 100644 --- a/crypto/encipher/encipher.go +++ b/crypto/encipher/encipher.go @@ -30,7 +30,7 @@ func GenerateTokenAes(id uint, identity, client, role string, owner any, extend if !(JwtSecretLen == 16 || JwtSecretLen == 24 || JwtSecretLen == 32) { return "", errcode.ErrJWTSecretKey } - expireTime := time.Now().Add(vars.JwtExpireDay) + expireTime := time.Now().Add(vars.JwtExpire) claims := types.JwtClaims{ ID: id, Identity: identity,