🚧 change video preview api
This commit is contained in:
@ -11,7 +11,7 @@ type VideoPreviewReq struct {
|
||||
FileId string `json:"file_id" binding:"required"`
|
||||
}
|
||||
|
||||
// handle video_preview request
|
||||
// VideoPreview handle video_preview request
|
||||
func VideoPreview(c *gin.Context) {
|
||||
drive := utils.GetDriveByName(c.Param("drive"))
|
||||
if drive == nil {
|
||||
@ -31,3 +31,23 @@ func VideoPreview(c *gin.Context) {
|
||||
}
|
||||
c.JSON(200, DataResponse(preview))
|
||||
}
|
||||
|
||||
func VideoPreviewPlayInfo(c *gin.Context) {
|
||||
drive := utils.GetDriveByName(c.Param("drive"))
|
||||
if drive == nil {
|
||||
c.JSON(200, MetaResponse(400, "drive isn't exist."))
|
||||
return
|
||||
}
|
||||
var req VideoPreviewReq
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
c.JSON(200, MetaResponse(400, "Bad Request:"+err.Error()))
|
||||
return
|
||||
}
|
||||
log.Debugf("preview_req:%+v", req)
|
||||
preview, err := alidrive.GetVideoPreviewPlayInfo(req.FileId, drive)
|
||||
if err != nil {
|
||||
c.JSON(200, MetaResponse(500, err.Error()))
|
||||
return
|
||||
}
|
||||
c.JSON(200, DataResponse(preview))
|
||||
}
|
Reference in New Issue
Block a user