🎨优化
This commit is contained in:
@@ -68,7 +68,10 @@ func (JwtComponent) GenerateToken(userId, secret string, times ...time.Time) (to
|
||||
return "", nil, errors.New("生成token失败")
|
||||
}
|
||||
|
||||
client.Redis.Set(context.Background(), fmt.Sprintf("%s:%s", constant.UserToken, userId), token, 7*time.Hour)
|
||||
client.Redis.Set(context.Background(),
|
||||
fmt.Sprintf("%s:%s", constant.UserToken, userId),
|
||||
token,
|
||||
time.Duration(expireTime.Sub(time.Now()).Abs().Seconds())*time.Second)
|
||||
return
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user