Files
douyi_guaji_main/douyin/core
CodexandClaude Opus 4.7 6d5b2cfb15 refactor(fudai): 抽 run_once_basic 中"阶段分发"块到 dispatch_stage
将 100 行的 if/elif stage 分发链条整段抽到 fudai_detail_helpers.dispatch_stage:
- COUPON_POPUP → handle_coupon_popup
- SHOPPING_REDPACKET_POPUP → handle_shopping_redpacket_popup
- FANSCLUB_JOIN → handle_fansclub_join
- FUDai_DETAIL → analyser._handle_in_fudai_detail
- IN_LIVE_ROOM/LIVE_OR_UNKNOWN → handle_in_live_room_stage
- RECOMMEND_PAGE → handle_recommend_page
- FOLLOW_LIST/LIVE_LIST → reflash_zhibo
- FUDai_RESULT → handle_lottery_result_stage
- LIVE_CLOSED → swipe_up_to_next_live
- 其他 → 写"未匹配到特定阶段"日志

douyin_fudai.py: 1228 → 1132 行 (-96)
fudai_detail_helpers.py: 2890 → 2975 行

run_once_basic 函数从 220 → 124 行,主体只剩入口逻辑 + 7 个 try_xxx 早返回 + 1 个 dispatch_stage。
douyin_fudai.py 跌破 1200 行(4121 → 1132,本会话累计削减 2989 行 = -73%)

验证:
- pytest 1013 passed
- compile OK

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