feat: 操作日志
This commit is contained in:
@@ -11,7 +11,7 @@ type JwtService struct{}
|
||||
var JwtServiceApp = new(JwtService)
|
||||
|
||||
// 登出,禁用jwt
|
||||
func (s JwtService) PutBlacklist(userId string, token string) (err error) {
|
||||
func (s *JwtService) PutBlacklist(userId string, token string) (err error) {
|
||||
expire, err := utils.ParseDuration(global.Config.JWT.ExpiresTime)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -20,7 +20,7 @@ func (s JwtService) PutBlacklist(userId string, token string) (err error) {
|
||||
return err
|
||||
}
|
||||
|
||||
func (s JwtService) IsInBlacklist(userId string, token string) bool {
|
||||
func (s *JwtService) IsInBlacklist(userId string, token string) bool {
|
||||
val, err := global.Redis.Get(context.Background(), userId).Result()
|
||||
return err == nil && val == token
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user