Skip to content

Commit

Permalink
[feature] 随机接口增加verify字段
Browse files Browse the repository at this point in the history
  • Loading branch information
kyrie committed Jan 28, 2023
1 parent 840209b commit e5cceb4
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions internal/app/api/idl/bilibili_picture.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ type BilibiliRandomPicture struct {
ImgSrc string `json:"img_src"`
DynamicID uint64 `json:"dynamic_id"`
Tags []BilibiliRandomPictureTag `json:"tags"`
Verify bool `json:"verify"`
}
type BilibiliRandomPictureTag struct {
TagID uint64 `json:"tag_id"`
Expand Down
2 changes: 2 additions & 0 deletions internal/app/api/service/bilbil_picture.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ func (c *RandomPicsCache) flush() {
ImgSrc: list[i].Pictures[j].ImgSrc,
DynamicID: list[i].DynamicID,
Tags: tags,
Verify: list[i].Verify,
})
}
}
Expand Down Expand Up @@ -202,6 +203,7 @@ func (service *BilbilPicture) Random(ctx context.Context) (*idl.BilibiliPictureR
ImgSrc: list[i].Pictures[j].ImgSrc,
DynamicID: list[i].DynamicID,
Tags: tags,
Verify: list[i].Verify,
})
}
}
Expand Down
2 changes: 1 addition & 1 deletion internal/repository/bilibili_picture.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func (impl *BilibiliPictureMysqlImpl) Random(rand float64) (list []*idl.Bilibili
return nil, err
}
offset := math.Floor((pair.MaxId - pair.MinId) * rand)
err = conn.Where("id >= ?", uint64(pair.MinId+offset)).Select("dynamic_id,pictures,topic_details").Limit(5).Find(&list).Error
err = conn.Where("id >= ?", uint64(pair.MinId+offset)).Select("dynamic_id,pictures,topic_details,verify").Limit(5).Find(&list).Error
if err != nil {
return nil, err
}
Expand Down

0 comments on commit e5cceb4

Please sign in to comment.