feat(monitor): 推送渠道拆分为飞书/企业微信独立勾选 (#74)

把监控推送从单一总开关 webhook_enabled(bool)升级为渠道数组
webhook_channels(list),飞书与企业微信各自独立勾选,做到「勾哪个
推哪个」。沿用项目已有的 review_push_channels 渠道数组模式。

后端:
- RuleModel 新增 webhook_channels 字段;normalize() 兼容老规则,
  webhook_enabled=True 自动迁移为 ['feishu','wecom']
- _maybe_send_webhook 按 channels 判断:'feishu' in channels 才推
  飞书,'wecom' in channels 才推企业微信
- 新增偏好 webhook_default_channels + PUT 接口;老 webhook_enabled_default
  保留兼容

前端:
- RuleEditor 飞书/企业微信勾选各自绑数组 includes/toggle
- 设置页推送通知卡片飞书/企业微信默认勾选独立
- 连板梯队封单弹窗「飞书」单胶囊改为飞书+企业微信双胶囊
- api.ts 类型 + updateWebhookDefaultChannels
This commit is contained in:
wshy
2026-07-08 13:48:22 +08:00
committed by GitHub
parent 5b2c88c93e
commit 8e56f3efb8
9 changed files with 197 additions and 66 deletions
+2 -1
View File
@@ -49,7 +49,8 @@ class RuleModel(BaseModel):
cooldown_seconds: int = 3600
severity: str = "info" # info | warn | critical
webhook_url: str = "" # Webhook 推送地址 (推送到 QMT 等外部软件, 待定)
webhook_enabled: bool = False
webhook_enabled: bool = False # 兼容老规则 (已由 webhook_channels 取代, 仅做向后兼容读)
webhook_channels: list[str] = [] # 命中时推送的外部渠道 (合法值 'feishu' | 'wecom')
message: str = ""
# ladder 专属 (连板梯队封单监控)
metric: str = "sealed_vol" # sealed_vol=封单量(手) | sealed_amount=封单额(元)