fix(douyu): reject invalid activity cookies
This commit is contained in:
@@ -29,10 +29,11 @@ from .douyu_service import (
|
||||
account_uid,
|
||||
douyu_config_value,
|
||||
ensure_douyu_config,
|
||||
latest_success_cookie,
|
||||
latest_success_login_task,
|
||||
douyu_task_payload,
|
||||
update_account_profile_from_cookie,
|
||||
)
|
||||
from .cookie_check_service import check_douyu_cookie
|
||||
|
||||
|
||||
DOUYU_LEGACY_BIND_ACT_ALIAS = "20250213NQCYX"
|
||||
@@ -3159,11 +3160,27 @@ class DouyuBatchRunner:
|
||||
current = self._started
|
||||
|
||||
self._push_log("info", f"[{current}/{total}] 开始: {self._account_name(account)}")
|
||||
cookie = latest_success_cookie(worker_db, account.id)
|
||||
login_task = latest_success_login_task(worker_db, account.id)
|
||||
cookie = login_task.cookie if login_task else ""
|
||||
if not cookie:
|
||||
self._mark_task(worker_db, task, "failed", "账号没有成功登录 Cookie")
|
||||
self._push_log("warning", f"[{current}] {self._account_name(account)} 无 Cookie")
|
||||
return
|
||||
|
||||
cookie_check = check_douyu_cookie(cookie)
|
||||
login_task.ck_check_status = "valid" if cookie_check["valid"] else "invalid"
|
||||
login_task.ck_check_result = {
|
||||
key: cookie_check.get(key)
|
||||
for key in ("fish_ball", "nickname", "level", "message")
|
||||
}
|
||||
login_task.ck_checked_at = cookie_check["checked_at"]
|
||||
worker_db.commit()
|
||||
if not cookie_check["valid"]:
|
||||
message = f"Cookie 已失效,请重新登录:{cookie_check['message']}"
|
||||
self._mark_task(worker_db, task, "failed", message)
|
||||
self._push_log("warning", f"[{current}] {self._account_name(account)} {message}")
|
||||
return
|
||||
|
||||
update_account_profile_from_cookie(account, cookie)
|
||||
|
||||
handler = {
|
||||
|
||||
Reference in New Issue
Block a user