添加获取权限

This commit is contained in:
lijun 2025-01-14 15:11:45 +08:00
parent 85fd2567d5
commit f3e86af1b5
1 changed files with 10 additions and 0 deletions

View File

@ -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