fix: Update configuration and enhance reservation handling
- Adjusted configuration values in `config.json` for minimum prize value, countdown skip time, and high-value fudai thresholds to optimize performance. - Implemented logic in `douyin_fudai.py` to clear the reservation queue on the first run, ensuring accurate data loading. - Enhanced logging during reservation handling to provide clearer insights into the process. - Removed redundant checks and improved code clarity in the reservation logic.
This commit is contained in:
1 parent
5a55265e9a
commit
ea4cb7552f
8 files changed
+55018
-32
No files matched your search
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
+10
-9
@@ -2,24 +2,24 @@
|
||||
"needswitch": true,
|
||||
"infinite_loop_enabled": true,
|
||||
"wait_minutes": 5,
|
||||
"min_prize_value_yuan": 200.0,
|
||||
"min_prize_value_yuan": 100.0,
|
||||
"min_participants": 0,
|
||||
"max_participants": 0,
|
||||
"skip_if_countdown_gt_seconds": 180,
|
||||
"skip_if_countdown_gt_seconds": 120,
|
||||
"reset_after_swipes_enabled": true,
|
||||
"reset_after_swipes": 50,
|
||||
"auto_join_fansclub": true,
|
||||
"fansclub_fail_action": "switch",
|
||||
"high_value_fudai_enabled": true,
|
||||
"high_value_fudai_threshold_yuan": 500.0,
|
||||
"high_value_fudai_join_ahead_seconds": 60,
|
||||
"high_value_fudai_threshold_yuan": 100.0,
|
||||
"high_value_fudai_join_ahead_seconds": 90,
|
||||
"high_value_fudai_max_swipe_back": 50,
|
||||
"high_value_fudai_max_reservations": 3,
|
||||
"high_value_fudai_after_action": "continue",
|
||||
"high_value_room_revisit_enabled": true,
|
||||
"high_value_room_revisit_only_current_run": true,
|
||||
"reservation_back_verify_enabled": false,
|
||||
"reservation_back_swipe_delay": 0.6,
|
||||
"reservation_back_swipe_delay": 0.5,
|
||||
"reservation_preempt_min_value": 0.0,
|
||||
"desktop_icon_x": 153,
|
||||
"desktop_icon_y": 260,
|
||||
@@ -29,7 +29,7 @@
|
||||
"yanghao_fallback_enter_live_y": 1200,
|
||||
"fudai_find_max_attempts": 99999,
|
||||
"fudai_icon_retry_delay_seconds": 0.4,
|
||||
"fudai_icon_max_wait_seconds": 4.0,
|
||||
"fudai_icon_max_wait_seconds": 6.0,
|
||||
"fudai_click_wait_seconds": 1.7,
|
||||
"yanghao_recommend_duration_seconds": 206,
|
||||
"yanghao_recommend_interval_seconds": 570,
|
||||
@@ -98,8 +98,9 @@
|
||||
"auto_cleanup": true
|
||||
},
|
||||
"fudai_detail_template_threshold": 0.54,
|
||||
"switch_room_wait_after_stage_diag_seconds": 7.0,
|
||||
"coupon_template_match_threshold": 0.75,
|
||||
"switch_room_wait_after_stage_diag_seconds": 10.0,
|
||||
"coupon_template_match_threshold": 0.4,
|
||||
"attend_button_red_ratio_threshold": 0.25,
|
||||
"fansclub_join_red_ratio_threshold": 0.25
|
||||
"fansclub_join_red_ratio_threshold": 0.25,
|
||||
"reservation_test_mode": false
|
||||
}
|
||||
+14
-12
@@ -1721,6 +1721,7 @@ class fudai_analyse:
|
||||
# ========== 主循环骨架(基础抢福袋 + 简化预约抢占) ==========
|
||||
def run_once_basic(self) -> None:
|
||||
"""单轮基础抢福袋流程(包含简化版高价值福袋预约回退)。"""
|
||||
import douyin_reservation_logic # 确保在函数作用域内可用
|
||||
start_time = time.time()
|
||||
# 0. 如果正在等待开奖,检查高价值预约是否需要抢占,否则只检测开奖结果
|
||||
if getattr(self, "_waiting_for_lottery_result", False):
|
||||
@@ -1954,6 +1955,7 @@ class fudai_analyse:
|
||||
# 使用 add_reservation_core_logic 函数处理去重,确保与记录预约时使用相同的去重策略
|
||||
# 去重策略:(future_ts, content) 相同则视为同一条记录,保留价值更高的那条
|
||||
try:
|
||||
import douyin_reservation_logic
|
||||
max_reservations = int(
|
||||
getattr(self, "high_value_fudai_max_reservations", 3) or 3
|
||||
)
|
||||
@@ -2011,18 +2013,18 @@ class fudai_analyse:
|
||||
except Exception:
|
||||
pass
|
||||
except Exception as e:
|
||||
try:
|
||||
self._log_kv(
|
||||
"预约",
|
||||
"[预约] 从状态文件加载预约数据失败",
|
||||
error=str(e),
|
||||
error_type=type(e).__name__,
|
||||
file_path=self._reservations_state_path,
|
||||
file_exists=os.path.exists(self._reservations_state_path) if hasattr(os, 'path') else False,
|
||||
)
|
||||
except Exception:
|
||||
pass
|
||||
else:
|
||||
try:
|
||||
self._log_kv(
|
||||
"预约",
|
||||
"[预约] 从状态文件加载预约数据失败",
|
||||
error=str(e),
|
||||
error_type=type(e).__name__,
|
||||
file_path=self._reservations_state_path,
|
||||
file_exists=os.path.exists(self._reservations_state_path) if hasattr(os, 'path') else False,
|
||||
)
|
||||
except Exception:
|
||||
pass
|
||||
else:
|
||||
# 状态文件不存在
|
||||
try:
|
||||
self._log_kv(
|
||||
|
||||
+41
-11
@@ -319,12 +319,27 @@ def handle_queue_full_wait_at_earliest(
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# 先轻微下滑一次,确保在直播列表中
|
||||
# 获取当前实际的 room_pos(可能已经被更新)
|
||||
try:
|
||||
swipe_down_back_callback()
|
||||
time.sleep(max(0.1, float(reservation_back_swipe_delay_s or 0.0)))
|
||||
current_room_pos = int(getattr(analyser, "room_pos", room_pos) or room_pos)
|
||||
except Exception:
|
||||
pass
|
||||
current_room_pos = int(room_pos)
|
||||
|
||||
# 计算位置差
|
||||
try:
|
||||
target_pos = int(earliest.get("pos_seen") or 0)
|
||||
except Exception:
|
||||
target_pos = 0
|
||||
pos_diff = current_room_pos - target_pos
|
||||
|
||||
# 如果已经在目标位置(pos_diff == 0),不需要先回退,直接调用回调
|
||||
# 如果不在目标位置,先轻微下滑一次,确保在直播列表中
|
||||
if pos_diff != 0:
|
||||
try:
|
||||
swipe_down_back_callback()
|
||||
time.sleep(max(0.1, float(reservation_back_swipe_delay_s or 0.0)))
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# 回退到最早开奖的预约直播间
|
||||
ok = False
|
||||
@@ -607,24 +622,39 @@ def process_reservation_attend_window(
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# 先轻微下滑一次,确保在直播列表中 / 或触发系统返回
|
||||
# 获取当前实际的 room_pos(可能已经被更新)
|
||||
try:
|
||||
swipe_down_back_callback()
|
||||
time.sleep(max(0.1, float(reservation_back_swipe_delay_s or 0.0)))
|
||||
current_room_pos = int(getattr(analyser, "room_pos", room_pos) or room_pos)
|
||||
except Exception:
|
||||
pass
|
||||
current_room_pos = int(room_pos)
|
||||
|
||||
# 计算位置差
|
||||
try:
|
||||
target_pos = int(target.get("pos_seen") or 0)
|
||||
except Exception:
|
||||
target_pos = 0
|
||||
pos_diff = current_room_pos - target_pos
|
||||
|
||||
# 调用上层提供的"按预约信息回退到目标直播间"的回调
|
||||
try:
|
||||
analyser._log_kv(
|
||||
"预约",
|
||||
"[预约] 准备执行回退到预约直播间",
|
||||
target_pos_seen=int(target.get("pos_seen", 0)),
|
||||
current_room_pos=room_pos,
|
||||
pos_diff=int(room_pos) - int(target.get("pos_seen", 0)),
|
||||
target_pos_seen=target_pos,
|
||||
current_room_pos=current_room_pos,
|
||||
pos_diff=pos_diff,
|
||||
)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# 如果已经在目标位置(pos_diff == 0),不需要先回退,直接调用回调
|
||||
# 如果不在目标位置,先轻微下滑一次,确保在直播列表中 / 或触发系统返回
|
||||
if pos_diff != 0:
|
||||
try:
|
||||
swipe_down_back_callback()
|
||||
time.sleep(max(0.1, float(reservation_back_swipe_delay_s or 0.0)))
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
ok = False
|
||||
try:
|
||||
|
||||
Reference in new issue
Block a user