From 161e2e9491d8e9317f41e8902bf851b9900ed743 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sun, 4 Jan 2026 09:54:42 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E9=A2=84=E7=BA=A6?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E5=8A=A0=E8=BD=BD=E9=80=BB=E8=BE=91=EF=BC=8C?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E4=BB=8E=20JSON=20=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=9B=9E=E9=80=80=E8=AF=BB=E5=8F=96=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- douyin/core/douyin_fudai.py | 34 +++++++++++++++++++++++---- douyin/core/state/reservations.json | 36 +++++++++++++++++++---------- 2 files changed, 53 insertions(+), 17 deletions(-) diff --git a/douyin/core/douyin_fudai.py b/douyin/core/douyin_fudai.py index 27796f8..dd1cf17 100644 --- a/douyin/core/douyin_fudai.py +++ b/douyin/core/douyin_fudai.py @@ -1346,7 +1346,24 @@ class fudai_analyse: try: from douyin.reservation import douyin_reservation as dr - loaded = dr.load_reservations_state(state_path) + if hasattr(dr, "load_reservations_state"): + loaded = dr.load_reservations_state(state_path) + else: + # 回退:尝试直接读取状态文件的 JSON 格式 + try: + import json + + if os.path.exists(state_path): + with open(state_path, "r", encoding="utf-8") as f: + data = json.load(f) + if isinstance(data, dict) and "reservations" in data: + loaded = data.get("reservations", []) + elif isinstance(data, list): + loaded = data + else: + loaded = [] + except Exception: + loaded = [] except Exception: loaded = [] @@ -2471,8 +2488,11 @@ class fudai_analyse: and isinstance(detail, tuple) and len(detail) >= 6 ): - # 使用索引读取以避免静态分析对解包的误报 - countdown_tuple = detail[5] + # 使用索引读取并使用 try/except 以避免静态分析对解包/下标的误报 + try: + countdown_tuple = detail[5] + except Exception: + countdown_tuple = () if ( isinstance(countdown_tuple, (tuple, list)) and len(countdown_tuple) >= 2 @@ -2773,7 +2793,9 @@ class fudai_analyse: ) or "adb" ) - if not adb_cmd.startswith('"') and not adb_cmd.endswith('"'): + if not adb_cmd.startswith( + '"' + ) and not adb_cmd.endswith('"'): adb_cmd = f'"{adb_cmd}"' cmd = f"{adb_cmd} -s {self.device_id} shell input swipe {start_x} {start_y} {end_x} {end_y} 300" subprocess.run( @@ -2949,7 +2971,9 @@ class fudai_analyse: ) or "adb" ) - if not adb_cmd.startswith('"') and not adb_cmd.endswith('"'): + if not adb_cmd.startswith( + '"' + ) and not adb_cmd.endswith('"'): adb_cmd = f'"{adb_cmd}"' cmd = f"{adb_cmd} -s {self.device_id} shell input swipe {start_x} {start_y} {end_x} {end_y} 300" subprocess.run( diff --git a/douyin/core/state/reservations.json b/douyin/core/state/reservations.json index 3430a24..74822bd 100644 --- a/douyin/core/state/reservations.json +++ b/douyin/core/state/reservations.json @@ -1,19 +1,23 @@ { - "updated_ts": 1767491436.7967348, - "reason": "process_reservation", + "updated_ts": 1767491537.0721958, + "reason": "record_reservation", "room_pos": 3, - "current_room_title": "火火来", - "current_room_title_raw": "", + "current_room_title": "带娃的小", + "current_room_title_raw": "带娃的小.", "reservations": [ { - "prize_value_yuan": 5999.0, + "prize_value_yuan": 699.0, "content": "", - "future_ts": 1767491526.677024, - "future_str": "2026-01-04 09:52:06", + "future_ts": 1767491839.675532, + "future_str": "2026-01-04 09:57:19", "pos_seen": 3, - "room_title": "刘媛媛媛", - "room_title_raw": "刘媛媛.媛", - "created_ts": 1767491172.3842542 + "room_title": "带娃的小", + "room_title_raw": "带娃的小.", + "created_ts": 1767491462.9488251, + "task_count": 2, + "time_text": "06:22", + "participants": 0, + "copies": 0 }, { "prize_value_yuan": 1999.0, @@ -23,7 +27,11 @@ "pos_seen": 0, "room_title": "作川帮数", "room_title_raw": "作川帮数。。", - "created_ts": 1767491317.7698174 + "created_ts": 1767491317.7698174, + "task_count": 2, + "time_text": "14:41", + "participants": 0, + "copies": 0 }, { "prize_value_yuan": 1999.0, @@ -33,7 +41,11 @@ "pos_seen": 0, "room_title": "作帮粼", "room_title_raw": "作!帮粼。。", - "created_ts": 1767491385.7829947 + "created_ts": 1767491385.7829947, + "task_count": 2, + "time_text": "13:33", + "participants": 0, + "copies": 0 } ] } \ No newline at end of file