监控接口不进行登录检测,修改接口错误返回

This commit is contained in:
junleea 2024-11-07 15:52:55 +08:00
parent 42942e8876
commit b83195da91
2 changed files with 5 additions and 1 deletions

View File

@ -48,6 +48,10 @@ func SetDeviceStatusV2(c *gin.Context) {
return return
} else { } else {
token, _ := c.Get("token") token, _ := c.Get("token")
if token == nil {
c.JSON(200, gin.H{"code": 401, "message": "token为空"})
return
}
devices := worker.GetRedisSetMembers(token.(string)) devices := worker.GetRedisSetMembers(token.(string))
if len(devices) == 0 { if len(devices) == 0 {
c.JSON(200, gin.H{"code": 402, "message": "设备为空"}) c.JSON(200, gin.H{"code": 402, "message": "设备为空"})

View File

@ -9,7 +9,7 @@ import (
var Config ConfigStruct var Config ConfigStruct
var SigningKey = []byte{} var SigningKey = []byte{}
var Url_map = map[string]bool{"/login": true, "/register": true, "/uuid": true, "/gqr": true, "/cid/callback": true} var Url_map = map[string]bool{"/login": true, "/register": true, "/uuid": true, "/gqr": true, "/cid/callback": true, "/tool/monitor": true}
const ( const (
MYSQL_USER = "video_t2" MYSQL_USER = "video_t2"