Skip to content

Commit

Permalink
[feature] 随机图片接口增加字段
Browse files Browse the repository at this point in the history
  • Loading branch information
kyrie committed Jan 28, 2023
1 parent e5cceb4 commit fafaad5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion internal/app/api/idl/bilibili_picture.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ type BilibiliPicturesRecommendResp struct {

type BilibiliPictureRandomResp struct {
BilibiliRandomPicture
DynamicURL string `json:"dynamic_url"`
DynamicURL string `json:"dynamic_url"`
DynamicIDStr string `json:"dynamic_id_str"`
}
type BilibiliDynamicDTO struct {
DynamicID uint64 `json:"dynamic_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 @@ -170,6 +170,7 @@ func (service *BilbilPicture) Random(ctx context.Context) (*idl.BilibiliPictureR
resp := &idl.BilibiliPictureRandomResp{}
resp.BilibiliRandomPicture = pictures[idx]
resp.DynamicURL = fmt.Sprintf(DynamicURL, pictures[idx].DynamicID)
resp.DynamicIDStr = fmt.Sprintf("%d", pictures[idx].DynamicID)
return resp, nil
}
}
Expand Down Expand Up @@ -211,6 +212,7 @@ func (service *BilbilPicture) Random(ctx context.Context) (*idl.BilibiliPictureR
resp := &idl.BilibiliPictureRandomResp{}
resp.BilibiliRandomPicture = pictures[idx]
resp.DynamicURL = fmt.Sprintf(DynamicURL, pictures[idx].DynamicID)
resp.DynamicIDStr = fmt.Sprintf("%d", pictures[idx].DynamicID)
return resp, nil
}

Expand Down

0 comments on commit fafaad5

Please sign in to comment.