修复(登录任务): 取码失败自动换渠道,被跳过账号也落日志
- 登录先用人工设置的默认接口(当前 iframe):等码超时/发信失败后, 同一账号自动切到另一条通道(iframe <-> wgapi)再试一轮,每个账号 最多切一次;DOUYU_LOGIN_EMAIL_FALLBACK_API=off 可关闭 - 步骤 4/5 日志写明当前取码通道,切渠道时单独告警,页面可直接看到 - 配额/账号上限挡下的账号不再「凭空消失」:落一行 skipped 任务, 日志写明未执行原因;界面新增「已跳过」状态、筛选与重试 - 停止、服务重启收敛、执行线程异常这几条路径也补单账号日志 - 修复刷新线程与收尾写库的覆盖竞态(旧快照会吃掉最后的失败原因) - 补测试:渠道回退、跳过行与日志、日志真正落库
This commit is contained in:
@@ -67,6 +67,7 @@ LOGIN_STATUS_LABELS: dict[str, str] = {
|
||||
"success": "成功",
|
||||
"failed": "失败",
|
||||
"error": "异常",
|
||||
"skipped": "已跳过",
|
||||
"stopped": "已停止",
|
||||
"account_cancelled": "账号已注销",
|
||||
"password_wrong": "账号密码错误",
|
||||
@@ -290,7 +291,9 @@ def _serialize_tasks(db: Session, rows) -> list[LoginTaskOut]:
|
||||
.order_by(LoginAttempt.id.asc())
|
||||
.all()
|
||||
):
|
||||
attempt_map[(str(attempt.batch_id or ""), int(attempt.account_id))] = attempt
|
||||
attempt_map[(str(attempt.batch_id or ""), int(attempt.account_id))] = (
|
||||
attempt
|
||||
)
|
||||
creator_ids = {
|
||||
int(value)
|
||||
for value in [
|
||||
@@ -405,9 +408,7 @@ def get_task_logs(
|
||||
):
|
||||
"""读取单个账号本次登录尝试的日志。"""
|
||||
task = (
|
||||
_visible_tasks_query(db, current, None)
|
||||
.filter(LoginTask.id == task_id)
|
||||
.first()
|
||||
_visible_tasks_query(db, current, None).filter(LoginTask.id == task_id).first()
|
||||
)
|
||||
if task is None:
|
||||
raise HTTPException(status_code=404, detail="登录任务不存在")
|
||||
@@ -826,16 +827,12 @@ async def ws_login_logs(websocket: WebSocket, batch_id: str):
|
||||
return
|
||||
continue
|
||||
if job is None or job.status in TERMINAL_STATUSES:
|
||||
await websocket.send_json(
|
||||
{"level": "result", "message": "批次已结束"}
|
||||
)
|
||||
await websocket.send_json({"level": "result", "message": "批次已结束"})
|
||||
return
|
||||
await asyncio.sleep(0.5)
|
||||
idle_seconds += 0.5
|
||||
if idle_seconds >= 30:
|
||||
await websocket.send_json(
|
||||
{"level": "heartbeat", "message": ""}
|
||||
)
|
||||
await websocket.send_json({"level": "heartbeat", "message": ""})
|
||||
idle_seconds = 0
|
||||
|
||||
log_queue: asyncio.Queue = batch["log_queue"]
|
||||
|
||||
Reference in New Issue
Block a user