1
This commit is contained in:
@@ -198,6 +198,18 @@ func (r *ArticleDao) GetArticleOrderList(maps interface{}, orderField string, li
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// GetArticleRankList 获取文章排名列表
|
||||
func (r *ArticleDao) GetArticleRankList(maps interface{}, orderField string, limit int) (m []*model.Article, err error) {
|
||||
err = global.Db.Where(maps).
|
||||
Preload("ArticleAuthor").
|
||||
Preload("ArticleAuthor.BaseHospital").
|
||||
Order(orderField).Limit(limit).Find(&m).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// GetArticleRank 获取某一条数据的排名
|
||||
func (r *ArticleDao) GetArticleRank(articleID int64) (int, error) {
|
||||
var rank int
|
||||
|
||||
@@ -198,6 +198,18 @@ func (r *VideoDao) GetVideoOrderList(maps interface{}, orderField string, limit
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// GetVideoRankList 获取视频排名列表
|
||||
func (r *VideoDao) GetVideoRankList(maps interface{}, orderField string, limit int) (m []*model.Video, err error) {
|
||||
err = global.Db.Where(maps).
|
||||
Preload("VideoAuthor").
|
||||
Preload("VideoAuthor.BaseHospital").
|
||||
Order(orderField).Limit(limit).Find(&m).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// GetVideoRank 获取某一条数据的排名
|
||||
func (r *VideoDao) GetVideoRank(videoID int64) (int, error) {
|
||||
var rank int
|
||||
|
||||
Reference in New Issue
Block a user