feat: 调整高价值福袋预约参数,增加提前参与时间和提高最低奖品价值

This commit is contained in:
Your Name committed 2026-01-04 15:07:49 +08:00
1 parent 6b9b02bd58
commit 8838b62e61
9 files changed
+35 -76

No files matched your search

+15 -11
View File
@@ -1913,9 +1913,11 @@ class underlying_operations:
debug_image = full_screenshot if full_screenshot is not None else img1
# 准备额外信息
# 保留小数点(包括全角/中文标点归一化为英文点)以便调试时看到如 24.9 这样的值
digits_result = ""
if text:
digits_result = "".join(ch for ch in str(text) if ch.isdigit())
t_norm = str(text).replace("。", ".").replace(",", ".").replace(".", ".")
digits_result = "".join(ch for ch in t_norm if ch.isdigit() or ch == ".")
extra_info_dict = {
"mode": change_color,
@@ -1973,27 +1975,29 @@ class underlying_operations:
# 只提取数字字符,并进行智能过滤
if text:
# 提取所有数字字符
digits = "".join(ch for ch in str(text) if ch.isdigit())
# 同时准备两种数字抽取结果:
# 1) digits_only: 仅数字(用于倒计时/位置等只需整数的场景)
# 2) digits: 允许小数点(用于金额/带小数的数值),并规范化常见全角标点
text_norm = str(text).replace("。", ".").replace(",", ".").replace(".", ".")
digits_only = "".join(ch for ch in text_norm if ch.isdigit())
digits = "".join(ch for ch in text_norm if ch.isdigit() or ch == ".")
# 智能过滤:如果识别到的数字太多(可能是识别到了文件名或坐标),
# 尝试提取合理的数字段
if len(digits) > 10:
if len(digits_only) > 10:
# 对于价值:通常不超过6位数字(999999元以内)
# 对于倒计时:通常是1-2位数字
# 尝试提取最后几个数字(通常是实际值)
# 或者提取最短的连续数字段
# 提取所有连续的数字段
digit_segments = re.findall(r"\d+", str(text))
# 提取所有连续的数字段(允许小数点的段落匹配)
digit_segments = re.findall(r"\d+(?:\.\d+)?", text_norm)
if digit_segments:
# 对于价值,选择最大的合理数字段(不超过6位)
# 对于价值,选择最大的合理数字段(不超过6位数字,不计小数点)
# 对于倒计时,选择1-2位的数字段
# 这里先返回所有数字,让调用方处理
# 但优先选择较短的段(1-6位)
reasonable_segments = [
s for s in digit_segments if 1 <= len(s) <= 6
]
# 但优先选择较短的段(1-6位),忽略小数点长度影响
reasonable_segments = [s for s in digit_segments if 1 <= len(s.replace('.', '')) <= 6]
if reasonable_segments:
# 如果有多段,优先选择较短的(倒计时)或较长的(价值)
# 这里返回最长的合理段(通常是价值)