有效期1
This commit is contained in:
parent
df6ca36956
commit
764c1a3b94
@ -174,24 +174,28 @@ func (r *Video) GetVideoRankList(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
var videoIds []int64
|
||||
|
||||
for _, video := range videos {
|
||||
videoIds = append(videoIds, video.VideoId)
|
||||
}
|
||||
|
||||
// 处理数据
|
||||
for i, video := range videos {
|
||||
videoIds = append(videoIds, video.VideoId)
|
||||
|
||||
// 判断最后两位票数是否相同
|
||||
if i == 14 {
|
||||
maps = make(map[string]interface{})
|
||||
maps["video_status"] = 1
|
||||
maps["vote_num"] = video.VoteNum
|
||||
results, err := videoDao.GetVideoList(maps)
|
||||
results, err := videoDao.GetVideoListNotIn(maps, videoIds)
|
||||
if err != nil {
|
||||
responses.OkWithData(nil, c)
|
||||
return
|
||||
}
|
||||
|
||||
for _, result := range results {
|
||||
if result.VideoId == video.VideoId {
|
||||
continue
|
||||
}
|
||||
|
||||
videos = append(videos, result)
|
||||
}
|
||||
}
|
||||
|
||||
@ -73,6 +73,15 @@ func (r *VideoDao) GetVideoList(maps interface{}) (m []*model.Video, err error)
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// GetVideoListNotIn 获取列表
|
||||
func (r *VideoDao) GetVideoListNotIn(maps interface{}, ids []int64) (m []*model.Video, err error) {
|
||||
err = global.Db.Where(maps).Where("video_id NOT IN ?", ids).Find(&m).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// GetVideoCount 获取数量
|
||||
func (r *VideoDao) GetVideoCount(maps interface{}) (total int64, err error) {
|
||||
err = global.Db.Model(&model.Video{}).Where(maps).Count(&total).Error
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user