添加获取要删除的视频记录。
This commit is contained in:
parent
c4b3eeb394
commit
8227718ee2
|
|
@ -19,6 +19,12 @@ type Video struct {
|
||||||
FileSize int `gorm:"column:file_size"`
|
FileSize int `gorm:"column:file_size"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func FindWillDelVideoList(id int) []Video {
|
||||||
|
var videos []Video
|
||||||
|
DB.Debug().Where("auth_id = ?", id).Where("delete_time<=now()").Find(&videos)
|
||||||
|
return videos
|
||||||
|
}
|
||||||
|
|
||||||
func CreateVideo(videoPath, videoName string, cameraID, authID, human, isDelete int, createTime, endTime string, fileSize int) uint {
|
func CreateVideo(videoPath, videoName string, cameraID, authID, human, isDelete int, createTime, endTime string, fileSize int) uint {
|
||||||
video := Video{VideoPath: videoPath, VideoName: videoName, CameraID: cameraID, AuthId: authID, Human: human, IsDelete: isDelete, CreateTime: createTime, EndTime: endTime, FileSize: fileSize}
|
video := Video{VideoPath: videoPath, VideoName: videoName, CameraID: cameraID, AuthId: authID, Human: human, IsDelete: isDelete, CreateTime: createTime, EndTime: endTime, FileSize: fileSize}
|
||||||
res := DB.Debug().Create(&video)
|
res := DB.Debug().Create(&video)
|
||||||
|
|
|
||||||
|
|
@ -67,12 +67,21 @@ type delayReq struct {
|
||||||
func SetUpVideoGroup(router *gin.Engine) {
|
func SetUpVideoGroup(router *gin.Engine) {
|
||||||
videoGroup := router.Group("/video")
|
videoGroup := router.Group("/video")
|
||||||
videoGroup.POST("/get_video_list", GetVideoList)
|
videoGroup.POST("/get_video_list", GetVideoList)
|
||||||
|
videoGroup.POST("/will_del_video_list", GetWillDelVideoList)
|
||||||
videoGroup.POST("/create", CreateVideo)
|
videoGroup.POST("/create", CreateVideo)
|
||||||
videoGroup.GET("/mp4", GetVideo)
|
videoGroup.GET("/mp4", GetVideo)
|
||||||
videoGroup.POST("/delay", DelayVideo)
|
videoGroup.POST("/delay", DelayVideo)
|
||||||
videoGroup.POST("/delete", DeleteVideo)
|
videoGroup.POST("/delete", DeleteVideo)
|
||||||
videoGroup.POST("/update", UpdateVideo)
|
videoGroup.POST("/update", UpdateVideo)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetWillDelVideoList(c *gin.Context) {
|
||||||
|
id, _ := c.Get("id")
|
||||||
|
videos := service.GetWillDelVideoList(int(id.(float64)))
|
||||||
|
c.JSON(http.StatusOK, gin.H{"videos": videos, "code": 0, "message": "success"})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
func UpdateVideo(c *gin.Context) {
|
func UpdateVideo(c *gin.Context) {
|
||||||
var video_req videoUpdateReq
|
var video_req videoUpdateReq
|
||||||
user_id, _ := c.Get("id")
|
user_id, _ := c.Get("id")
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,10 @@ func GetVideo(id, auth_id int) dao.Video {
|
||||||
return dao.FindVideoByID(id, auth_id)
|
return dao.FindVideoByID(id, auth_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetWillDelVideoList(id int) []dao.Video {
|
||||||
|
return dao.FindWillDelVideoList(id)
|
||||||
|
}
|
||||||
|
|
||||||
func GetVideoList(auth_id int, start, end string) []dao.Video {
|
func GetVideoList(auth_id int, start, end string) []dao.Video {
|
||||||
if start == "" {
|
if start == "" {
|
||||||
return dao.FindVideoListsByAuthID(auth_id)
|
return dao.FindVideoListsByAuthID(auth_id)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue