From 4691c6c2efe7fccc74c75eb01b91009791960259 Mon Sep 17 00:00:00 2001
From: zhangzengfei <zhangzengfei@smartai.com>
Date: 星期五, 17 五月 2024 22:59:32 +0800
Subject: [PATCH] 修复图片下载的bug

---
 service/nvcs.go |   24 ++++++++++++++++++++----
 1 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/service/nvcs.go b/service/nvcs.go
index 7882db5..6ada2b3 100644
--- a/service/nvcs.go
+++ b/service/nvcs.go
@@ -6,6 +6,7 @@
 	"fmt"
 	"io/ioutil"
 	"net"
+	"strings"
 
 	"gat1400Exchange/config"
 	"gat1400Exchange/models"
@@ -35,7 +36,7 @@
 }
 
 // 瀵规帴缃戠粶瑙嗛瀛楃鍙犲姞鍣�,鎺ユ敹udp鍙戦�佺殑妤煎眰淇℃伅, 鏇存柊device鍦板潃
-func NVCSServer() {
+func NVCSA1UDPServer() {
 	// 鎸囧畾鐩戝惉鐨勭鍙�
 	port := config.ServeConf.Port
 
@@ -90,10 +91,19 @@
 		}
 
 		elevator := data.Elevator[0]
+
+		// 绋嬪簭閮ㄧ讲鍦ㄨ澶囩, 瀛楃鍙犲姞鍣ㄤ笂鎶ョ殑鍚嶇О鍏佽涓虹┖. 鍦ㄤ簯绔�, 鍚嶇О蹇呴』涓庢憚鍍忔満鐩稿悓
+		if config.ServeConf.Role != "agent" {
+			elevator.Name = strings.Trim(elevator.Name, " ")
+			if elevator.Name == "" {
+				continue
+			}
+		}
+
 		var d = models.Device{
-			Id:  elevator.Name,
-			Pos: elevator.Status.FloorName,
-			Ip:  elevator.IP,
+			Id:    elevator.Name,
+			Floor: elevator.Status.FloorName,
+			Ip:    elevator.IP,
 		}
 
 		err = d.Upsert()
@@ -106,3 +116,9 @@
 		logger.Debug("Received %d bytes from %s, %+v", numBytes, clientAddr, data)
 	}
 }
+
+func StartNVCSServer() {
+	if config.NVCSConf.Model == "A1" {
+		go NVCSA1UDPServer()
+	}
+}

--
Gitblit v1.8.0