package dingding
import (
"github.com/royeo/dingrobot"
"yangmengyao/dataChecksum/initlog"
)
func SendDingMsg(title string,dict []map[string]string,flag string) {
//webhook := "https://oapi.dingtalt/send?accesaf3a00fd59fd815baa6e02837802da8bc515f9542cd33e56"
webhook := "httpsngtalk.com/robot/send?access_tod6820bd0aa99f67853b00acf8fa57d228989391e"
robot := dingrobot.NewRobot(webhook)
atMobiles := []string{"17600584473"}
str:="@17600584473 : " + flag
for _,j:=range dict{
for key,val:=range j{
if key == "masterIp"{ //个别加色
str += ">"+ "<font color=#FF0000>"+ key + "</font>"+" | "+ "<font color=#FF0000>"+ val+"</font>" +"\n\n"+"*****"+"\n\n"
continue
}
if key == "SlaveIp"{
str += ">"+ "<font color=#FF0000>"+ key + "</font>"+" | "+ "<font color=#FF0000>"+ val+"</font>" +"\n\n"+"*****"+"\n\n"
continue
}
str += ">"+ "<font color=#FF0000>"+ key + "</font>"+" | "+ val +"\n\n"+"*****"+"\n\n"
}
str += "\n\n"+"**===========================**"+"\n\n"
}
isAtAll := false
err := robot.SendMarkdown(title, str, atMobiles, isAtAll)
if err != nil {
initlog.Error.Println(err)
}
}