This commit is contained in:
2024-09-11 13:20:33 +08:00
parent af6c39f5f0
commit c44a1e565b
4 changed files with 40 additions and 2 deletions
+11 -1
View File
@@ -92,12 +92,22 @@ func (r *Article) GetArticle(c *gin.Context) {
// 获取数据
articleDao := dao.ArticleDao{}
article, err := articleDao.GetArticlePreloadById(articleId)
article, err := articleDao.GetArticleById(articleId)
if err != nil {
responses.FailWithMessage("文章错误", c)
return
}
// 获取文章作者
articleAuthorDao := dao.ArticleAuthorDao{}
articleAuthors, err := articleAuthorDao.GetArticleAuthorListPreloadByAuthorId(articleId)
if err != nil {
responses.FailWithMessage("文章错误", c)
return
}
article.ArticleAuthor = articleAuthors
// 获取排名
rank, _ := articleDao.GetArticleRank(article.ArticleId)
+11 -1
View File
@@ -92,12 +92,22 @@ func (r *Video) GetVideo(c *gin.Context) {
// 获取数据
videoDao := dao.VideoDao{}
video, err := videoDao.GetVideoPreloadById(videoId)
video, err := videoDao.GetVideoById(videoId)
if err != nil {
responses.FailWithMessage("文章错误", c)
return
}
// 获取视频作者
videoAuthorDao := dao.VideoAuthorDao{}
videoAuthors, err := videoAuthorDao.GetVideoAuthorListPreloadByVideoId(videoId)
if err != nil {
responses.FailWithMessage("文章错误", c)
return
}
video.VideoAuthor = videoAuthors
// 获取排名
rank, _ := videoDao.GetVideoRank(video.VideoId)