mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-19 09:55:16 +08:00
fix 追加时间戳
This commit is contained in:
parent
4fad76397a
commit
3f1f74151f
@ -4,6 +4,7 @@ import com.fasterxml.jackson.databind.JsonNode;
|
|||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.dromara.common.core.utils.DateUtils;
|
||||||
import org.dromara.common.core.utils.StringUtils;
|
import org.dromara.common.core.utils.StringUtils;
|
||||||
import org.dromara.common.mail.utils.MailUtils;
|
import org.dromara.common.mail.utils.MailUtils;
|
||||||
import org.dromara.monitor.admin.config.properties.NotifyProperties;
|
import org.dromara.monitor.admin.config.properties.NotifyProperties;
|
||||||
@ -72,7 +73,7 @@ public class InfoNotifier {
|
|||||||
NotifyProperties.Mail mail = notifyProperties.getMail();
|
NotifyProperties.Mail mail = notifyProperties.getMail();
|
||||||
if (mail.getEnabled()) {
|
if (mail.getEnabled()) {
|
||||||
String message = StringUtils.format(mail.getTemplate(), notifier.getRegistName(), notifier.getInstanceId(),
|
String message = StringUtils.format(mail.getTemplate(), notifier.getRegistName(), notifier.getInstanceId(),
|
||||||
notifier.getStatusName(), notifier.getStatus(), notifier.getServiceUrl());
|
notifier.getStatusName(), notifier.getStatus(), notifier.getServiceUrl(), DateUtils.getTime());
|
||||||
try {
|
try {
|
||||||
MailUtils.sendHtml(mail.getTo(), notifier.getRegistName() + notifier.getStatusName(), message);
|
MailUtils.sendHtml(mail.getTo(), notifier.getRegistName() + notifier.getStatusName(), message);
|
||||||
log.info("邮件已发送至: {}", mail.getTo());
|
log.info("邮件已发送至: {}", mail.getTo());
|
||||||
@ -91,8 +92,8 @@ public class InfoNotifier {
|
|||||||
NotifyProperties.WebHook webHook = notifyProperties.getWebHook();
|
NotifyProperties.WebHook webHook = notifyProperties.getWebHook();
|
||||||
if (webHook.getEnabled()) {
|
if (webHook.getEnabled()) {
|
||||||
String title = notifier.getRegistName() + notifier.getStatusName();
|
String title = notifier.getRegistName() + notifier.getStatusName();
|
||||||
String message = StringUtils.format(webHook.getTemplate(), title,
|
String message = StringUtils.format(webHook.getTemplate(), title, notifier.getRegistName(),
|
||||||
notifier.getRegistName(), notifier.getInstanceId(), notifier.getStatus(), notifier.getServiceUrl());
|
notifier.getInstanceId(), notifier.getStatus(), notifier.getServiceUrl(), DateUtils.getTime());
|
||||||
if (StringUtils.isNotBlank(webHook.getKeywords())) {
|
if (StringUtils.isNotBlank(webHook.getKeywords())) {
|
||||||
//追加关键词到标题中
|
//追加关键词到标题中
|
||||||
title += "——" + webHook.getKeywords();
|
title += "——" + webHook.getKeywords();
|
||||||
|
|||||||
@ -79,6 +79,7 @@ notify:
|
|||||||
<p>服务名: <b>{}</b> ({})</p>
|
<p>服务名: <b>{}</b> ({})</p>
|
||||||
<p>状态: <b>{}</b> ({})</p>
|
<p>状态: <b>{}</b> ({})</p>
|
||||||
<p>服务IP: <b>{}</b></p>
|
<p>服务IP: <b>{}</b></p>
|
||||||
|
<p>时间: <b>{}</b></p>
|
||||||
</body></html>"
|
</body></html>"
|
||||||
web-hook:
|
web-hook:
|
||||||
enabled: false
|
enabled: false
|
||||||
@ -87,8 +88,9 @@ notify:
|
|||||||
secret:
|
secret:
|
||||||
keywords:
|
keywords:
|
||||||
template: |
|
template: |
|
||||||
### {}通知
|
#### **{}通知**
|
||||||
- **服务名**: {}
|
- **服务名**: {}
|
||||||
- **实例ID**: {}
|
- **实例ID**: {}
|
||||||
- **状态**: {}
|
- **状态**: {}
|
||||||
- **服务IP**: {}
|
- **服务IP**: {}
|
||||||
|
- **时间**: {}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user