调整飞书机器人消息

pull/1121/head
梁宇奇 2025-11-10 13:46:36 +08:00
parent 66396df9d6
commit c67126175d
4 changed files with 31 additions and 3 deletions

View File

@ -299,3 +299,10 @@ tencent:
captcha:
captchaAppId: 199022475
appSecretKey: wcqMdqjV3fnvFKxUAq5mwulnD
# 飞书
fs:
robot:
monitorSwitch: true
monitorChartId: oc_34e207df88addd15d83ec274fda95ef6
monitorEnv: 测试

View File

@ -300,3 +300,10 @@ tencent:
captcha:
captchaAppId: 199022475
appSecretKey: wcqMdqjV3fnvFKxUAq5mwulnD
# 飞书
fs:
robot:
monitorSwitch: false
monitorChartId: oc_34e207df88addd15d83ec274fda95ef6
monitorEnv: 本地

View File

@ -299,3 +299,10 @@ tencent:
captcha:
captchaAppId: 199022475
appSecretKey: wcqMdqjV3fnvFKxUAq5mwulnD
# 飞书
fs:
robot:
monitorSwitch: true
monitorChartId: oc_34e207df88addd15d83ec274fda95ef6
monitorEnv: 生产

View File

@ -35,10 +35,12 @@ public class FsNotice extends AbstractNotice {
private String defaultAppSecret;
@Value("${fs.robot.defaultChatId:oc_34e207df88addd15d83ec274fda95ef6}")
private String defaultChatId;
@Value("${fs.robot.monitorSwitch:true}")
@Value("${fs.robot.monitorSwitch}")
private Boolean monitorSwitch;
@Value("${fs.robot.monitorChartId:oc_34e207df88addd15d83ec274fda95ef6}")
@Value("${fs.robot.monitorChartId}")
private String monitorChartId;
@Value("${fs.robot.monitorEnv}")
private String env;
/**
*
@ -47,7 +49,10 @@ public class FsNotice extends AbstractNotice {
* @param content
*/
public void sendMsg2DefaultChat(String title, String content) {
ThreadUtil.execAsync(() -> sendMsg(title, content, new String[]{defaultChatId}));
if (Boolean.TRUE.equals(monitorSwitch)) {
ThreadUtil.execAsync(() -> sendMsg(CharSequenceUtil.format("[{}]{}", env, title), content,
new String[]{defaultChatId}));
}
}
/**
@ -62,6 +67,8 @@ public class FsNotice extends AbstractNotice {
//内容
FeiShuMsg.ZhCn zhCn = new FeiShuMsg.ZhCn();
List<List<FeiShuMsg.BaseField>> contentFields = new ArrayList<>();
contentFields.add(Collections.singletonList(FeiShuTextField
.createText(CharSequenceUtil.format("环境:{}", env))));
contentFields.add(Collections.singletonList(FeiShuTextField
.createText(CharSequenceUtil.format("主机:{}", IpUtils.getHostIp()))));
contentFields.add(Collections.singletonList(FeiShuTextField