1
This commit is contained in:
@@ -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
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user