fix(fudai): treat notice text as attended and harden attend/log parsing

This commit is contained in:
Your Name committed 2026-06-01 12:33:33 +08:00
1 parent 61dfc1c15c
commit 5a51c951a2
6 files changed
+158 -17

No files matched your search

+26 -6
View File
@@ -83,13 +83,23 @@ def _parse_fudai_fields(runner: Any, s: str) -> None:
content_extracted = False
room_title = ""
if "福袋内容:" in s:
runner._fudai_last["content"] = (
s.split("福袋内容:", 1)[1].strip().split()[0]
)
content_part = s.split("福袋内容:", 1)[1].strip()
# 只取真正的“内容值”,避免把后续“按钮文本=...”等附加字段吞进来污染统计面板
cut_markers = (" 按钮文本", " room_title=", " room_title:", " 倒计时", " 价值=")
for marker in cut_markers:
idx = content_part.find(marker)
if idx > 0:
content_part = content_part[:idx].strip()
break
runner._fudai_last["content"] = content_part.split()[0] if content_part else ""
runner._fudai_last["updated_ts"] = time.time()
content_extracted = True
else:
m = re.search(r"(?:字段_)?内容[=:]\s*([^\s]+)", s)
# “内容”字段必须是明确键名,避免误匹配“内容关键词过滤:通过”等普通日志文案
m = re.search(
r"(?<![\u4e00-\u9fa5A-Za-z0-9_])(?:字段_)?内容[=:]\s*([^\s]+)",
s,
)
if m:
runner._fudai_last["content"] = m.group(1).strip()
runner._fudai_last["updated_ts"] = time.time()
@@ -122,12 +132,22 @@ def _parse_fudai_fields(runner: Any, s: str) -> None:
runner._fudai_last["updated_ts"] = time.time()
if "倒计时时间:" in s:
countdown_part = s.split("倒计时时间:", 1)[1].strip()
for marker in (" 内容", " 按钮文本", " room_title=", " room_title:", " 价值="):
idx = countdown_part.find(marker)
if idx > 0:
countdown_part = countdown_part[:idx].strip()
break
runner._fudai_last["countdown"] = (
s.split("倒计时时间:", 1)[1].strip().split()[0]
countdown_part.split()[0] if countdown_part else ""
)
runner._fudai_last["updated_ts"] = time.time()
else:
m = re.search(r"(?:字段_)?倒计时[=:]?\s*([^\s]+)", s)
# 同上:限制为明确“倒计时”字段键,避免“倒计时过滤:通过”污染 countdown。
m = re.search(
r"(?<![\u4e00-\u9fa5A-Za-z0-9_])(?:字段_)?倒计时[=:]\s*([^\s]+)",
s,
)
if m:
runner._fudai_last["countdown"] = m.group(1).strip()
runner._fudai_last["updated_ts"] = time.time()