From 6267ca2039e6538e4f687071e71e2ad2dda11d09 Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期一, 13 十一月 2023 17:04:57 +0800
Subject: [PATCH] 系统启动时,保存systemDeviceId记录并上报

---
 main.go |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/main.go b/main.go
index 4158c90..2803974 100644
--- a/main.go
+++ b/main.go
@@ -45,6 +45,7 @@
 		"device_plc",
 		"system_status",
 		"process_model_plc_address",
+		"reports_to_cloud",
 	}
 
 	agent := serf.InitAgent("apsClient", syncTables, sqlitex.GetDB())
@@ -57,12 +58,16 @@
 	}
 
 	//浠庢枃浠堕噷璇诲彇褰撳墠鐢熶骇璁惧id鑾峰彇璁惧鍒楄〃绗竴涓�
-	err := service.InitCurrentDeviceID()
+	err := service.InitCurrentDeviceID(serf.Vasystem.ServerID)
 	if err != nil {
 		logx.Errorf("InitCurrentDeviceID error: %v, exit", err)
 		return
 	}
 
+	go func() {
+		service.ReportsSystemDeviceToCloud(serf.Vasystem.ServerID)
+	}()
+
 	// 鍒ゆ柇褰撳墠闆嗙兢鐘舵��
 	logx.Infof("current agent.ClusterStatus:%v", agent.ClusterStatus)
 	log.Println("current agent.ClusterStatus:", agent.ClusterStatus)

--
Gitblit v1.8.0