Jelajahi Sumber

修复信息屏关机时间

sixian 2 tahun lalu
induk
melakukan
0fa47a05d1

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

@@ -39,10 +39,12 @@ func CalcTask() {
 	_ = c.AddFunc(daySpec, func() {
 		service.EnvironmentDataService.DayDataSync()
 	})
-	//【告警管理】处理告警消息
-	_ = c.AddFunc(hourSpec, func() {
-		//同步告警
+	//【告警管理】处理告警消息 同步告警
+	c.AddFunc("* */30 * * * ?", func() {
 		warnSer.PlatformAlarmService.SyncAlarm()
+	})
+	//【告警管理】发送告警
+	_ = c.AddFunc(hourSpec, func() {
 		//发送告警
 		warnSer.TaskWarnService.HandlingAlarms()
 	})

+ 1 - 1
app/device/controller/infoBoardController.go

@@ -199,7 +199,7 @@ func (s *infoBoardCtl) CronSyncLedPaying(id int) {
 				fmt.Printf("无需更新\n")
 			}
 		} else {
-			fmt.Printf("led设备不在线Sn = %v \n", led.Sn)
+			//fmt.Printf("led设备不在线Sn = %v \n", led.Sn)
 		}
 	}
 }

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

@@ -232,7 +232,7 @@ func (s *infoBoardService) EdgeCmd(tenant, sn string, cmdNum, id int) {
 			param["sleep"] = sleep
 			param["wakeup"] = wakeup
 		}
-		param["reboot"] = "12:30:1" //每日重启时间
+		param["reboot"] = "12:30:59" //每日重启时间
 		s.reqEdge(tenant, edgePost, param, action)
 	case 101: //更新亮度 音量, 这里需要做成定时任务去跑
 		device := &dao.InfoBoard{
@@ -301,8 +301,8 @@ func isEight() bool {
 
 // ledTimeFormat led开始 结束时间格式化
 func ledTimeFormat(stime string, etime string) (string, string) {
-	startTime := fmt.Sprintf("%v %v:01", time.Now().Format("2006-01-02"), stime)
-	endTime := fmt.Sprintf("%v %v:01", time.Now().Format("2006-01-02"), etime)
+	startTime := fmt.Sprintf("%v %v:59", time.Now().Format("2006-01-02"), stime)
+	endTime := fmt.Sprintf("%v %v:59", time.Now().Format("2006-01-02"), etime)
 
 	ktime, _ := time.Parse("2006-01-02 15:04:05", startTime)
 	jtime, _ := time.Parse("2006-01-02 15:04:05", endTime)
@@ -310,5 +310,5 @@ func ledTimeFormat(stime string, etime string) (string, string) {
 	atoi1, _ := strconv.Atoi(ktime.Format("15"))
 	atoi2, _ := strconv.Atoi(jtime.Format("15"))
 
-	return fmt.Sprintf("%v:%v:1", atoi1, ktime.Format("4")), fmt.Sprintf("%v:%v:1", atoi2, jtime.Format("4"))
+	return fmt.Sprintf("%v:%v:59", atoi1, ktime.Format("4")), fmt.Sprintf("%v:%v:59", atoi2, jtime.Format("4"))
 }

+ 4 - 3
app/multimedia/service/publishLibrariesService.go

@@ -313,7 +313,7 @@ func (s *publishLibrariesService) IPCastPaying(id int) (string, int) {
 	if librarie.Ptype == 1 {
 		paytime := diffTime(librarie.KsTime, librarie.JsTime)
 		if paytime < 0 {
-			logger.Logger.Errorf("播放时间出错啦")
+			//logger.Logger.Errorf("过了播放结束时间啦 ")
 			return "", 0
 		}
 		fileIds := []int{}
@@ -351,9 +351,10 @@ func (s *publishLibrariesService) IPCastPaying(id int) (string, int) {
 	}
 }
 
-// 计算2个时间相差多少秒
+// 计算还有多久结束
 func diffTime(stime, etime string) int {
-	stimeT, err := time.Parse("2006-01-02 15:04", fmt.Sprintf("%v %v", time.Now().Format("2006-01-02"), stime))
+	//stimeT, err := time.Parse("2006-01-02 15:04", fmt.Sprintf("%v %v", time.Now().Format("2006-01-02"), stime))
+	stimeT, err := time.Parse("2006-01-02 15:04", fmt.Sprintf("%v", time.Now().Format("2006-01-02 15:04")))
 	if err != nil {
 		return -1
 	}

+ 2 - 2
app/system/dao/tenant.go

@@ -67,9 +67,8 @@ func (c *Tenant) GetTenants(offset, limit int) ([]Tenant, int64, error) {
 	var tenants []Tenant
 	var counts int64
 	db := Db.Debug().Model(&c)
-	db.Count(&counts)
 	if c.TenantId == "" {
-		db = db.Where("tenant_id = ?", c.TenantId)
+		//db = db.Where("tenant_id = ?", c.TenantId)
 	}
 	if c.TenantName != "" {
 		db = db.Where("tenant_name like ?", "%"+c.TenantName+"%")
@@ -77,6 +76,7 @@ func (c *Tenant) GetTenants(offset, limit int) ([]Tenant, int64, error) {
 	if c.Linkman != "" {
 		db = db.Where("linkman like ?", "%"+c.Linkman+"%")
 	}
+	db.Count(&counts)
 	err := db.Where("is_deleted = 0").Offset(offset).Limit(limit).Find(&tenants).Error
 	return tenants, counts, err
 }