fix: Resolve UnboundLocalError by removing redundant imports

- Removed unnecessary `import time` statements from the `basic_join_decision` function, which were causing `UnboundLocalError` due to local variable shadowing.
- Added a comment to clarify that the `time` module is imported at the file level, ensuring proper usage within the function.
- Updated the `reservations.json` file to reflect the latest reservation details, including changes to room position and prize values.
This commit is contained in:
Your Name committed 2025-12-25 17:06:07 +08:00
1 parent 29f7b19916
commit e69ded6907
4 files changed
+4625 -27

No files matched your search

File diff suppressed because it is too large. Load diff
+1 -5
View File
@@ -3289,6 +3289,7 @@ class fudai_analyse:
except Exception:
pass
# 调用 basic_join_decision 来记录预约
# 注意:basic_join_decision 内部已经关闭详情并切换直播间,不需要再次关闭
try:
douyin_fudai_core.basic_join_decision(self, detail)
except Exception as e:
@@ -3300,11 +3301,6 @@ class fudai_analyse:
)
except Exception:
pass
# 关闭详情页并返回
try:
douyin_fudai_detail.close_fudai_detail(self)
except Exception:
pass
elapsed = time.time() - start_time
self._log_kv("流程", "_handle_in_fudai_detail完成(记录预约)", elapsed_seconds=round(elapsed, 2))
return
+1 -2
View File
@@ -1920,6 +1920,7 @@ def basic_join_decision(analyser: Any, detail: Tuple) -> bool:
True 表示已经参与或已处理完成;
False 表示未参与(例如被配置筛掉或参与失败)。
"""
# time 模块在文件开头已导入
start_time = time.time()
# 解析 detail 字段:先提取价值信息,用于判断是否达到高价值阈值
content = ""
@@ -2080,7 +2081,6 @@ def basic_join_decision(analyser: Any, detail: Tuple) -> bool:
remain_seconds = None
if isinstance(countdown_tuple, (tuple, list)) and len(countdown_tuple) >= 2:
try:
import time
now = time.time()
cd_start = float(countdown_tuple[0] or 0.0)
cd_end = float(countdown_tuple[1] or 0.0)
@@ -2201,7 +2201,6 @@ def basic_join_decision(analyser: Any, detail: Tuple) -> bool:
remain_seconds = None
if isinstance(countdown_tuple, (tuple, list)) and len(countdown_tuple) >= 2:
try:
import time
now = time.time()
cd_start = float(countdown_tuple[0] or 0.0)
cd_end = float(countdown_tuple[1] or 0.0)
+10 -20
View File
@@ -1,29 +1,19 @@
{
"updated_ts": 1766649957.0628917,
"updated_ts": 1766653004.3431895,
"reason": "record_reservation",
"room_pos": 9,
"current_room_title": "94万本坎",
"current_room_title_raw": "9.4万本坎",
"room_pos": 1,
"current_room_title": "小北珠宝",
"current_room_title_raw": "小北珠宝",
"reservations": [
{
"prize_value_yuan": 4800.0,
"content": "45后开奖02(小北珠宝1古法金手镯约3.4克(假一罚三114348人巳参与",
"future_ts": 1766649930.969889,
"future_str": "2025-12-25 16:05:30",
"pos_seen": 0,
"prize_value_yuan": 688.0,
"content": "08后开奖09(小北珠宝』时尚精美首饰收纳箱",
"future_ts": 1766653549.610017,
"future_str": "2025-12-25 17:05:49",
"pos_seen": 1,
"room_title": "小北珠宝",
"room_title_raw": "小北珠宝",
"created_ts": 1766649768.5038307
},
{
"prize_value_yuan": 550.7,
"content": "30后开奖03时髦精8备铜电白Ayuko银长条梳子小众设计感-64.",
"future_ts": 1766650164.933606,
"future_str": "2025-12-25 16:09:24",
"pos_seen": 9,
"room_title": "94万本坎",
"room_title_raw": "9.4万本坎",
"created_ts": 1766649957.0618675
"created_ts": 1766653004.3421893
}
]
}