feat: 更新配置文件以启用调试捕获,调整福袋相关坐标,优化预约处理逻辑,增强界面显示信息
This commit is contained in:
1 parent
362b7c841c
commit
df65adfe4e
19 files changed
+127
-1994
No files matched your search
@@ -9,7 +9,7 @@
|
||||
|
||||
# 福袋相关常用坐标
|
||||
# 福袋价值裁剪区域 (left, top, right, bottom)
|
||||
VALUE_BOX_TARGET = (656, 1466, 769, 1656)
|
||||
VALUE_BOX_TARGET = (643, 1466, 769, 1656)
|
||||
|
||||
# 福袋详情内容区域(任务/描述)
|
||||
CONTENT_BOX = (389, 1273, 1000, 1534)
|
||||
|
||||
@@ -133,6 +133,12 @@ class ReservationHandler:
|
||||
|
||||
if best_match_pos is not None:
|
||||
try:
|
||||
room_info = room_pos_map[best_match_pos]
|
||||
if isinstance(room_info, dict):
|
||||
recorded_title = room_info.get("title", "")
|
||||
else:
|
||||
recorded_title = room_info[0] if room_info else ""
|
||||
|
||||
analyser._log_kv( # type: ignore[attr-defined]
|
||||
"预约",
|
||||
"[预约] _find_room_pos_by_title:在映射表中找到匹配位置",
|
||||
@@ -140,11 +146,7 @@ class ReservationHandler:
|
||||
target_title=target_title[:50] if target_title else "",
|
||||
found_pos=best_match_pos,
|
||||
match_score=round(best_match_score, 3),
|
||||
recorded_title=(
|
||||
room_pos_map[best_match_pos][0][:50]
|
||||
if room_pos_map[best_match_pos][0]
|
||||
else ""
|
||||
),
|
||||
recorded_title=recorded_title[:50] if recorded_title else "",
|
||||
)
|
||||
except Exception:
|
||||
pass
|
||||
@@ -941,12 +943,15 @@ def _dump_room_pos_map_to_state(analyser: Any) -> None:
|
||||
filtered = {}
|
||||
for k, v in room_pos_map.items():
|
||||
try:
|
||||
title = (v[0] or "").strip()
|
||||
if isinstance(v, dict):
|
||||
title = (v.get("title", "") or "").strip()
|
||||
title_raw = (v.get("title_raw", "") or "").strip()
|
||||
else:
|
||||
# 兼容旧格式
|
||||
title = (v[0] or "").strip() if len(v) > 0 else ""
|
||||
title_raw = (v[1] or "").strip() if len(v) > 1 else ""
|
||||
except Exception:
|
||||
title = ""
|
||||
try:
|
||||
title_raw = (v[1] or "").strip()
|
||||
except Exception:
|
||||
title_raw = ""
|
||||
if not title and not title_raw:
|
||||
continue
|
||||
@@ -982,12 +987,23 @@ def _dump_room_pos_map_to_state(analyser: Any) -> None:
|
||||
# 写 CSV
|
||||
with open(csv_tmp, "w", encoding="utf-8", newline="") as cf:
|
||||
writer = csv.writer(cf)
|
||||
writer.writerow(["pos", "title", "title_raw"])
|
||||
writer.writerow(["pos", "title", "title_raw", "has_fudai", "fudai_content"])
|
||||
for k in sorted(
|
||||
filtered.keys(), key=lambda x: int(x) if x.isdigit() else x
|
||||
):
|
||||
v = filtered.get(k, ["", ""]) or ["", ""]
|
||||
writer.writerow([k, v[0], v[1]])
|
||||
v = room_pos_map.get(int(k) if k.isdigit() else k, {})
|
||||
if isinstance(v, dict):
|
||||
title = v.get("title", "")
|
||||
title_raw = v.get("title_raw", "")
|
||||
has_fudai = v.get("has_fudai", False)
|
||||
fudai_content = v.get("fudai_content", "")
|
||||
else:
|
||||
# 兼容旧格式
|
||||
title = v[0] if len(v) > 0 else ""
|
||||
title_raw = v[1] if len(v) > 1 else ""
|
||||
has_fudai = False
|
||||
fudai_content = ""
|
||||
writer.writerow([k, title, title_raw, has_fudai, fudai_content[:100]])
|
||||
try:
|
||||
os.replace(csv_tmp, csv_path)
|
||||
except Exception:
|
||||
@@ -996,15 +1012,24 @@ def _dump_room_pos_map_to_state(analyser: Any) -> None:
|
||||
# 写 Markdown(顶部注释 source)
|
||||
with open(md_tmp, "w", encoding="utf-8") as mf:
|
||||
mf.write(f"<!-- source: {final_path} -->\n\n")
|
||||
mf.write("| 位置 | 标题 | 原始标题 |\n")
|
||||
mf.write("|-:|:-|:-|\n")
|
||||
mf.write("| 位置 | 标题 | 原始标题 | 有福袋 | 福袋内容 |\n")
|
||||
mf.write("|-:|:-|:-|:-:|:-|\n")
|
||||
for k in sorted(
|
||||
filtered.keys(), key=lambda x: int(x) if x.isdigit() else x
|
||||
):
|
||||
v = filtered.get(k, ["", ""]) or ["", ""]
|
||||
title = v[0].replace("|", "\\|")
|
||||
title_raw = v[1].replace("|", "\\|")
|
||||
mf.write(f"| {k} | {title} | {title_raw} |\n")
|
||||
v = room_pos_map.get(int(k) if k.isdigit() else k, {})
|
||||
if isinstance(v, dict):
|
||||
title = v.get("title", "").replace("|", "\\|")
|
||||
title_raw = v.get("title_raw", "").replace("|", "\\|")
|
||||
has_fudai = "✓" if v.get("has_fudai", False) else ""
|
||||
fudai_content = (v.get("fudai_content", "")[:50] + "..." if len(v.get("fudai_content", "")) > 50 else v.get("fudai_content", "")).replace("|", "\\|")
|
||||
else:
|
||||
# 兼容旧格式
|
||||
title = (v[0] if len(v) > 0 else "").replace("|", "\\|")
|
||||
title_raw = (v[1] if len(v) > 1 else "").replace("|", "\\|")
|
||||
has_fudai = ""
|
||||
fudai_content = ""
|
||||
mf.write(f"| {k} | {title} | {title_raw} | {has_fudai} | {fudai_content} |\n")
|
||||
try:
|
||||
os.replace(md_tmp, md_path)
|
||||
except Exception:
|
||||
|
||||
Reference in new issue
Block a user