增加刷新token为空判断

This commit is contained in:
18610128193
2026-07-06 10:47:21 +08:00
parent 3c0647a6aa
commit 75d1f7a428
2 changed files with 15 additions and 4 deletions
@@ -73,8 +73,8 @@ async def refresh_juliang_token(oauth: UserOAuth, app: UserOAuthApp, db: AsyncSe
if data.get("code") != 0:
logger.error(f"刷新巨量引擎token失败: oauth_id={oauth.id}, 错误信息: {data}")
# refresh_token已失效
if data.get("code") in [40103, 40107]:
# refresh_token已失效或刷新失败,统一清理token
if data.get("code") in [40103, 40107, 40000]:
where_cond = UserOAuth.deleted_at.is_(None)
if oauth.appid:
where_cond = where_cond & (UserOAuth.appid == oauth.appid)
@@ -95,7 +95,6 @@ async def refresh_juliang_token(oauth: UserOAuth, app: UserOAuthApp, db: AsyncSe
related_oauth_ids = await db.execute(select(UserOAuth.id).where(where_cond))
related_oauth_ids = [row[0] for row in related_oauth_ids.all()]
# 【改动2:失效直接删除Redis缓存,不再写入空值】
for related_id in related_oauth_ids:
await _delete_redis_token(related_id)
return