fix:修改redis包,使用推荐的v8
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"gin-vue-admin/global"
|
||||
"gin-vue-admin/model"
|
||||
"gorm.io/gorm"
|
||||
"time"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
//@author: [piexlmax](https://github.com/piexlmax)
|
||||
@@ -38,7 +40,7 @@ func IsBlacklist(jwt string) bool {
|
||||
//@return: err error, redisJWT string
|
||||
|
||||
func GetRedisJWT(userName string) (err error, redisJWT string) {
|
||||
redisJWT, err = global.GVA_REDIS.Get(userName).Result()
|
||||
redisJWT, err = global.GVA_REDIS.Get(context.Background(), userName).Result()
|
||||
return err, redisJWT
|
||||
}
|
||||
|
||||
@@ -51,6 +53,6 @@ func GetRedisJWT(userName string) (err error, redisJWT string) {
|
||||
func SetRedisJWT(jwt string, userName string) (err error) {
|
||||
// 此处过期时间等于jwt过期时间
|
||||
timer := time.Duration(global.GVA_CONFIG.JWT.ExpiresTime) * time.Second
|
||||
err = global.GVA_REDIS.Set(userName, jwt, timer).Err()
|
||||
err = global.GVA_REDIS.Set(context.Background(), userName, jwt, timer).Err()
|
||||
return err
|
||||
}
|
||||
|
Reference in New Issue
Block a user