From 87b55a899bc1b4bc7d5a0f8d6ad1a1ede233ebd1 Mon Sep 17 00:00:00 2001
From: qixiaoning <jony.kee@outlook.com>
Date: 星期四, 04 九月 2025 17:35:24 +0800
Subject: [PATCH] 系统监控模型进程统计实时监控摄像机名称为空问题修复

---
 push-service/controllers/eventPush.go |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/push-service/controllers/eventPush.go b/push-service/controllers/eventPush.go
index 048a46d..95853ac 100644
--- a/push-service/controllers/eventPush.go
+++ b/push-service/controllers/eventPush.go
@@ -1,6 +1,9 @@
 package controllers
 
 import (
+	"encoding/json"
+	"vamicro/push-service/models"
+	"vamicro/push-service/mqtt"
 	"vamicro/push-service/service"
 	"vamicro/push-service/vo"
 
@@ -127,6 +130,26 @@
 	}
 	sv := service.NewEventPushService(h.Bk)
 	if sv.ChangeStatus(statusBody.Id, statusBody.Enable) {
+		//娑堟伅鎻愰啋
+		var epE models.EventPush
+		epE.GetById(statusBody.Id)
+
+		//udp鎺ㄩ��
+		if epE.PushType == 1 {
+			msg := map[string]string{
+				"type":   "change", // 娉ㄦ剰閫楀彿
+				"status": "",       // 鏈�鍚庝竴涓厓绱犱篃闇�瑕侀�楀彿锛圙o 璇硶瑕佹眰锛�
+				"id":     statusBody.Id,
+			}
+			if statusBody.Enable {
+				msg["status"] = "start"
+			} else {
+				msg["status"] = "stop"
+			}
+			jsonStr, _ := json.Marshal(msg)
+			go mqtt.Client.Publish(mqtt.MQTT_CONFIG_TOPIC, jsonStr)
+		}
+
 		return &bhomeclient.Reply{Success: true, Msg: "淇敼鎴愬姛"}
 	} else {
 		return &bhomeclient.Reply{Success: false, Msg: "淇敼澶辫触"}

--
Gitblit v1.8.0