From 8324f872ef3a4d0c978a9b1d062800c6a1701c12 Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期五, 01 十二月 2023 09:58:17 +0800
Subject: [PATCH] fix

---
 api/v1/device.go |   18 +++++++-----------
 1 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/api/v1/device.go b/api/v1/device.go
index eb079eb..5bcb18d 100644
--- a/api/v1/device.go
+++ b/api/v1/device.go
@@ -2,8 +2,6 @@
 
 import (
 	"apsClient/conf"
-	"apsClient/constvar"
-	"apsClient/crontask"
 	"apsClient/model/request"
 	"apsClient/model/response"
 	_ "apsClient/model/response"
@@ -34,6 +32,11 @@
 		return
 	}
 	list, err := service.GetDeviceIDList()
+	if err != nil {
+		logx.Errorf("SetCurrentDeviceId GetDeviceIDList err:%v", err)
+		ctx.Fail(ecode.DBErr)
+		return
+	}
 	findFlag := false
 	for _, item := range list {
 		if item == params.CurrentDeviceID {
@@ -46,24 +49,17 @@
 	}
 	service.SetDeviceIDToFile(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)
-		ctx.Fail(ecode.UnknownErr)
-		return
-	}
-
 	ctx.Ok()
 }
 
-// SetDeviceConfig
+// Config
 // @Tags      璁惧
 // @Summary   璁剧疆璁惧涓�浜涢厤缃�
 // @Produce   application/json
 // @Param     object  body    request.DeviceConfig true  "鏌ヨ鍙傛暟"
 // @Success   200   {object}  contextx.Response{}  "鎴愬姛"
 // @Router    /v1/device/config [post]
-func (slf *DeviceApi) config(c *gin.Context) {
+func (slf *DeviceApi) Config(c *gin.Context) {
 	var params request.DeviceConfig
 	ctx, ok := contextx.NewContext(c, &params)
 	if !ok {

--
Gitblit v1.8.0