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
+4 -1
View File
@@ -342,6 +342,7 @@ _FIELD_LABELS = {
"stopped": "停止", "failed_devices": "失败设备",
"normal": "正常", "abnormal": "异常", "attention": "待关注",
"status_counts": "状态分布", "status_type": "状态类型", "accounts": "账号",
"groups": "状态分类",
"abnormal_accounts": "异常/待关注账号", "source": "来源",
"failed_items": "失败明细", "filename": "文件", "size": "大小(字节)",
"tables": "表数", "include_apk": "含APK", "user": "操作人", "operator": "操作人",
@@ -455,7 +456,9 @@ def build_message(ev, fields, hook=None):
v = "、".join(str(x) for x in list(v)[:6]) + ("…" if len(v) > 6 else "")
elif isinstance(v, dict):
v = json.dumps(v, ensure_ascii=False)[:200]
rows.append((_label(k), str(v)[:400]))
# 单字段上限 800 字:账号状态分类可能列几十个账号;整条消息仍受
# 各适配器的 byte_limit(企微 4096 字节)兜底截断。
rows.append((_label(k), str(v)[:800]))
# 样本只在**真的合并了多条**时才有意义:合并 1 条时样本就是标题主体本身
if merged and merged.get("merged_count", 0) > 1:
samples = [s for s in (merged.get("samples") or [])[:3]