feat(drivers/fwalert): - 新增饭碗警告

- 将 msg 移入饭碗警告body中
This commit is contained in:
mei
2026-08-02 20:53:39 +08:00
parent 9220cf82aa
commit 3831950780
4 changed files with 43 additions and 2 deletions
+2
View File
@@ -3,6 +3,7 @@
![GitHub go.mod Go version (subdirectory of monorepo)](https://img.shields.io/github/go-mod/go-version/ssdomei232/goodBaby)
![GitHub](https://img.shields.io/github/license/ssdomei232/goodBaby)
![GitHub tag (with filter)](https://img.shields.io/github/v/tag/ssdomei232/goodBaby)
根据《中国心血管健康与疾病报告2023》,中国 每年 猝死总人数(含心源性和非心源性)或达80万-100万,18-35岁人群占比为38%,也就是说,每天18-35岁人群有近1000人猝死
伴随着中国人口老龄化加剧,年轻人的牵挂越来越多,面对着可能的猝死,我们或许真的需要做好准备
@@ -119,6 +120,7 @@ cd web/frontend && npm run dev
* [OneBot (QQ)](docs/onebot-config.md)
* [钉钉机器人](docs/dingtalk-config.md)
* [GitHub](docs/github-config.md)
* [饭碗警告](docs/fwalert-config.md)
## 开发:新增一种规则类型
+30
View File
@@ -0,0 +1,30 @@
# 饭碗警告配置
规则类型: `fwalert`。
定时器到期后,请求饭碗警告的 Webhook 地址
饭碗警告: 比较简单的(不用实名认证)支持电话和短信通知的第三方平台: `https://fwalert.com/`,价格不算最低,但比较方便
## 规则配置 (Rule Config)
```json
{
"webhook_url": "https://fwalert.com/xxx-xxx-xxx-xxx-xxx",
"msg": "消息内容"
}
```
## 饭碗警告平台配置
goodbaby 在请求饭碗警告时将`msg`放在请求体中,参照下面和官方教程设置:
| 字段 | 值 |
| --- | --- |
| `变量名` | `message` |
| `变量来源` | `请求体(body)` |
| `提取规则` | `序列化数据` |
| `键` | `message` |
| `通知简述` | 随便填 |
| `通知正文` | `{{message}}` |
| `联系方式类型` | 参照官方文档添加并选择 |
+6 -1
View File
@@ -10,7 +10,12 @@ import (
func send(config *FwAlertRuleConfig) error {
restyClient := resty.New()
req := restyClient.R()
resp, err := req.Execute("GET", config.WebhookURL+"?message="+config.Msg)
req.SetBody(FwAlertRequest{
Message: config.Msg,
})
resp, err := req.Execute(resty.MethodPost, config.WebhookURL)
if err != nil {
return err
}
+4
View File
@@ -6,3 +6,7 @@ type FwAlertRuleConfig struct {
WebhookURL string `json:"webhook_url"`
Msg string `json:"msg"`
}
type FwAlertRequest struct {
Message string `json:"message"`
}