修复 redis 获取
This commit is contained in:
parent
5a9f16d1ae
commit
eed2c1ccf5
4
db/cache/redis.go
vendored
4
db/cache/redis.go
vendored
@ -4,6 +4,7 @@ package cache
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
@ -35,6 +36,9 @@ func (r *RedisCache) Del(k []byte) error {
|
||||
func (r *RedisCache) Get(k []byte) ([]byte, error) {
|
||||
value, err := r.c.Get(context.Background(), string(k)).Bytes()
|
||||
if err != nil {
|
||||
if errors.Is(err, redis.Nil) {
|
||||
return nil, nil
|
||||
}
|
||||
return nil, fmt.Errorf("RedisCache.Get: %w", err)
|
||||
}
|
||||
return value, nil
|
||||
|
@ -31,9 +31,8 @@ type TokenClaims struct {
|
||||
}
|
||||
|
||||
type Captcha struct {
|
||||
Type string `json:"type"`
|
||||
SiteKey string `json:"siteKey"`
|
||||
ServerName string `json:"serverName"`
|
||||
Type string `json:"type"`
|
||||
SiteKey string `json:"siteKey"`
|
||||
}
|
||||
|
||||
type UserInfo struct {
|
||||
@ -62,6 +61,7 @@ type ChangeName struct {
|
||||
type Config struct {
|
||||
Captcha Captcha `json:"captcha"`
|
||||
AllowChangeName bool
|
||||
ServerName string `json:"serverName"`
|
||||
}
|
||||
|
||||
type EditUser struct {
|
||||
|
@ -15,10 +15,10 @@ import (
|
||||
func (w *WebService) GetConfig(ctx context.Context) model.Config {
|
||||
return model.Config{
|
||||
Captcha: model.Captcha{
|
||||
Type: w.config.Captcha.Type,
|
||||
SiteKey: w.config.Captcha.SiteKey,
|
||||
ServerName: w.config.ServerName,
|
||||
Type: w.config.Captcha.Type,
|
||||
SiteKey: w.config.Captcha.SiteKey,
|
||||
},
|
||||
ServerName: w.config.ServerName,
|
||||
AllowChangeName: !w.config.OfflineUUID,
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user