diff --git a/douyin/fudai/douyin_fudai_core.py b/douyin/fudai/douyin_fudai_core.py index 9dba8a3..6ca860e 100644 --- a/douyin/fudai/douyin_fudai_core.py +++ b/douyin/fudai/douyin_fudai_core.py @@ -5264,12 +5264,16 @@ def basic_join_decision( # 优先使用映射表中刚刚记录的直播间标题(如果存在) # 这样可以确保高价值预约使用的是当前直播间的正确标题 try: - room_pos_to_title_map = getattr(analyser, "_room_pos_to_title_map", {}) + room_pos_to_title_map = getattr( + analyser, "_room_pos_to_title_map", {} + ) if room_pos in room_pos_to_title_map: map_info = room_pos_to_title_map[room_pos] if isinstance(map_info, dict): mapped_title = str(map_info.get("title", "")).strip() - mapped_title_raw = str(map_info.get("title_raw", "")).strip() + mapped_title_raw = str( + map_info.get("title_raw", "") + ).strip() if mapped_title: room_title = mapped_title room_title_raw = mapped_title_raw @@ -5578,8 +5582,14 @@ def basic_join_decision( copies = 0 try: # 优先从缓存的福袋详情中获取信息 - cached_detail = getattr(analyser, "_last_fudai_detail_tuple", None) - if cached_detail and isinstance(cached_detail, tuple) and len(cached_detail) >= 6: + cached_detail = getattr( + analyser, "_last_fudai_detail_tuple", None + ) + if ( + cached_detail + and isinstance(cached_detail, tuple) + and len(cached_detail) >= 6 + ): time_text = str(cached_detail[1] or "") participants = int(cached_detail[2] or 0) copies = int(cached_detail[3] or 0) @@ -5613,9 +5623,13 @@ def basic_join_decision( else: # 如果阶段检测结果已被清除,尝试从缓存的详情中获取任务数量 try: - cached_extra = getattr(analyser, "_last_fudai_detail_extra", None) + cached_extra = getattr( + analyser, "_last_fudai_detail_extra", None + ) if cached_extra and isinstance(cached_extra, dict): - cached_task_count = cached_extra.get("task_count") + cached_task_count = cached_extra.get( + "task_count" + ) if cached_task_count is not None: task_count = int(cached_task_count or 0) try: diff --git a/fudai_detail_modules/fudai_detail_reader.py b/fudai_detail_modules/fudai_detail_reader.py index 13aa539..31b9786 100644 --- a/fudai_detail_modules/fudai_detail_reader.py +++ b/fudai_detail_modules/fudai_detail_reader.py @@ -284,13 +284,18 @@ def read_fudai_detail_once(analyser: Any) -> Tuple[str, Tuple, dict]: # 并行记录映射表(用于预约回退校验、高价值预约表和高价值回访) # 在OCR开始前启动并行任务,不阻塞OCR过程 import threading + mapping_record_thread = None try: + def _record_mapping_async(): try: # 导入并记录映射表 from douyin.reservation import douyin_reservation_handler - douyin_reservation_handler.ReservationHandler.record_room_title_and_pos(analyser) + + douyin_reservation_handler.ReservationHandler.record_room_title_and_pos( + analyser + ) try: analyser._log_kv( "福袋详情", @@ -311,7 +316,9 @@ def read_fudai_detail_once(analyser: Any) -> Tuple[str, Tuple, dict]: pass # 启动并行线程记录映射表 - mapping_record_thread = threading.Thread(target=_record_mapping_async, daemon=True) + mapping_record_thread = threading.Thread( + target=_record_mapping_async, daemon=True + ) mapping_record_thread.start() try: analyser._log_kv(