Compare commits
No commits in common. "d9edd7fa7a4c409d3b8249f8c75eff1671118f50" and "edef1fd7e005f901c1a0d5af7449e907f9f5a97d" have entirely different histories.
d9edd7fa7a
...
edef1fd7e0
17
dao/video.go
17
dao/video.go
|
|
@ -115,23 +115,6 @@ func FindVideoListsByAuthID(auth_id int) []Video {
|
||||||
return videos
|
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 {
|
func FindVideoListByTime(auth_id int, startTime, endTime string) []Video {
|
||||||
var videos []Video
|
var videos []Video
|
||||||
if proto.Config.SERVER_SQL_LOG {
|
if proto.Config.SERVER_SQL_LOG {
|
||||||
|
|
|
||||||
|
|
@ -21,12 +21,7 @@ func GetWillDelVideoList(id int) []dao.Video {
|
||||||
|
|
||||||
func GetVideoList(auth_id, id int, start, end, hour string) []dao.Video {
|
func GetVideoList(auth_id, id int, start, end, hour string) []dao.Video {
|
||||||
if id > 0 {
|
if id > 0 {
|
||||||
user := dao.FindUserByID2(auth_id)
|
return []dao.Video{dao.FindVideoByID(id, auth_id)}
|
||||||
if user.Role == "admin" {
|
|
||||||
return dao.FindVideoByID2(id) //可根据id查找视频
|
|
||||||
} else {
|
|
||||||
return []dao.Video{dao.FindVideoByID(id, auth_id)}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if start == "" {
|
if start == "" {
|
||||||
return dao.FindVideoListsByAuthID(auth_id)
|
return dao.FindVideoListsByAuthID(auth_id)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue