baishaojie 3 päivää sitten
vanhempi
commit
5e7d19c016
2 muutettua tiedostoa jossa 3 lisäystä ja 14 poistoa
  1. 3 14
      http/handle/api/scheduled.go
  2. BIN
      tmr-watch.exe

+ 3 - 14
http/handle/api/scheduled.go

@@ -33,7 +33,7 @@ import (
 )
 
 func CronScheduled(ctx context.Context) {
-	os.Setenv("TZ", "Asia/Shanghai")
+
 	tx := restful.Engine.NewSession()
 	defer tx.Close()
 
@@ -1085,19 +1085,8 @@ func processAnalysisEarlyWarning(target []string, pastureId string, serviceId in
 }
 
 func manualUdData(pastureinfo *udPastureInfo) {
-
-	shanghaiLoc, err := time.LoadLocation("Asia/Shanghai")
-	if err != nil {
-		log.Printf("警告: 加载上海时区失败: %v", err)
-		shanghaiLoc = time.Local
-	}
-	
-	// 创建带时区的cron实例
-	c := cron.New(cron.WithLocation(shanghaiLoc))
-	
-
-	// c := cron.New()
-	c.AddFunc("10 06 * * *", func() {
+	c := cron.New()
+	c.AddFunc("10 13 * * *", func() {
 		tx := restful.Engine.NewSession()
 		defer tx.Close()
 		now := time.Now().AddDate(0, 0, -1).Format("2006-01-02")

BIN
tmr-watch.exe