添加视频id查询管理员方式
This commit is contained in:
parent
ec0c152032
commit
8689f78181
17
dao/video.go
17
dao/video.go
|
|
@ -115,6 +115,23 @@ func FindVideoListsByAuthID(auth_id int) []Video {
|
|||
return videos
|
||||
}
|
||||
|
||||
// 管理员查找视频,可查找所有视频
|
||||
func FindVideoByID2(id int) []Video {
|
||||
var videos []Video
|
||||
var err error
|
||||
if proto.Config.SERVER_SQL_LOG {
|
||||
res := DB.Debug().Raw("select * from videos where id = ?", id).Scan(&videos)
|
||||
err = res.Error
|
||||
} else {
|
||||
res := DB.Raw("select * from videos where id = ?", id).Scan(&videos)
|
||||
err = res.Error
|
||||
}
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
return videos
|
||||
}
|
||||
|
||||
func FindVideoListByTime(auth_id int, startTime, endTime string) []Video {
|
||||
var videos []Video
|
||||
if proto.Config.SERVER_SQL_LOG {
|
||||
|
|
|
|||
|
|
@ -21,7 +21,12 @@ func GetWillDelVideoList(id int) []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)}
|
||||
user := dao.FindUserByID2(auth_id)
|
||||
if user.Role == "admin" {
|
||||
return dao.FindVideoByID2(id) //可根据id查找视频
|
||||
} else {
|
||||
return []dao.Video{dao.FindVideoByID(id, auth_id)}
|
||||
}
|
||||
}
|
||||
if start == "" {
|
||||
return dao.FindVideoListsByAuthID(auth_id)
|
||||
|
|
|
|||
Loading…
Reference in New Issue