Explorar el Código

电脑数据加@

wangbin hace 3 años
padre
commit
623103c5e6

+ 4 - 0
service/dataStatistics/wechat_scanner_api.go

@@ -119,6 +119,10 @@ func (s *ServiceWeChatScannerApi) SyncGetWeChatScannerBalance() {
 	if err != nil {
 		global.GVA_LOG.Error("获取海马扫码余额失败,平台可能异常,请注意排查!!!")
 		keyWord = "获取海马扫码余额失败,平台可能异常,请注意排查!!!,错误信息:" + err.Error() + "\n"
+		content += keyWord
+		url := global.GVA_CONFIG.SendUrl.KeyWordSendUrl
+		_, _ = robotService.PostRobotToEnterpriseWeChatByMarkdown(url, content)
+		return
 	}
 	//global.GVA_LOG.Info("1:" + string(hm))
 	//hm2 := strings.Trim(string(hm), "")

+ 27 - 3
service/log/log_statistics.go

@@ -13,6 +13,7 @@ import (
 	"log-server/model/log"
 	"log-server/model/log/request"
 	"log-server/model/log/response"
+	"log-server/model/typeManage"
 	loging2 "log-server/service/log/loging"
 	"log-server/utils"
 	"strconv"
@@ -22,6 +23,7 @@ import (
 
 type ServiceStatisticsLog struct {
 	loging2.LogicalLog
+	Person typeManage.ResponsiblePerson
 }
 
 var StatisticsCompletedKey = "%s:StatisticsCompleted"
@@ -1052,15 +1054,24 @@ func (s *ServiceStatisticsLog) RegularCheckPc() {
 			noReportingPc = append(noReportingPc, pc)
 		}
 	}
-
+	mpsPerson, _ := s.Person.GetUserInfo()
+	var mobile []string
 	var content string
-
+	nameMps := map[string]int{}
 	if len(noReportingPc) != 0 {
-		content += fmt.Sprintf("小时内未检测到中控数据<font color=\"warning\">%d台</font>:", len(noReportingPc))
+		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 len(nameMps) != 0 {
+		for name, _ := range nameMps {
+			if _, ok := mpsPerson[name]; ok {
+				mobile = append(mobile, mpsPerson[name])
+			}
 		}
 	}
 	if content != "" {
@@ -1071,9 +1082,22 @@ func (s *ServiceStatisticsLog) RegularCheckPc() {
 		url := global.GVA_CONFIG.SendUrl.ComputerSendUrl
 		//url := "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=7d095d5b-8240-45fd-a68c-baff3628d83b"
 		_, err = s.SendMsgData(url, sendMsg)
+		if len(mobile) != 0 {
+			var sendTextData SendTextMsg
+			sendTextData.MsgType = "text"
+			sendTextData.Text.MentionedMobileList = mobile
+			_, _ = s.SendMsgData(url, sendTextData)
+		}
 	}
 }
 
+type SendTextMsg struct {
+	MsgType string `json:"msgtype"`
+	Text    struct {
+		MentionedMobileList []string `json:"mentioned_mobile_list"`
+	} `json:"text"`
+}
+
 type SendMsg struct {
 	MsgType  string `json:"msgtype"`
 	Markdown struct {

+ 3 - 3
service/task/sync_data.go

@@ -596,7 +596,7 @@ func (s *SyncData) TaskMsgSendRetainedData(ctx context.Context, completesInfo []
 	if msg == "" {
 		return
 	}
-	url := "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=7d095d5b-8240-45fd-a68c-baff3628d83b"
+	url := global.GVA_CONFIG.SendUrl.ComputerSendUrl
 	var sendData SendMsg
 	sendData.MsgType = "markdown"
 	sendData.Markdown.Content = msg
@@ -747,7 +747,7 @@ func (s *SyncData) TaskMsgSendFreeData(ctx context.Context, completesInfo []task
 	}
 	global.GVA_LOG.Warn(msg)
 	_ = s.cache.SetCacheStr(ctx, lastFreeMsgSendTimeKey, time.Now().Unix())
-	url := "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=7d095d5b-8240-45fd-a68c-baff3628d83b"
+	url := global.GVA_CONFIG.SendUrl.ComputerSendUrl
 	var sendData SendMsg
 	sendData.MsgType = "markdown"
 	sendData.Markdown.Content = msg
@@ -854,7 +854,7 @@ func (s *SyncData) CheckTaskCompletedInfo() {
 		msg += fmt.Sprintf("<font color=\"warning\">%s</font>", time.Now().Format("2006-01-02 15:04:05"))
 		msg += "\n"
 		msg += "今日任务目标已完成"
-		url := "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=7d095d5b-8240-45fd-a68c-baff3628d83b"
+		url := global.GVA_CONFIG.SendUrl.ComputerSendUrl
 		var sendData SendMsg
 		sendData.MsgType = "markdown"
 		sendData.Markdown.Content = msg