From f3e86af1b589ece042e0c08750e6cb258c0f29cc Mon Sep 17 00:00:00 2001 From: lijun Date: Tue, 14 Jan 2025 15:11:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=8E=B7=E5=8F=96=E6=9D=83?= =?UTF-8?q?=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- handler/tool.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/handler/tool.go b/handler/tool.go index 09b31d4..0b2ab32 100644 --- a/handler/tool.go +++ b/handler/tool.go @@ -1,6 +1,7 @@ package handler import ( + "VideoStream/dao" "VideoStream/proto" "VideoStream/service" "VideoStream/worker" @@ -65,6 +66,15 @@ type videoStreamReq struct { func GetVideoStream(c *gin.Context) { var req videoStreamReq + id, _ := c.Get("id") + id1 := id.(int) + //校验权限 + device := dao.FindDeviceByID(req.ID, id1) + if device.ID == 0 { + c.JSON(400, gin.H{"error": "device not exist"}) + return + } + if err := c.ShouldBind(&req); err != nil { c.JSON(400, gin.H{"error": err.Error()}) return