添加获取权限
This commit is contained in:
parent
85fd2567d5
commit
f3e86af1b5
|
|
@ -1,6 +1,7 @@
|
||||||
package handler
|
package handler
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"VideoStream/dao"
|
||||||
"VideoStream/proto"
|
"VideoStream/proto"
|
||||||
"VideoStream/service"
|
"VideoStream/service"
|
||||||
"VideoStream/worker"
|
"VideoStream/worker"
|
||||||
|
|
@ -65,6 +66,15 @@ type videoStreamReq struct {
|
||||||
|
|
||||||
func GetVideoStream(c *gin.Context) {
|
func GetVideoStream(c *gin.Context) {
|
||||||
var req videoStreamReq
|
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 {
|
if err := c.ShouldBind(&req); err != nil {
|
||||||
c.JSON(400, gin.H{"error": err.Error()})
|
c.JSON(400, gin.H{"error": err.Error()})
|
||||||
return
|
return
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue