From 7799d5acb4a25526625b3e99c2f7fd71d1be39ff Mon Sep 17 00:00:00 2001
From: qixiaoning <jony.kee@outlook.com>
Date: 星期二, 26 八月 2025 08:47:58 +0800
Subject: [PATCH] mqtt引入

---
 chanmanage-service/controllers/pollSet.go |   46 +++++++++++++++++++++++++++++++++-------------
 1 files changed, 33 insertions(+), 13 deletions(-)

diff --git a/chanmanage-service/controllers/pollSet.go b/chanmanage-service/controllers/pollSet.go
index b3e7f01..275584e 100644
--- a/chanmanage-service/controllers/pollSet.go
+++ b/chanmanage-service/controllers/pollSet.go
@@ -1,10 +1,6 @@
 package controllers
 
 import (
-	"basic.com/pubsub/protomsg.git"
-	"basic.com/valib/bhomeclient.git"
-	"basic.com/valib/bhomedbapi.git"
-	"basic.com/valib/logger.git"
 	"strconv"
 	"strings"
 	commonModel "vamicro/camera-common/models"
@@ -13,6 +9,11 @@
 	"vamicro/chanmanage-service/models"
 	"vamicro/chanmanage-service/service"
 	"vamicro/config"
+
+	"basic.com/pubsub/protomsg.git"
+	"basic.com/valib/bhomeclient.git"
+	"basic.com/valib/bhomedbapi.git"
+	"basic.com/valib/logger.git"
 )
 
 type PollSetController struct {
@@ -252,6 +253,9 @@
 			}
 		}
 		_, allLinks := crApi.FindAllCameraLink()
+
+		//鑾峰彇鐫f煡浠诲姟
+
 		for _, cE := range list {
 			var cri vo.CameraRunInfo
 			cri.CopyFromProtoCamera(cE)
@@ -265,20 +269,36 @@
 				}
 			}
 
-			if cgs, ok := ruleM[cE.Id]; ok {
-				for _, g := range cgs.Rules {
-					var crTask vo.CameraRunTask
+			// if cgs, ok := ruleM[cE.Id]; ok {
+			// 	for _, g := range cgs.Rules {
+			// 		var crTask vo.CameraRunTask
 
-					crTask.HasRule = g.Enable
-					crTask.TaskName = g.SceneName
-					cri.Tasks = append(cri.Tasks, crTask)
+			// 		crTask.HasRule = g.Enable
+			// 		crTask.TaskName = g.SceneName
+			// 		cri.Tasks = append(cri.Tasks, crTask)
+			// 	}
+			// } else {
+			// 	cri.Tasks = []vo.CameraRunTask{}
+			// }
+			var ids []string = []string{}
+			ids = append(ids, cE.Id)
+			tasks, _ := models.GetListTask(ids)
+			//rules
+			ruleMap := models.GetAllRule()
+
+			cri.AllTasks = []commonModel.TaskM{}
+			for _, item := range tasks {
+				temp := &commonModel.TaskM{
+					TaskName:        item.TaskName,
+					EventName:       item.EventName,
+					TaskDescription: ruleMap[item.TaskId],
 				}
-			} else {
-				cri.Tasks = []vo.CameraRunTask{}
+				cri.AllTasks = append(cri.AllTasks, *temp)
 			}
+
 			//澶勭悊鎽勫儚鏈虹殑鐘舵��
 			if cE.RunType == commonModel.TYPE_RUNTYPE_POLL || cE.RunType == commonModel.TYPE_RUNTYPE_REALTIME {
-				if crInfo, ok := ruleM[cE.Id]; ok && crInfo.Rules != nil && len(crInfo.Rules) > 0 {
+				if cri.AllTasks != nil && len(cri.AllTasks) > 0 {
 					if cE.IsRunning {
 						cri.Status = commonModel.Camera_Status_Doing
 					} else {

--
Gitblit v1.8.0