fix(oauth): 修复 OAuth 刷新后 Token 有效期不更新问题 (#324)

- 持久化刷新后的 `expires_at` 到 Provider Key SQL 更新链路
- 手动刷新接口优先返回本次刷新得到的过期时间
- 按当前 Key 字段重建 OAuth 状态快照,避免旧快照覆盖
- 前端刷新后防止旧列表数据回退覆盖新有效期
This commit is contained in:
AAEE86
2026-04-24 09:35:25 +08:00
committed by GitHub
parent 31e871fe1b
commit a9d10163af
8 changed files with 70 additions and 18 deletions

View File

@@ -1366,6 +1366,7 @@ INSERT INTO provider_api_keys (
.bind(key.is_active)
.bind(key.created_at_unix_ms.map(|value| value as f64))
.bind(key.updated_at_unix_secs.map(|value| value as f64))
.bind(key.expires_at_unix_secs.map(|value| value as f64))
.execute(&self.pool)
.await
.map_postgres_err()?;
@@ -1735,6 +1736,10 @@ SET
proxy = $22,
fingerprint = $23,
upstream_metadata = $24,
expires_at = CASE
WHEN $38::double precision IS NULL THEN NULL
ELSE TO_TIMESTAMP($38::double precision)
END,
oauth_invalid_at = CASE
WHEN $25::double precision IS NULL THEN NULL
ELSE TO_TIMESTAMP($25::double precision)
@@ -1803,6 +1808,7 @@ WHERE id = $1
.bind(key.last_rpm_peak.map(|value| value as i32))
.bind(key.is_active)
.bind(key.updated_at_unix_secs.map(|value| value as f64))
.bind(key.expires_at_unix_secs.map(|value| value as f64))
.execute(&self.pool)
.await
.map_postgres_err()?