瀏覽代碼

去除邮件前缀

xiziwen 5 月之前
父節點
當前提交
13f63c6b0c
共有 2 個文件被更改,包括 11 次插入2 次删除
  1. 10 2
      services/pcsg/fix.go
  2. 1 0
      services/pcsg/mail.go

+ 10 - 2
services/pcsg/fix.go

@@ -96,7 +96,6 @@ func Fix() {
 	}
 }
 
-
 func FixHistory() {
 	list, err := report.GetMailOutsideReport()
 	if err != nil {
@@ -120,7 +119,7 @@ func FixHistory() {
 		ruleMap[v.Rule] = v
 	}
 
-	classifyAll , e := report.GetClassifyAll()
+	classifyAll, e := report.GetClassifyAll()
 	if e != nil {
 		err = e
 		global.FILE_LOG.Error("获取分类失败:", err)
@@ -164,5 +163,14 @@ func FixHistory() {
 				fmt.Println(reportInfo.Title, "更新成功")
 			}
 		}
+		if strings.Contains(reportInfo.Title, "[PCI ANALYTICS CLOUD PLATFORM(00) Fwd] - ") {
+			reportInfo.Title = strings.Replace(reportInfo.Title, "[PCI ANALYTICS CLOUD PLATFORM(00) Fwd] - ", "", -1)
+			err = reportInfo.Update([]string{"Title"})
+			if err != nil {
+				fmt.Println("更新失败:", err)
+				return
+			}
+			fmt.Println(reportInfo.Title, "去除前缀成功")
+		}
 	}
 }

+ 1 - 0
services/pcsg/mail.go

@@ -237,6 +237,7 @@ func handleMailMessage(emailMessage mail.MailMessage) (err error) {
 		CreateTime:       time.Now(),
 		ReportCode:       uuid.New().String(),
 	}
+	reportInfo.Title = strings.Replace(reportInfo.Title, "[PCI ANALYTICS CLOUD PLATFORM(00) Fwd] - ", "", -1)
 	for _, v := range ruleList {
 		if strings.Contains(emailMessage.Title, v.Rule) {
 			reportInfo.Title = v.Title