From a16dcef8f200b787fcde115088cb699b167c3023 Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期六, 02 九月 2023 18:12:15 +0800
Subject: [PATCH] 获取plc写入地址只处理本设备的消息

---
 nsq/msg_handler.go     |    2 +-
 model/common/common.go |    1 +
 2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/model/common/common.go b/model/common/common.go
index a8fc8af..31ece9c 100644
--- a/model/common/common.go
+++ b/model/common/common.go
@@ -63,6 +63,7 @@
 	ResponsePlcAddress struct {
 		KeyData     []byte
 		AddressData []byte
+		DeviceId    string
 	}
 )
 
diff --git a/nsq/msg_handler.go b/nsq/msg_handler.go
index 00c63d5..129d390 100644
--- a/nsq/msg_handler.go
+++ b/nsq/msg_handler.go
@@ -102,7 +102,7 @@
 		logx.Errorf("ScheduleTask HandleMessage Unmarshal json err: %v", err.Error())
 		return nil
 	}
-	if len(resp.KeyData) == 0 || len(resp.AddressData) == 0 {
+	if len(resp.KeyData) == 0 || len(resp.AddressData) == 0 || resp.DeviceId != conf.Conf.System.DeviceId {
 		return nil
 	}
 	//鍐欏叆鍒版枃浠�

--
Gitblit v1.8.0