chore: remove generated reports and logs from repo, update .gitignore

This commit is contained in:
Your Name committed 2026-01-03 11:22:33 +08:00
1 parent ee0511e327
commit 488f6a1fdf
15 files changed
+137 -48

No files matched your search

+55
View File
@@ -137,6 +137,55 @@ def find_and_open_fudai_detail(
"find_and_open_fudai_detail完成(未找到福袋)",
elapsed_seconds=round(elapsed, 2),
)
# 未找到福袋:增加连续未找到计数(由 analyser 维护),以便触发退出直播间动作
try:
cur = int(getattr(analyser, "_consecutive_no_fudai_count", 0) or 0)
cur += 1
setattr(analyser, "_consecutive_no_fudai_count", cur)
threshold = int(getattr(analyser, "fudai_exit_after_misses", 0) or 0) or None
if threshold is None or threshold <= 0:
# 如果未配置阈值,则尝试读取配置属性(兼容性)
try:
import json
cfg_path = path_config.get_config_path()
if cfg_path and os.path.exists(cfg_path):
with open(cfg_path, "r", encoding="utf-8") as f:
cfg = json.load(f)
threshold = int(cfg.get("fudai_exit_after_misses", 30) or 30)
except Exception:
threshold = 30
# 如果计数达到阈值,执行返回键退出直播间并重置计数
if threshold and cur >= threshold:
try:
analyser._log_kv(
"流程",
"连续未找到福袋达到阈值:按返回键退出直播间",
consecutive_no_fudai=cur,
threshold=threshold,
)
except Exception:
pass
try:
analyser.operation.click_back(analyser.device_id)
except Exception:
try:
# 兜底:使用通用 click 返回坐标
rx = int(getattr(analyser, "resolution_ratio_x", 1080) or 1080)
ry = int(getattr(analyser, "resolution_ratio_y", 2400) or 2400)
back_x = int(50 * rx / 1080)
back_y = int(50 * ry / 2400)
analyser.operation.click(analyser.device_id, back_x, back_y)
except Exception:
pass
# 重置计数,避免重复触发
try:
setattr(analyser, "_consecutive_no_fudai_count", 0)
except Exception:
pass
except Exception:
# 容错:如果处理计数或配置读取出错,忽略并继续返回 False
pass
return False
# 点击坐标:用检测到的 X,加一个固定基准 Y(图标所在高度)
@@ -277,6 +326,12 @@ def find_and_open_fudai_detail(
analyser._last_fudai_detail_tuple = None
except Exception:
pass
# 成功打开福袋详情:重置连续未找到计数
try:
setattr(analyser, "_consecutive_no_fudai_count", 0)
except Exception:
pass
elapsed = time.time() - func_start_time
analyser._log_kv(
"流程",
@@ -227,7 +227,11 @@ class MainLogicMixin(BaseFudaiMixin):
opened = douyin_flow_control.find_and_open_fudai_detail(self, room_pos_ref)
if opened:
# 成功打开福袋详情,调用参与逻辑
# 成功打开福袋详情:重置连续未找到计数并调用参与逻辑
try:
setattr(self, "_consecutive_no_fudai_count", 0)
except Exception:
pass
self._handle_in_fudai_detail()
self._safe_log("流程", "_handle_live_room_has_or_not_fudai:成功处理福袋")
else: