|
@@ -369,3 +369,21 @@ func CheckTwoWeekOrMonthReport(classifyId int, classifyName string) (ok bool) {
|
|
|
}
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+// ClearReportSaveLog 每天清理两周前的报告保存日志
|
|
|
+func ClearReportSaveLog(cont context.Context) (err error) {
|
|
|
+ defer func() {
|
|
|
+ if err != nil {
|
|
|
+ tips := fmt.Sprintf("报告日志记录, SaveReportLogs error: %s", err.Error())
|
|
|
+ fmt.Println(tips)
|
|
|
+ go alarm_msg.SendAlarmMsg(tips, 2)
|
|
|
+ }
|
|
|
+ }()
|
|
|
+
|
|
|
+ twoWeek := time.Now().Local().AddDate(0, 0, -14).Format(utils.FormatDateTime)
|
|
|
+ e := models.ClearReportSaveLog(twoWeek)
|
|
|
+ if e != nil {
|
|
|
+ err = fmt.Errorf("ClearReportSaveLog: %s", e.Error())
|
|
|
+ }
|
|
|
+ return
|
|
|
+}
|