From d8967012d344c070e5211f50dba540c9ef893a11 Mon Sep 17 00:00:00 2001 From: junleea <354425203@qq.com> Date: Tue, 17 Dec 2024 17:16:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=A7=86=E9=A2=91=E6=A0=B9?= =?UTF-8?q?=E6=8D=AEid=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- handler/video.go | 3 ++- service/videoService.go | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/handler/video.go b/handler/video.go index 341e005..41c0974 100644 --- a/handler/video.go +++ b/handler/video.go @@ -15,6 +15,7 @@ import ( // video获取视频列表请求 type gvlReq struct { + ID int `json:"id" form:"id"` StartTime int64 `json:"begin" form:"begin"` EndTime int64 `json:"end" form:"end"` IP string `json:"ip" form:"ip"` @@ -164,7 +165,7 @@ func GetVideoList(c *gin.Context) { tm1 = "" tm2 = "" } - videos := service.GetVideoList(int(id.(float64)), tm1, tm2, gvl_req.Hour) + videos := service.GetVideoList(int(id.(float64)), gvl_req.ID, tm1, tm2, gvl_req.Hour) c.JSON(http.StatusOK, gin.H{"data": videos, "code": proto.SuccessCode, "message": "success"}) } else { c.JSON(http.StatusOK, gin.H{"error": err.Error(), "code": proto.ParameterError, "message": "failed"}) diff --git a/service/videoService.go b/service/videoService.go index c94046a..fd61dba 100644 --- a/service/videoService.go +++ b/service/videoService.go @@ -16,7 +16,10 @@ func GetWillDelVideoList(id int) []dao.Video { return dao.FindWillDelVideoList(id) } -func GetVideoList(auth_id int, start, end, hour string) []dao.Video { +func GetVideoList(auth_id, id int, start, end, hour string) []dao.Video { + if id > 0 { + return []dao.Video{dao.FindVideoByID(id, auth_id)} + } if start == "" { return dao.FindVideoListsByAuthID(auth_id) } else {