 CodexandClaude Opus 4.7
|
df8424b706
|
refactor(fudai): 拆出高价值预约总调度(1273→1212,-61 行)
把 run_once_basic 中"高价值预约 + 闭包构造 + 6 个子块串联"的 67 行块抽到
fudai_run_blocks.process_high_value_reservation_check:
- 内部构造 _swipe_down_once / _sort_reservations / _write_state /
_seek_reservation_room 4 个闭包
- 串联 handle_queue_full_wait_at_earliest / log_skip_reservation_check_for_state /
handle_all_reservations_completed_reset / log_needswitch_check_details /
execute_reservation_attend_or_cleanup
新增 4 个单元测试,1227 → 1231 用例全过。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-22 03:53:33 +08:00 |
|
 CodexandClaude Opus 4.7
|
1b4dc477fd
|
refactor(fudai): 拆出阶段诊断 + stage 分发块(1652→1572,-80 行)
- diagnose_stage_with_logging:前置预日志 + _diagnose_stage_from_current_screen +
缓存到 _last_diag_* + 写诊断结果日志
- dispatch_stage:根据 stage 分发到对应 handler,返回 bool 决定主流程是否 return
run_once_basic 主体只剩调用 + 早返回链。
新增 11 个单元测试覆盖各 stage 分支。1188 → 1199 用例全过。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-22 03:34:56 +08:00 |
|
 CodexandClaude Opus 4.7
|
47d31d34fd
|
refactor(fudai): 拆出队列满等待 + 状态跳过日志(1704→1652,-52 行)
- handle_queue_full_wait_at_earliest:队列已满时回退到最早开奖直播间等待
- log_skip_reservation_check_for_state:等待开奖/参与预约/队列满三种状态下跳过日志
新增 7 个单元测试。1181 → 1188 用例全过。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-22 03:31:15 +08:00 |
|
 CodexandClaude Opus 4.7
|
9dee41b976
|
refactor(fudai): 拆出 fudai_choujiang 入口的 5 个子块(1879→1704,-175 行)
把 fudai_choujiang 中互相独立的初始化与循环子块抽到 fudai_run_blocks:
- cleanup_old_screenshot_at_startup:启动时清理旧截图
- resolve_device_resolution:分辨率重试(含默认回退)
- write_actions_log_separator:actions.log 分隔符写入
- run_basic_loop_with_timeout:定时循环模式
- run_basic_loop_forever:无限循环模式(含 KeyboardInterrupt 处理)
主入口从 237 行降到 ~60 行。新增 9 个单元测试覆盖各分支。
1172 → 1181 用例全过。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-22 03:27:34 +08:00 |
|
 CodexandClaude Opus 4.7
|
03e509ac25
|
refactor(fudai): 拆出预约抢占调度块(2429→2318,-111 行)
execute_reservation_attend_or_cleanup:根据 needswitch 分支处理:
- 多间模式:调用 process_reservation_attend_window 抢占回退
- 单间模式:仅清理过期预约
新增 4 个单元测试覆盖正/负回报值、ref 同步、cleanup 异常吞噬。
1148 → 1152 用例全过。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-22 03:11:29 +08:00 |
|
 CodexandClaude Opus 4.7
|
28f91b2aaf
|
refactor(fudai): 拆出 needswitch 诊断日志(2429→2390,-39 行)
把 run_once_basic 中"needswitch 配置 + 第一个预约详情"的诊断日志(48 行)
抽到 fudai_run_blocks.log_needswitch_check_details。纯日志辅助函数。
新增 2 个单元测试覆盖正常队列与空队列。1146 → 1148 用例全过。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-22 03:08:07 +08:00 |
|
 CodexandClaude Opus 4.7
|
970e9043cb
|
refactor(fudai): 拆出"所有预约完成后重置到第一个直播间"块(2460→2429,-31 行)
handle_all_reservations_completed_reset:当队列满等待标志开启且队列已空时,
清除 focus + 按 room_pos 次数下滑回退到第一个直播间(最多 100 次防死循环)。
新增 5 个单元测试,1141 → 1146 用例全过。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-22 03:05:18 +08:00 |
|
 CodexandClaude Opus 4.7
|
c6a4d5fb99
|
refactor(fudai): 拆出预约队列状态文件写入(2545→2460,-85 行)
把 run_once_basic 中嵌套的 _write_state 闭包(87 行 JSON 写文件 + 节流)抽到
fudai_run_blocks.write_reservations_state_throttled。原闭包改为单行调用。
新增 3 个单元测试覆盖:1秒节流跳过 / 节流过后写入 / IO 错误吞噬。
1138 → 1141 用例全过。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-22 03:02:45 +08:00 |
|
 CodexandClaude Opus 4.7
|
a317b38b25
|
refactor(fudai): 拆出预约触发条件诊断日志(2602→2545,-57 行)
把 run_once_basic 中"预约触发条件诊断 + 跳过原因日志"的 60 行块抽到
fudai_run_blocks.log_reservation_trigger_check。纯日志辅助函数。
新增 4 个单元测试覆盖:disabled / 空队列 / 正常队列 / 超过 3 项截断。
1134 → 1138 用例全过。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-22 02:59:35 +08:00 |
|
 CodexandClaude Opus 4.7
