瀏覽代碼

优化定时任务

longan 2 年之前
父節點
當前提交
a6a9181fd9

+ 3 - 3
app/data/controller/calcTask.go

@@ -40,7 +40,7 @@ func CalcTask() {
 		service.EnvironmentDataService.DayDataSync()
 	})
 	//【告警管理】处理告警消息 同步告警
-	c.AddFunc("* */30 * * * ?", func() {
+	c.AddFunc("0 */30 * * * ?", func() {
 		warnSer.PlatformAlarmService.SyncAlarm()
 	})
 	//【告警管理】发送告警
@@ -52,8 +52,8 @@ func CalcTask() {
 	c.AddFunc("*/59 * * * * ?", func() {
 		recordCtl.AKeyAlarmRecord.SosRecordSync()
 	})
-	//【led信息屏】每5分钟 同步亮度与音量
-	c.AddFunc("* */5 * * * ?", func() {
+	//【led信息屏】每天6点和18点0分之后 同步亮度与音量(白天亮度高音量大,晚上变小)
+	c.AddFunc("1 0 6,18 * * ?", func() {
 		deviceCtl.InfoBoard.CronSyncBrightnessAndMusicvolume()
 	})
 	//【led信息屏】每59秒 播放节目同步

+ 0 - 2
app/device/controller/ipBroadcastController.go

@@ -165,10 +165,8 @@ func (c *ipBroadcastCtl) CronSyncIpCastPaying(id int) {
 		if device.PlayState == "空闲" {
 			playJson, ptype := service2.PublishLibrariesService.IPCastPaying(IPCast.ID)
 			if playJson != "" {
-				fmt.Printf("需要更新 \n")
 				err := edge_service.IpCastControlService{}.PushPlay(playJson, ptype)
 				if err != nil {
-					fmt.Printf("err = %v \n", err)
 					return
 				}
 			} else {

+ 0 - 1
app/device/edge_service/ipCastControlService.go

@@ -198,7 +198,6 @@ func (f IpCastControlService) PushPlay(playJson string, ptype int) error {
 		reqData.Action = "PlayText"
 	}
 	m := make(map[string]interface{})
-	fmt.Printf("playJson = %v \n", playJson)
 	err := json.Unmarshal([]byte(playJson), &m)
 	reqData.PostData = m
 	if err != nil {

+ 2 - 2
app/device/service/infoBoardServiceTime.go

@@ -243,7 +243,7 @@ func (s *infoBoardService) EdgeCmd(tenant, sn string, cmdNum, id int) {
 			split := strings.Split(dev.Condition, ",")
 			brightness := split[0]
 			musicvolume := split[1]
-			if isEight() {
+			if isNight() {
 				//晚上不同亮度和音量
 				brightness = split[2]
 				musicvolume = split[3]
@@ -287,7 +287,7 @@ func (s *infoBoardService) EdgePushLedProgram(tenant, sn, playJson string) {
 }
 
 // 判断是否晚上
-func isEight() bool {
+func isNight() bool {
 	now := time.Now()
 	hour := now.Hour()
 	if hour >= 18 || hour < 6 {

+ 0 - 1
app/warn/edge_service/syncAlarmService.go

@@ -39,7 +39,6 @@ func (r *RecordAlarmRecord) SyncAlartRecord(maxId int64, maxUpDateTime string) (
 	cfg := config.Instance()
 	api := cfg.Foreign.IotEdgeUrl + "/data/v1/alarm/sync"
 	url := fmt.Sprintf("%v?id=%d&&updatedat=%v", api, maxId, url2.QueryEscape(maxUpDateTime))
-	fmt.Printf("url = %v", url)
 	method := "GET"
 	client := &http.Client{}
 	req, err := http.NewRequest(method, url, nil)