wangbin пре 3 година
родитељ
комит
3057f24bfa
1 измењених фајлова са 22 додато и 5 уклоњено
  1. 22 5
      service/log/log_statistics.go

+ 22 - 5
service/log/log_statistics.go

@@ -1045,24 +1045,34 @@ func (s *ServiceStatisticsLog) RegularCheckPc() {
 			noReportingPc = append(noReportingPc, pc)
 		}
 	}
-	mpsPerson, _ := s.Person.GetUserInfo()
+	mpsPerson, _ := s.Person.GetUserInfoData()
 	var mobile []string
 	var content string
-	nameMps := map[string]int{}
+	nameMps := map[string]string{}
 	if len(noReportingPc) != 0 {
 		content += fmt.Sprintf("一小时内未检测到中控数据<font color=\"warning\">%d台</font>:", len(noReportingPc))
 		for _, pc := range noReportingPc {
 			content += "\n"
 			name := computersF[pc]
 			content += name + " : " + pc
-			nameMps[name] = 1
+			if nameMps[name] == "" {
+				nameMps[name] = pc
+			} else {
+				nameMps[name] += ","
+				nameMps[name] += pc
+			}
 		}
 	}
+	c := "# 未检测到电脑数据"
+	c += "\n"
 	if len(nameMps) != 0 {
-		for name, _ := range nameMps {
+		for name, ct := range nameMps {
 			if _, ok := mpsPerson[name]; ok {
-				mobile = append(mobile, mpsPerson[name])
+				mobile = append(mobile, mpsPerson[name].MobilePhoneNumber)
 			}
+			ct = fmt.Sprintf("<font color=\"warning\">%s</font>:", ct)
+			ct = c + ct
+			go s.SendContent(ct, mpsPerson[name].Url)
 		}
 	}
 	if content != "" {
@@ -1096,6 +1106,13 @@ type SendMsg struct {
 	} `json:"markdown"`
 }
 
+func (s *ServiceStatisticsLog) SendContent(content, url string) {
+	var sendMsg SendMsg
+	sendMsg.MsgType = "markdown"
+	sendMsg.Markdown.Content = content
+	_, _ = s.SendMsgData(url, sendMsg)
+}
+
 func (s *ServiceStatisticsLog) SendMsgData(url string, params interface{}) (result []byte, err error) {
 	result, err = utils.HttpPost(url, params)
 	return