fix: 优化钉钉通知消息,去掉重复的标题
This commit is contained in:
parent
b6457bba01
commit
c001103192
@ -237,17 +237,12 @@ public class DingTalkController {
|
||||
default:
|
||||
// 简单测试消息
|
||||
title = params.getOrDefault("title", "系统测试消息");
|
||||
content.append("-------------------------------- \n");
|
||||
content.append(" 【 系 统 测 试 】 \n");
|
||||
content.append("-------------------------------- \n\n");
|
||||
content.append("这是一条来自 DesignHub 系统的测试消息 \n");
|
||||
content.append(" \n");
|
||||
content.append("如果您收到此消息,说明钉钉机器人配置成功! \n");
|
||||
content.append(" \n");
|
||||
content.append("测试时间:").append(java.time.LocalDateTime.now().format(
|
||||
java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))).append(" \n");
|
||||
content.append(" \n");
|
||||
content.append("点击下方按钮查看详情");
|
||||
java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
||||
break;
|
||||
}
|
||||
|
||||
@ -375,18 +370,13 @@ public class DingTalkController {
|
||||
|
||||
default:
|
||||
title = params.getOrDefault("title", "系统测试消息");
|
||||
content.append("-------------------------------- \n");
|
||||
content.append(" 【 系 统 测 试 】 \n");
|
||||
content.append("-------------------------------- \n\n");
|
||||
content.append("亲爱的 ").append(user.getRealName() != null ? user.getRealName() : user.getUsername()).append(": \n\n");
|
||||
content.append("这是一条来自 DesignHub 系统的测试消息 \n");
|
||||
content.append(" \n");
|
||||
content.append("如果您收到此消息,说明钉钉个人通知配置成功! \n");
|
||||
content.append(" \n");
|
||||
content.append("测试时间:").append(java.time.LocalDateTime.now().format(
|
||||
java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))).append(" \n");
|
||||
content.append(" \n");
|
||||
content.append("点击下方按钮查看详情");
|
||||
java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@ -289,8 +289,8 @@ public class DingTalkService {
|
||||
|
||||
Map<String, String> actionCard = new HashMap<>();
|
||||
actionCard.put("title", title);
|
||||
// 构建 markdown 正文,包含标题和内容
|
||||
String markdown = "### " + title + "\n\n" + content + "\n\n---\n*点击下方按钮查看详情*";
|
||||
// 构建 markdown 正文(卡片已有标题,内容中不再重复)
|
||||
String markdown = content;
|
||||
actionCard.put("markdown", markdown);
|
||||
actionCard.put("single_title", "查看详情 »");
|
||||
actionCard.put("single_url", jumpUrl);
|
||||
@ -370,9 +370,8 @@ public class DingTalkService {
|
||||
Map<String, Object> actionCard = new HashMap<>();
|
||||
actionCard.put("title", title);
|
||||
|
||||
// 构建 markdown 正文
|
||||
// 构建 markdown 正文(卡片已有标题,内容中不再重复)
|
||||
StringBuilder markdownBuilder = new StringBuilder();
|
||||
markdownBuilder.append("### ").append(title).append("\n\n");
|
||||
markdownBuilder.append(content);
|
||||
|
||||
// 如果有@人,在内容中添加@标记
|
||||
|
||||
@ -346,9 +346,6 @@ public class TaskApprovalService {
|
||||
try {
|
||||
String title = "新任务发布";
|
||||
StringBuilder content = new StringBuilder();
|
||||
content.append("-------------------------------- \n");
|
||||
content.append(" 【 新 任 务 发 布 】 \n");
|
||||
content.append("-------------------------------- \n\n");
|
||||
|
||||
// 基本信息
|
||||
content.append("**任务名称**:").append(task.getTitle()).append(" \n");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user