feat(weibo): 增加协作 CK 失效筛选与实时同步开关

This commit is contained in:
yml
2026-11-12 20:36:11 +08:00
parent aa978a808e
commit f3aab9dabb
6 changed files with 283 additions and 27 deletions
+21 -3
View File
@@ -190,9 +190,7 @@ def refresh_weibo_account(
snapshot = client.fetch_home(activity)
client.check_payment_access(activity, home=snapshot)
except (WeiboError, ValueError) as exc:
account.ck_check_status = _error_status(exc)
account.ck_check_message = str(exc)
account.ck_checked_at = _now()
mark_weibo_account_refresh_failure(db, account, exc, commit=False)
if commit:
db.commit()
raise
@@ -204,6 +202,26 @@ def refresh_weibo_account(
return snapshot
def mark_weibo_account_refresh_failure(
db: Session,
account: WeiboAccount,
exc: Exception,
*,
commit: bool = True,
) -> bool:
"""把一次刷新失败写回账号;业务校验失败不应被误标成 CK 失效。"""
if not isinstance(exc, (WeiboError, ValueError)):
return False
account.ck_check_status = _error_status(exc)
account.ck_check_message = str(exc)
account.ck_checked_at = _now()
if commit:
db.commit()
db.refresh(account)
return True
def update_weibo_account_metadata(
db: Session,
account: WeiboAccount,