37 lines
867 B
Go
37 lines
867 B
Go
package service
|
|
|
|
import (
|
|
"time"
|
|
"videoplayer/dao"
|
|
)
|
|
|
|
func GetVideo(id, auth_id int) dao.Video {
|
|
return dao.FindVideoByID(id, auth_id)
|
|
}
|
|
|
|
func GetVideoList(auth_id int, start, end string) []dao.Video {
|
|
if start == "" {
|
|
return dao.FindVideoListsByAuthID(auth_id)
|
|
} else {
|
|
s, _ := time.Parse("2006-01-02 15:04:05", start)
|
|
e, _ := time.Parse("2006-01-02 15:04:05", end)
|
|
if s.After(e) {
|
|
return []dao.Video{}
|
|
}
|
|
return dao.FindVideoListByTime(auth_id, start, end)
|
|
}
|
|
|
|
}
|
|
|
|
func DelayVideo(id, auth_id, day int) {
|
|
dao.DelayVideo(id, auth_id, day)
|
|
}
|
|
|
|
func CreateVideo(videoPath, videoName string, authID, human, isDelete int, createTime, endTime string, fileSize int) int {
|
|
return dao.CreateVideo(videoPath, videoName, authID, human, isDelete, createTime, endTime, fileSize)
|
|
}
|
|
|
|
func DeleteVideo(id, user int) int {
|
|
return dao.DeleteVideoByID(id, user)
|
|
}
|