Sfoglia il codice sorgente

更新 监控程序 定时删除数据

wcc 1 anno fa
parent
commit
f037ca7cc8
1 ha cambiato i file con 6 aggiunte e 2 eliminazioni
  1. 6 2
      bidding_listen/main.go

+ 6 - 2
bidding_listen/main.go

@@ -49,6 +49,10 @@ func specData() {
 //deleteData 删除数据
 func deleteData() {
 	now := time.Now()
+	if GF.Cron.Delete >= 0 {
+		log.Error("deleteData", zap.String("配置文件错误", "没有配置定时删除的delete"))
+		return
+	}
 	deleteTime := time.Date(now.Year(), now.Month(), now.Day()+GF.Cron.Delete, 0, 0, 0, 0, now.Location())
 	deleteStr := deleteTime.Format("2006-01-02 15:04:05")
 	rowsPerPage := 10000
@@ -61,7 +65,7 @@ func deleteData() {
          FROM
              ods_datamonitoring_bidding AS t
 
-         WHERE   t.comeintime < %s
+         WHERE   t.comeintime < "%s"
 
          ORDER BY t.id DESC  LIMIT 1
 `, deleteStr)
@@ -81,7 +85,7 @@ SELECT
           FROM
               ods_datamonitoring_bidding AS t
 
-         WHERE t.id > %d  && t.comeintime < %s
+         WHERE t.id > %d  && t.comeintime < "%s"
          ORDER BY t.id ASC
 
          LIMIT %d;