From bfef804862d9a8bbf2df9cb6f758bfc39eb8cdd7 Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期二, 07 十一月 2023 09:49:14 +0800
Subject: [PATCH] 设备信息增加设备名称字段

---
 api/v1/device.go |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/api/v1/device.go b/api/v1/device.go
index ee652be..c107808 100644
--- a/api/v1/device.go
+++ b/api/v1/device.go
@@ -29,7 +29,7 @@
 	if !ok {
 		return
 	}
-	if params.CurrentDeviceID != "" {
+	if params.CurrentDeviceID == "" {
 		ctx.Fail(ecode.ParamsErr)
 		return
 	}
@@ -45,7 +45,7 @@
 		return
 	}
 	service.SetDeviceIDToFile(params.CurrentDeviceID)
-	conf.Conf.SerfClusterStatus = params.CurrentDeviceID
+	conf.Conf.CurrentDeviceID = params.CurrentDeviceID
 	err = crontask.RestartTask(conf.Conf.SerfClusterStatus != constvar.SerfClusterStatusSlave)
 	if err != nil {
 		logx.Errorf("restart task failed:%v", err)
@@ -73,9 +73,13 @@
 		return
 	}
 	resp := response.DeviceListResponse{
-		SystemDeviceID:  conf.Conf.System.DeviceId,
-		CurrentDeviceID: conf.Conf.CurrentDeviceID,
-		DeviceIDList:    list,
+		SystemDeviceID:       conf.Conf.System.DeviceId,
+		CurrentDeviceID:      conf.Conf.CurrentDeviceID,
+		DeviceIDList:         list,
+		SystemDeviceStatus:   response.SystemDeviceStatusNormal,
+		ClusterStatus:        conf.Conf.SerfClusterStatus,
+		ClusterNodeQuantity:  conf.Conf.ClusterNodeQuantity,
+		SystemDeviceRunSince: conf.Conf.SystemDeviceRunSince,
 	}
 	ctx.OkWithDetailed(resp)
 }

--
Gitblit v1.8.0