解决超话签到中选择性签到的逻辑问题

This commit is contained in:
2026-04-08 08:34:59 +08:00
parent 31d862dfa0
commit 9e69d34f81
8 changed files with 167 additions and 32 deletions

View File

@@ -369,6 +369,7 @@ async def _async_do_signin(account_id: str, cron_expr: str = ""):
return {"status": "failed", "reason": "cookie decryption failed"}
acc_id = str(account.id)
acc_selected_topics = account.selected_topics # 用户选择的超话列表
except Exception as e:
await eng.dispose()
raise e
@@ -387,6 +388,16 @@ async def _async_do_signin(account_id: str, cron_expr: str = ""):
await session.commit()
return {"status": "completed", "signed": 0, "message": "no topics"}
# 如果用户选择了特定超话,只签选中的
if acc_selected_topics and isinstance(acc_selected_topics, list):
selected_cids = {t.get("containerid") for t in acc_selected_topics if t.get("containerid")}
if selected_cids:
topics = [t for t in topics if t["containerid"] in selected_cids]
logger.info(f"📌 按用户选择过滤: {len(topics)} 个超话 (共 {len(selected_cids)} 个已选)")
if not topics:
return {"status": "completed", "signed": 0, "message": "no selected topics"}
signed = already = failed = 0
log_entries = []