Browse Source

feature(钉钉消息):markdown消息修改

ZZH-wl 1 year ago
parent
commit
9cd7902321

+ 2 - 2
opms_admin/app/service/sys_message.go

@@ -140,7 +140,7 @@ func (s *MessageService) Create(req *model.CreateSysMessageReq) (err error) {
 			go s.BatchSendUserEmailMsg(userIds, data.MsgTitle, data.MsgContent)
 			fmt.Println(v, "20")
 		case "30": // 30:钉钉
-			go s.BatchSendUserDingTalkTextMsg(userIds, data.MsgType, data.MsgContent)
+			go s.BatchSendUserDingTalkTextMsg(userIds, data.MsgType, data.MsgTitle, data.MsgContent)
 			fmt.Println(v, "30")
 		case "40": // 40:微信小程序订阅消息
 
@@ -157,7 +157,7 @@ func (s *MessageService) handleMsgBySetting(userIds []string, data *model.SysMes
 	if msgType == "websocket" {
 		go BatchSendMessageNotify(userIds, *data)
 	} else if msgType == "dingding" {
-		go s.BatchSendUserDingTalkTextMsg(userIds, data.MsgType, data.MsgContent)
+		go s.BatchSendUserDingTalkTextMsg(userIds, data.MsgType, data.MsgTitle, data.MsgContent)
 	} else {
 		fmt.Println("非法的消息类型:" + msgType)
 	}

+ 2 - 2
opms_admin/app/service/sys_send_message.go

@@ -94,7 +94,7 @@ func (c *contextService) SendUserDingTalkTextMsg(userId, msgTitle, msgContent st
 }
 
 // 批量发送钉钉
-func (c *contextService) BatchSendUserDingTalkTextMsg(userIds []string, msgType, msgContent string) error {
+func (c *contextService) BatchSendUserDingTalkTextMsg(userIds []string, msgType, msgTitle, msgContent string) error {
 	userInfos, err := dao.NewSysUserDao(c.Tenant).Fields(dao.SysUser.C.NickName, dao.SysUser.C.DingtalkUid).WherePri(userIds).All()
 	if err != nil {
 		g.Log().Error(err)
@@ -128,7 +128,7 @@ func (c *contextService) BatchSendUserDingTalkTextMsg(userIds []string, msgType,
 			Msg: corpconversation.Msg{
 				Msgtype: "markdown",
 				Markdown: corpconversation.MarkdownMsg{
-					Title: "notice",
+					Title: msgTitle,
 					Text:  msgContent,
 				},
 			},