|
3473e2bd5e
|
refactor(fudai): 拆出 just_recorded_reservation + skip_stage_diagnosis 早返回(2661→2602,-59 行)
把 run_once_basic 中两个互相独立的早返回块抽到 fudai_run_blocks:
- handle_just_recorded_reservation:刚记录预约后按 needswitch 决定是否上滑切换
- handle_skip_stage_diagnosis:跳过阶段检测标志触发时直接查找福袋
新增 7 个单元测试,1127 → 1134 用例全过。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-22 02:56:49 +08:00 |
|
 CodexandClaude Opus 4.7
|
41fc4ecbe0
|
refactor(fudai): 拆出首次运行清空预约队列块(2783→2661,-122 行)
把 run_once_basic 中"首次运行清空预约队列与写空状态文件"的 130 行块抽到
fudai_run_blocks.maybe_clear_reservation_queue_on_first_run:
- 首次运行:清空 reservations / 写空状态文件 / 标记 _first_run_once_basic=False
- 非首次:仅记录日志保持当前队列
新增 4 个单元测试覆盖:首次清空 / 非首次保持 / 无 state_path 兜底 / 日志异常吞噬。
1123 → 1127 用例全过。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-22 02:53:46 +08:00 |
|
 CodexandClaude Opus 4.7
|
e6da24c2a6
|
refactor(fudai): 拆出截图重试块(2822→2783,-39 行)
把 run_once_basic 中 '截图 + 重试 + 失败诊断日志' 的 45 行块抽到
fudai_run_blocks.take_screenshot_with_retries:
- 失败时自动写入完整诊断日志(含 reservation flags / room_pos 等)
- 返回 (ok, elapsed);ok=False 时主流程直接 return
新增 4 个单元测试覆盖:首次成功 / 二次成功 / 全失败写诊断 / get_screenshot 抛错。
1119 → 1123 用例全过。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-22 02:49:36 +08:00 |
|
 CodexandClaude Opus 4.7
|
6cf3ce9a72
|
refactor(fudai): 拆出 IN_LIVE_ROOM + RECOMMEND_PAGE stage 处理(2915→2822,-93 行)
把 run_once_basic 中两个 stage 分支抽到 fudai_run_blocks:
- handle_in_live_room_stage:等待福袋加载(如刚切换)+ 查找福袋
- handle_recommend_page_stage:点击直播页 + 进入直播间(连点两次)
新增 5 个单元测试覆盖:刚切换 / 未切换 / 点击失败回退 / 完成日志。
1114 → 1119 用例全过。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-22 02:46:21 +08:00 |
|
 CodexandClaude Opus 4.7
|
992db1e161
|
refactor(fudai): 拆出 4 个 stage 弹窗/结束分支(2975→2915,-60 行)
把 run_once_basic 中 4 个 stage 分支抽到 fudai_run_blocks:
- handle_coupon_popup_stage:优惠券弹窗按返回键
- handle_shopping_redpacket_popup_stage:购物红包弹窗点击关闭
- handle_lottery_result_stage:开奖结果 OCR 识别 + 处理或回退
- handle_live_closed_stage:直播结束下滑切换
新增 7 个单元测试覆盖每个分支主路径 + 异常吞噬。1107 → 1114 用例全过。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-22 02:43:10 +08:00 |
|
 CodexandClaude Opus 4.7
|
1604ad1904
|
refactor(fudai): 拆出 FANSCLUB_JOIN stage 处理(3135→2975,-160 行)
把 run_once_basic 中 FANSCLUB_JOIN 分支(166 行)抽到
fudai_run_blocks.handle_fansclub_join_stage:
- 主路径:点参与按钮 + 2 次预设位置 + 关详情
- 异常路径:按 auto_join_fansclub 决定重试或等待 15s + 按 fansclub_fail_action 决定切换
douyin_fudai.py 终于跌破 3000 行(2975)。
新增 5 个单元测试覆盖:正常路径 / 自动加入重试 / 等待手动 / 失败切换 / 完成日志。
1102 → 1107 用例全过。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-22 02:39:50 +08:00 |
|
 CodexandClaude Opus 4.7
|
0bdc378252
|
refactor(fudai): 拆出 run_once_basic 4 个独立子块(4121→3732,-389 行)
把 run_once_basic 中互相独立的 4 个块抽到 fudai_run_blocks:
- handle_waiting_for_lottery_result(等待开奖期间的持续 OCR 检测)
- handle_no_attend_timeout(30 分钟未参与超时回到推荐页)
- handle_desktop_recovery(误返回桌面后的自救路径)
- handle_high_value_room_revisit(高价值房间重访检查)
每个函数返回 bool:True=主流程应 return,False=继续下一阶段。
原方法只剩调用 + 早返回,可读性大幅提升。
新增 13 个单元测试覆盖 4 个块的核心分支,1013 → 1026 用例全过。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-22 01:40:23 +08:00 |
|