From 74c155ba2112a6e9f3be730e1656a157d2f6cefc Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期六, 02 九月 2023 18:05:42 +0800
Subject: [PATCH] update

---
 crontask/cron_task.go |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/crontask/cron_task.go b/crontask/cron_task.go
index e27df3e..0ad2210 100644
--- a/crontask/cron_task.go
+++ b/crontask/cron_task.go
@@ -1,6 +1,7 @@
 package crontask
 
 import (
+	"apsClient/conf"
 	"apsClient/constvar"
 	"apsClient/pkg/ecode"
 	"apsClient/pkg/logx"
@@ -10,8 +11,17 @@
 )
 
 func InitTask() error {
+
+	finishNumberTimeInterval := conf.Conf.PLC.FinishNumberTimeInterval
+	totalNumberTimeInterval := conf.Conf.PLC.TotalNumberTimeInterval
+	if finishNumberTimeInterval == 0 {
+		finishNumberTimeInterval = 6
+	}
+	if totalNumberTimeInterval == 0 {
+		totalNumberTimeInterval = 60
+	}
 	s := gocron.NewScheduler(time.UTC)
-	_, err := s.Every(9).Seconds().StartImmediately().Do(func() {
+	_, err := s.Every(finishNumberTimeInterval).Seconds().StartImmediately().Do(func() {
 		plcConfig, code := service.NewDevicePlcService().GetDevicePlc()
 		if code != ecode.OK {
 			return
@@ -27,7 +37,7 @@
 		return err
 	}
 
-	s.Every(60).Seconds().StartImmediately().Do(func() {
+	s.Every(totalNumberTimeInterval).Seconds().StartImmediately().Do(func() {
 		plcConfig, code := service.NewDevicePlcService().GetDevicePlc()
 		if code != ecode.OK {
 			return

--
Gitblit v1.8.0