package services import ( "fmt" "eta/eta_api/models" "eta/eta_api/services/alarm_msg" "eta/eta_api/utils" "strconv" "time" ) //func init() { // report, _ := models.GetReportById(572) // SendReportToThs(report) //} // SendReportToEmail 发送报告邮件 func SendReportToEmail(report *models.ReportDetail) (err error) { if utils.BusinessCode != utils.BusinessCodeRelease && utils.BusinessCode != utils.BusinessCodeSandbox { // 客户不做报告邮件推送 return } fmt.Println("SendReportToEmail") defer func() { if err != nil { //fmt.Println(utils.APPNAME+"【"+utils.RunMode+"】"+"失败提醒", "发送消息至同花顺失败 ErrMsg:"+err.Error(), utils.EmailSendToUsers) go alarm_msg.SendAlarmMsg("发送报告至邮件失败,SendReportToEmail ErrMsg:"+err.Error(), 3) //go utils.SendEmail(utils.APPNAME+"【"+utils.RunMode+"】"+"失败提醒", "SendReportToEmail ErrMsg:"+err.Error(), utils.EmailSendToUsers) } }() toUser := `` jumpUrl := `` if utils.RunMode == "debug" { //toUser = `glji@hzinsights.com` toUser = `317699326@qq.com` jumpUrl = "http://rddpweb.brilliantstart.cn/reportdtl?id=1578" + strconv.Itoa(report.Id) } else { toUser = "lijun011112@gtjas.com" jumpUrl = "https://ficc.hzinsights.com/reportdtl?id=" + strconv.Itoa(report.Id) } createDate, err := time.Parse(utils.FormatDateTime, report.CreateTime) createDateFrom := createDate.Format("060102") emailBody := `