Files
douyin_guaji-main/tests
CodexandClaude Opus 4.7 0540610c75 refactor(fudai): 抽 _handle_in_fudai_detail last_status 检查到 helper (2872 → 2614)
新增 3 个 helper:
- check_last_status_branch:根据 _last_fudai_detail_status 路由 4 个状态
  (coupon_popup / watch_task / validation_failed / error)
- _clear_task_count_flag:清除 _fudai_detail_task_count_from_stage(多分支共用)
- _handle_error_status:error + reason=task_count_zero 时连续 3 次切直播间

净减 260 行重复样板代码。新增 9 个单元测试覆盖:
- 4 种已知 status 各自分支
- 未知/空 status 不触发
- task_count_zero 第 1 次仅累计、第 3 次强制切房 / needswitch=False 不切

至此 _handle_in_fudai_detail 总长 1010 → 752 行,
douyin_fudai.py 累计 4121 → 2614(-1507 行 / -37%)。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-22 21:23:26 +08:00
..