|
@@ -49,20 +49,37 @@ var (
|
|
}
|
|
}
|
|
g.Log().Infof(ctx, "%s共有增量数据%d条", dataShow, count)
|
|
g.Log().Infof(ctx, "%s共有增量数据%d条", dataShow, count)
|
|
|
|
|
|
- sendFail := send.UpLoadFilesToSftp(ctx, fullName)
|
|
|
|
- if sendFail != nil {
|
|
|
|
- g.Log().Infof(ctx, "文件传输异常 %v", sendFail.Error())
|
|
|
|
|
|
+ var (
|
|
|
|
+ startDateStr = g.Cfg().MustGet(ctx, "sendTime.start").String()
|
|
|
|
+ endDateStr = g.Cfg().MustGet(ctx, "sendTime.end").String()
|
|
|
|
+ isSend = false
|
|
|
|
+ now = time.Now()
|
|
|
|
+ )
|
|
|
|
+ ss, ss_err := time.ParseInLocation(time.DateTime, startDateStr, time.Local)
|
|
|
|
+ se, se_err := time.ParseInLocation(time.DateTime, endDateStr, time.Local)
|
|
|
|
+ if se_err != nil || ss_err != nil {
|
|
|
|
+ g.Log().Errorf(ctx, "格式化发送时间异常 %v %v", ss_err, se_err)
|
|
|
|
+ } else {
|
|
|
|
+ if now.After(ss) && now.Before(se) {
|
|
|
|
+ isSend = true
|
|
|
|
+ }
|
|
}
|
|
}
|
|
-
|
|
|
|
- if qwRobotNotice := g.Cfg().MustGet(ctx, "qwRobotNotice").String(); qwRobotNotice != "" {
|
|
|
|
- var content string
|
|
|
|
- content = fmt.Sprintf("任务[%s]\n共%d条标讯数据", dataShow, count)
|
|
|
|
|
|
+ if isSend {
|
|
|
|
+ sendFail := send.UpLoadFilesToSftp(ctx, fullName)
|
|
if sendFail != nil {
|
|
if sendFail != nil {
|
|
- content += fmt.Sprintf("\n成功上传失败:%v", sendFail)
|
|
|
|
|
|
+ g.Log().Infof(ctx, "文件传输异常 %v", sendFail.Error())
|
|
}
|
|
}
|
|
- g.Log().Infof(ctx, content)
|
|
|
|
- if err := send.SendSimpleMsg2ChatBot(content); err != nil {
|
|
|
|
- g.Log().Errorf(ctx, "发送企业微信消息异常 %s", err.Error())
|
|
|
|
|
|
+
|
|
|
|
+ if qwRobotNotice := g.Cfg().MustGet(ctx, "qwRobotNotice").String(); qwRobotNotice != "" {
|
|
|
|
+ var content string
|
|
|
|
+ content = fmt.Sprintf("任务[%s]\n共%d条标讯数据", dataShow, count)
|
|
|
|
+ if sendFail != nil {
|
|
|
|
+ content += fmt.Sprintf("\n成功上传失败:%v", sendFail)
|
|
|
|
+ }
|
|
|
|
+ g.Log().Infof(ctx, content)
|
|
|
|
+ if err := send.SendSimpleMsg2ChatBot(content); err != nil {
|
|
|
|
+ g.Log().Errorf(ctx, "发送企业微信消息异常 %s", err.Error())
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|