From b2053f14e481f11879fbd60d7bc7b2913688cac0 Mon Sep 17 00:00:00 2001 From: junleea <354425203@qq.com> Date: Sun, 24 Nov 2024 15:19:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dmonitor=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- handler/tool.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/handler/tool.go b/handler/tool.go index 1ddb1a0..f9ec7d0 100644 --- a/handler/tool.go +++ b/handler/tool.go @@ -47,12 +47,12 @@ func SetDeviceStatusV2(c *gin.Context) { c.JSON(200, gin.H{"code": 400, "message": "参数错误"}) return } else { - token, _ := c.Get("token") - if token == nil { + token := c.Request.Header.Get("token") + if token == "" { c.JSON(200, gin.H{"code": 401, "message": "token为空"}) return } - devices := worker.GetRedisSetMembers(token.(string)) + devices := worker.GetRedisSetMembers(token) if len(devices) == 0 { c.JSON(200, gin.H{"code": 402, "message": "设备为空"}) return