fix(通知): 账号状态分类合并为一条消息

This commit is contained in:
2026-10-21 16:47:13 +08:00
parent abaf65737e
commit 7bc19e9eaa
7 changed files with 45 additions and 40 deletions
+12 -12
View File
@@ -236,18 +236,18 @@ try:
finally:
_notifier.notify = _orig_notify
check("分类通知函数返回 True", ok, True)
check("按类型分别发送(3 类)", len(notes), 3)
check("事件名统一", {ev for ev, _ in notes}, {"account.status.summary"})
by_type = {kw.get("status_type"): kw for _, kw in notes}
ab = by_type.get("账号异常") or {}
check("账号异常标题", "账号异常" in (ab.get("title") or ""), True)
check("账号异常列表", "周周苏州吃喝玩乐" in (ab.get("accounts") or ""), True)
att = by_type.get("账号安全待提升") or {}
check("待提升列表", "锋哥苏州甲探访" in (att.get("accounts") or ""), True)
nrm = by_type.get("账号正常") or {}
check("账号正常列表", "锋哥苏州百业探访" in (nrm.get("accounts") or ""), True)
check("没有统计字段(按类型发,不做汇总)",
("total" in ab or "normal" in ab or "abnormal" in ab), False)
check("只发一条消息", len(notes), 1)
check("事件名", notes[0][0] if notes else "", "account.status.summary")
kw = notes[0][1] if notes else {}
groups = kw.get("groups") or ""
check("包含「账号异常」分类", "账号异常:" in groups, True)
check("账号异常列表", "周周苏州吃喝玩乐" in groups, True)
check("包含「账号安全待提升」分类", "账号安全待提升:" in groups, True)
check("待提升列表", "锋哥苏州甲探访" in groups, True)
check("包含「账号正常」分类", "账号正常:" in groups, True)
check("账号正常列表", "锋哥苏州百业探访" in groups, True)
check("没有统计字段(一个消息按类型列账号)",
("total" in kw or "normal" in kw or "abnormal" in kw), False)
print()
if fails: