feat(account-check): 登录接口可选 wgapi / iframe
账号检测原来把 WgapiLoginAPI 写死在执行器里,收不到邮箱验证码时只能干等; 登录任务早就可选 iframe(邮箱验证走 iframe 接口)。默认仍 wgapi,旧行为不变。
This commit is contained in:
@@ -14,7 +14,7 @@ from loguru import logger
|
||||
from sqlalchemy import and_, func, or_
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from core.douyu import DouyuLogin, IframeLoginAPI, WgapiLoginAPI
|
||||
from core.douyu import DouyuLogin, create_login_api_strategy
|
||||
from core.douyu.login import AccountLike
|
||||
from core.douyu.proxy_fetcher import ProxyFetcher
|
||||
|
||||
@@ -26,14 +26,6 @@ from .account_lifecycle import on_ck_verdict, on_login_success
|
||||
from .cookie_check_service import check_douyu_cookie
|
||||
from .douyu_service import LOGIN_ATTEMPT_IN_FLIGHT_STATUSES
|
||||
|
||||
|
||||
def _create_api_strategy(strategy_name: str):
|
||||
"""根据名称创建登录接口策略实例。"""
|
||||
if strategy_name == "iframe":
|
||||
return IframeLoginAPI()
|
||||
return WgapiLoginAPI()
|
||||
|
||||
|
||||
CHECK_STATUS_MESSAGES = {
|
||||
"account_cancelled": "账号已注销",
|
||||
"password_wrong": "账号密码错误",
|
||||
@@ -223,7 +215,7 @@ class LoginBatchRunner:
|
||||
self.loop = loop
|
||||
self.batch_id = uuid.uuid4().hex[:12]
|
||||
self.concurrency = max(1, min(concurrency, 10)) # 限制 1-10
|
||||
self.api_strategy = _create_api_strategy(api_strategy)
|
||||
self.api_strategy = create_login_api_strategy(api_strategy)
|
||||
self.mode = mode if mode in ("login", "check", "relogin") else "login"
|
||||
self._stop = threading.Event()
|
||||
self._counter_lock = threading.Lock()
|
||||
|
||||
Reference in New Issue
Block a user