package data import ( "context" "eta/eta_task/services/alarm_msg" "eta/eta_task/utils" "fmt" "github.com/rdlucklib/rdluck_tools/http" "strings" ) //服务检测 // CheckWindDataInterface 检测wind数据服务器 func CheckWindDataInterface(cont context.Context) (err error) { if utils.WindServerUrl != "" { windServerUrlArr := strings.Split(utils.WindServerUrl, ",") for _, hzDataWindUrl := range windServerUrlArr { go func(urlStr string) { checkUrl := urlStr + `hz_server` body, err := http.Get(checkUrl) if err != nil { msg := fmt.Sprintf("检测:%s ;失败:CheckWindDataInterface ErrMsg:%s", checkUrl, err.Error()) go alarm_msg.SendAlarmMsg(msg, 3) } else { result := string(body) if result != `1` { msg := fmt.Sprintf("检测%s ;失败:CheckWindDataInterface ErrMsg:%s", checkUrl, string(body)) go alarm_msg.SendAlarmMsg(msg, 3) } } }(hzDataWindUrl) } } return } // CheckLtDataInterface 检测路透数据服务器 func CheckLtDataInterface(cont context.Context) (err error) { if utils.LtServerUrl != "" { go func() { checkUrl := utils.LtServerUrl + `hz_server` body, err := http.Get(checkUrl) if err != nil { msg := "检测路透数据服务器失败:CheckLtDataInterface ErrMsg:" + err.Error() go alarm_msg.SendAlarmMsg(msg, 3) } else { result := string(body) if result != `"ek true"` { msg := "检测路透数据服务器失败:CheckLtDataInterface ErrMsg:" + string(body) go alarm_msg.SendAlarmMsg(msg, 3) } } }() } return } func CheckPbDataInterface(cont context.Context) (err error) { if utils.PbServerUrl != "" { go func() { checkUrl := utils.PbServerUrl + `hz_server` body, err := http.Get(checkUrl) if err != nil { msg := "检测彭博数据服务器失败:CheckPbDataInterface ErrMsg:" + err.Error() go alarm_msg.SendAlarmMsg(msg, 3) } else { result := string(body) if result != "1" { msg := "检测彭博数据服务器失败:CheckPbDataInterface ErrMsg:" + string(body) go alarm_msg.SendAlarmMsg(msg, 3) } } }() } return }