Compare commits

..

1 Commits

Author SHA1 Message Date
RandyZhang
2711f14d0f
Merge 3e9f5ad0c7 into 8df4a2670b 2025-05-20 09:16:13 +00:00

View File

@ -57,17 +57,6 @@ func getToken(ctx context.Context, channelId int, adcJson string) (string, error
}
_ = resp
// 使用响应中的过期时间,如果获取失败则使用默认时间
expiration := cache.DefaultExpiration
if resp.ExpireTime != nil {
_expiration := time.Until(resp.ExpireTime.AsTime())
// 提前10分钟过期避免边界情况
_expiration = _expiration - 10*time.Minute
if _expiration > 0 {
expiration = _expiration
}
}
Cache.Set(cacheKey, resp.AccessToken, expiration)
Cache.Set(cacheKey, resp.AccessToken, cache.DefaultExpiration)
return resp.AccessToken, nil
}