Skip to content

Commit 847e7e3

Browse files
author
litongjava
committed
add NotificationUtils.sendWarm
1 parent 490482b commit 847e7e3

File tree

1 file changed

+40
-6
lines changed
  • docs/zh/22_tio-utils

1 file changed

+40
-6
lines changed

docs/zh/22_tio-utils/03.md

+40-6
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
### 1. 概述
44

5-
tio-boot 内置了消息通知组件,用户发送消息到 企业微信群
5+
tio-boot 内置了消息通知组件,用户发送消息到 微信企业群 飞书企业群 等等
66
本文档提供了一个通知组件的使用指南,介绍通过不同的方式发送通知,比如发送文本消息或者发送预警信息。它支持自定义通知方式,用户可以通过实现特定的接口来集成不同的通知服务。
77

88
添加依赖
@@ -45,11 +45,45 @@ NotificationUtils.sendTextMsg("您的消息内容");
4545
要发送预警信息,可以使用`NotificationUtils.sendWarm`方法:
4646

4747
```java
48-
String warningName = "警告名称";
49-
String level = "警告级别";
50-
String deviceName = "设备名称";
51-
String content = "警告内容";
52-
NotificationUtils.sendWarm(warningName, level, deviceName, content);
48+
package com.imaginix.kimi.service.monitoring;
49+
50+
import java.io.IOException;
51+
import java.util.Date;
52+
53+
import org.junit.Test;
54+
55+
import com.litongjava.tio.utils.environment.EnvironmentUtils;
56+
import com.litongjava.tio.utils.notification.NotifactionWarmModel;
57+
import com.litongjava.tio.utils.notification.NotificationUtils;
58+
59+
import lombok.Cleanup;
60+
import okhttp3.Response;
61+
62+
public class MonitoringNotificationTest {
63+
64+
@Test
65+
public void test() {
66+
EnvironmentUtils.load("app.properties");
67+
String appGroupName = "imaginix";
68+
String appName = "kimi-service-monitoring";
69+
String warningName = "警告名称";
70+
String level = "警告级别";
71+
String deviceName = "设备名称";
72+
String content = "警告内容";
73+
Date time = new Date();
74+
75+
NotifactionWarmModel notifactionWarmModel = new NotifactionWarmModel(appGroupName, appName, warningName, level,
76+
deviceName, content, time);
77+
78+
try {
79+
@Cleanup
80+
Response response = NotificationUtils.sendWarm(notifactionWarmModel);
81+
System.out.println(response.body().string());
82+
} catch (IOException e) {
83+
e.printStackTrace();
84+
}
85+
}
86+
}
5387
```
5488

5589
### 4. 自定义通知工厂

0 commit comments

Comments
 (0)