整理配置文件,jwt过期时间和缓冲时间支持1d2h3m4s事件类型 (#1218)
* feat: human duration * Update config.yaml * 调整配置文件结构 Co-authored-by: songzhibin97 <718428482@qq.com>
This commit is contained in:
@@ -2,12 +2,12 @@ package system
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"go.uber.org/zap"
|
||||
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/model/system"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/utils"
|
||||
)
|
||||
|
||||
type JwtService struct{}
|
||||
@@ -60,7 +60,11 @@ func (jwtService *JwtService) GetRedisJWT(userName string) (redisJWT string, err
|
||||
|
||||
func (jwtService *JwtService) SetRedisJWT(jwt string, userName string) (err error) {
|
||||
// 此处过期时间等于jwt过期时间
|
||||
timer := time.Duration(global.GVA_CONFIG.JWT.ExpiresTime) * time.Second
|
||||
dr, err := utils.ParseDuration(global.GVA_CONFIG.JWT.ExpiresTime)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
timer := dr
|
||||
err = global.GVA_REDIS.Set(context.Background(), userName, jwt, timer).Err()
|
||||
return err
|
||||
}
|
||||
|
Reference in New Issue
Block a user