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