From c5b867e4bd11d6f480ccadc0882a81f6b7b6d521 Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期五, 01 十二月 2023 10:10:07 +0800
Subject: [PATCH] change router
---
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, ¶ms)
if !ok {
--
Gitblit v1.8.0