fix(countdown): 修复长倒计时被截断到15分钟的bug

check_countdown 中 >900s 的上限过于激进,将实际的58分钟福袋截断到14:50。
改为 >3600s(1小时)上限,兼容抖音的60分钟福袋。

同时修复 _extract_digits 取后N位的问题,改为取前N位,
避免当子图意外捕获额外数字时(如 "1458")被误提取为 "58"。

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
CodexandClaude Sonnet 4.5 committed 2026-05-23 19:22:20 +08:00
1 parent a50f08de5a
commit df69c6ab67
6 files changed
+113 -73

No files matched your search

+6 -6
View File
@@ -27,13 +27,13 @@ class TestExtractDigits:
def test_one_digit_pads_zero(self):
assert _extract_digits("5") == "05"
def test_more_than_max_takes_last(self):
# "002" -> 后两位 "02",但 "02" 以 0 开头且原串非全 0
# → 取移除前导 0 后的 "2",再 zfill 到 2 位 → "02"
def test_more_than_max_takes_first(self):
# "002" -> 前两位 "00",全是 0 且后面有非 0 数字
# → 取移除前导 0 后的 "2",zfill → "02"
assert _extract_digits("002") == "02"
def test_strips_non_digits(self):
assert _extract_digits("12:34") == "34" # 取后 2 位
assert _extract_digits("12:34") == "12" # 取前 2 位(分钟)
def test_empty(self):
assert _extract_digits("") == ""
@@ -45,8 +45,8 @@ class TestExtractDigits:
assert _extract_digits("00") == "00"
def test_leading_zero_three_digits(self):
# "025" -> 后 2 位 "25",不是以 0 开头 → 直接返回
assert _extract_digits("025") == "25"
# "025" -> 前 2 位 "02",不是全 0 → 直接返回
assert _extract_digits("025") == "02"
# ============================================================