Browse Source

feature(优化): 发送邮件内容调整

ZZH-wl 2 years ago
parent
commit
37cc020417
2 changed files with 5 additions and 2 deletions
  1. 2 2
      opms_admin/app/service/sys_send_message.go
  2. 3 0
      opms_parent/app/service/base.go

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

@@ -26,7 +26,7 @@ func (c *contextService) SendUserEmailMsg(userId, msgTitle, msgContent string) e
 	m.SetHeader("From", g.Config().GetString("email.From"))
 	m.SetHeader("To", userInfo.Email)
 	m.SetHeader("Subject", msgTitle)
-	m.SetBody("text/plain", msgContent)
+	m.SetBody("text/html", msgContent)
 
 	err = email.Client.DialAndSend(m)
 	if err != nil {
@@ -52,7 +52,7 @@ func (c *contextService) BatchSendUserEmailMsg(userIds []string, msgTitle, msgCo
 		m.SetHeader("From", g.Config().GetString("email.From"))
 		m.SetHeader("To", userInfo.Email)
 		m.SetHeader("Subject", msgTitle)
-		m.SetBody("text/plain", msgContent)
+		m.SetBody("text/html", msgContent)
 
 		err = email.Client.DialAndSend(m)
 		if err != nil {

+ 3 - 0
opms_parent/app/service/base.go

@@ -227,6 +227,9 @@ func GetUsersByDept(ctx context.Context, req *DeptIdReq) (map[string]int, error)
 	if err != nil {
 		return nil, myerrors.MicroCallError("获取部门下用户失败")
 	}
+	if resp.Data == nil {
+		return nil, myerrors.TipsError("部门不存在")
+	}
 	fmt.Println(resp.Data)
 	data := resp.Data.([]interface{})
 	fmt.Println(data)