fix: 优化配置和API处理逻辑

This commit is contained in:
renzhiyuan 2026-01-15 14:52:35 +08:00
parent 056a784dea
commit 7ab366d5d4
1 changed files with 3 additions and 2 deletions

View File

@ -50,7 +50,7 @@ func (l *Login) GetToken(ctx context.Context) string {
if err != nil { if err != nil {
log.Errorf("lsxd get token from redis failed, err: %v", err) log.Errorf("lsxd get token from redis failed, err: %v", err)
} }
if token != "" && l.checkTokenValid(ctx, token) { if token != "" /*&& l.checkTokenValid(ctx, token)*/ {
return token return token
} }
@ -165,7 +165,8 @@ func (l *Login) cacheToken(ctx context.Context, token string) error {
if token == "" { if token == "" {
return errors.New("token is empty") return errors.New("token is empty")
} }
return l.redisCli.Set(ctx, l.getCacheKey(), token, constants.EXPIRE_LSXD_TOKEN).Err() key := l.getCacheKey()
return l.redisCli.Set(ctx, key, token, constants.EXPIRE_LSXD_TOKEN).Err()
} }
func (l *Login) doRequest(ctx context.Context, method string, url string, authorization string, body []byte) (int, error) { func (l *Login) doRequest(ctx context.Context, method string, url string, authorization string, body []byte) (int, error) {