From aeb51f73c7636b63b5b5a923f25faa2e4433f904 Mon Sep 17 00:00:00 2001 From: Codex Date: Fri, 22 May 2026 21:35:38 +0800 Subject: [PATCH] =?UTF-8?q?chore(fudai):=20=E6=B8=85=E7=90=86=20=5Fhandle?= =?UTF-8?q?=5Fin=5Ffudai=5Fdetail=20=E6=AD=BB=E4=BB=A3=E7=A0=81=20+=204=20?= =?UTF-8?q?=E5=A4=84=E9=87=8D=E5=A4=8D=20cleanup?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 1 处 dead code:is_second_open 重复赋值(同一变量连读两次) - 4 处内联"清除任务数量标志 + 嵌套 try"块用 _hd_helpers._clear_task_count_flag 替换 净减 50 行重复样板,2614 → 2568 行。 全套 1172 个测试通过。 Co-Authored-By: Claude Opus 4.7 (1M context) --- douyin/core/douyin_fudai.py | 54 +++---------------------------------- 1 file changed, 4 insertions(+), 50 deletions(-) diff --git a/douyin/core/douyin_fudai.py b/douyin/core/douyin_fudai.py index e832044..5f1800b 100644 --- a/douyin/core/douyin_fudai.py +++ b/douyin/core/douyin_fudai.py @@ -1874,8 +1874,6 @@ class fudai_analyse: # 步骤1:检查是否是第二次打开福袋详情 step1_start = time.time() is_second_open = getattr(self, "_fudai_detail_first_read", False) - # 如果是第二次打开,直接点击参与,不需要验证,使用第一次的倒计时 - is_second_open = getattr(self, "_fudai_detail_first_read", False) if is_second_open: # 第二次打开:直接点击参与,不进行验证,使用第一次的倒计时 try: @@ -1996,18 +1994,7 @@ class fudai_analyse: pass # 清除任务数量标志 - try: - self._fudai_detail_task_count_from_stage = None - try: - self._log_kv( - "福袋详情", - "_handle_in_fudai_detail:清除任务数量标志", - log_type="DEBUG", - ) - except Exception: - pass - except Exception: - pass + _hd_helpers._clear_task_count_flag(self) # 步骤1结束计时 step1_elapsed = (time.time() - step1_start) * 1000 @@ -2073,18 +2060,7 @@ class fudai_analyse: ) # 清除任务数量标志 - try: - self._fudai_detail_task_count_from_stage = None - try: - self._log_kv( - "福袋详情", - "_handle_in_fudai_detail:清除任务数量标志", - log_type="DEBUG", - ) - except Exception: - pass - except Exception: - pass + _hd_helpers._clear_task_count_flag(self) elapsed = time.time() - start_time self._log_kv( @@ -2345,18 +2321,7 @@ class fudai_analyse: pass # 清除任务数量标志 - try: - self._fudai_detail_task_count_from_stage = None - try: - self._log_kv( - "福袋详情", - "_handle_in_fudai_detail:清除任务数量标志", - log_type="DEBUG", - ) - except Exception: - pass - except Exception: - pass + _hd_helpers._clear_task_count_flag(self) elapsed = time.time() - start_time self._log_kv( @@ -2441,18 +2406,7 @@ class fudai_analyse: douyin_fudai_detail.close_fudai_detail(self) # 清除任务数量标志 - try: - self._fudai_detail_task_count_from_stage = None - try: - self._log_kv( - "福袋详情", - "_handle_in_fudai_detail:清除任务数量标志", - log_type="DEBUG", - ) - except Exception: - pass - except Exception: - pass + _hd_helpers._clear_task_count_flag(self) elapsed = time.time() - start_time self._log_kv(