refactor(fudai): 抽 _handle_in_fudai_detail 入口诊断日志到 log_handle_in_fudai_detail_entry
将 17 行的入口 flags 日志(reservation_after_action_pending / reservation_focus_until_ts / waiting_for_lottery / room_pos)抽到 fudai_detail_helpers.log_handle_in_fudai_detail_entry。 douyin_fudai.py: 2412 → 2400 行 (-12) fudai_detail_helpers.py: 1382 → 1403 行 验证: - pytest 1013 passed - compile OK Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
45f925b597
commit
1468d14d0e
2 files changed
+26
-17
No files matched your search
@@ -1207,23 +1207,11 @@ class fudai_analyse:
|
||||
def _handle_in_fudai_detail(self) -> None:
|
||||
"""已经在福袋详情页:只跑详情识别 + 是否参与的基础逻辑。"""
|
||||
start_time = time.time()
|
||||
try:
|
||||
self._log_kv(
|
||||
"诊断",
|
||||
"进入 _handle_in_fudai_detail:记录当前关键 flags",
|
||||
reservation_after_action_pending=bool(
|
||||
getattr(self, "reservation_after_action_pending", False)
|
||||
),
|
||||
reservation_focus_until_ts=float(
|
||||
getattr(self, "reservation_focus_until_ts", 0.0) or 0.0
|
||||
),
|
||||
waiting_for_lottery=bool(
|
||||
getattr(self, "_waiting_for_lottery_result", False)
|
||||
),
|
||||
room_pos=int(getattr(self, "room_pos", 0) or 0),
|
||||
)
|
||||
except Exception:
|
||||
pass
|
||||
from douyin.core.fudai_modules.fudai_detail_helpers import (
|
||||
log_handle_in_fudai_detail_entry,
|
||||
)
|
||||
|
||||
log_handle_in_fudai_detail_entry(self)
|
||||
# 注意:点击参与抽奖后会自动关闭详情页,下次循环会跳过阶段检测直接查找福袋
|
||||
|
||||
# 检查连续参与失败次数,避免卡死
|
||||
|
||||
@@ -42,6 +42,27 @@ def log_screenshot_failed(
|
||||
pass
|
||||
|
||||
|
||||
def log_handle_in_fudai_detail_entry(analyser) -> None:
|
||||
"""_handle_in_fudai_detail 入口诊断日志:记录当前关键 flags。"""
|
||||
try:
|
||||
analyser._log_kv(
|
||||
"诊断",
|
||||
"进入 _handle_in_fudai_detail:记录当前关键 flags",
|
||||
reservation_after_action_pending=bool(
|
||||
getattr(analyser, "reservation_after_action_pending", False)
|
||||
),
|
||||
reservation_focus_until_ts=float(
|
||||
getattr(analyser, "reservation_focus_until_ts", 0.0) or 0.0
|
||||
),
|
||||
waiting_for_lottery=bool(
|
||||
getattr(analyser, "_waiting_for_lottery_result", False)
|
||||
),
|
||||
room_pos=int(getattr(analyser, "room_pos", 0) or 0),
|
||||
)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
||||
def take_screenshot_and_diagnose(analyser, start_time: float):
|
||||
"""run_once_basic 步骤 1:截图(最多 3 次重试)+ 阶段诊断。
|
||||
|
||||
|
||||
Reference in new issue
Block a user