Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
kober-basket authored Jun 6, 2022
1 parent 96a449b commit fb85f42
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion dao/video.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,16 @@ func PublishVideo(video models.Video) error {

// GetPublishListByUserId 查询用户已发布视频
func GetPublishListByUserId(userId int64) []models.Video {
var videos []models.Video
var videos []models.Video = nil
//查询用户已发布视频
err := global.MysqlEngine.Where("user_id = ?", userId).Find(&videos).Error
if err != nil {
return nil
}
//查询视频作者信息
for i := 0; i < len(videos); i++ {
user, _ := GetUserByID(videos[i].UserId)
videos[i].Author = *user
}
return videos
}

0 comments on commit fb85f42

Please sign in to comment.