fix GetPopularGameInfosHandler
This commit is contained in:
parent
4490c817db
commit
d91ca35a83
@ -20,7 +20,7 @@ type GetPopularGamesResponse struct {
|
||||
// @Tags popular
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param type path string true "Type(igdb-most-visited, igdb-most-wanted-to-play, igdb-most-playing, igdb-most-played, steam-top, v, steam-best-of-the-year, steam-most-played)"
|
||||
// @Param type path string true "Type(igdb-most-visited, igdb-most-wanted-to-play, igdb-most-playing, igdb-most-played, steam-top, steam-week-top, steam-best-of-the-year, steam-most-played)"
|
||||
// @Success 200 {object} GetPopularGamesResponse
|
||||
// @Failure 400 {object} GetPopularGamesResponse
|
||||
// @Failure 500 {object} GetPopularGamesResponse
|
||||
@ -68,7 +68,9 @@ func GetPopularGameInfosHandler(c *gin.Context) {
|
||||
Message: err.Error(),
|
||||
})
|
||||
}
|
||||
if len(infos) > 10 {
|
||||
infos = infos[:10]
|
||||
}
|
||||
} else {
|
||||
offset := 0
|
||||
for len(infos) < 10 {
|
||||
@ -97,8 +99,10 @@ func GetPopularGameInfosHandler(c *gin.Context) {
|
||||
}
|
||||
infos = append(infos, newInfos...)
|
||||
}
|
||||
if len(infos) > 10 {
|
||||
infos = infos[:10]
|
||||
}
|
||||
}
|
||||
c.JSON(http.StatusOK, GetPopularGamesResponse{
|
||||
Status: "ok",
|
||||
Games: infos,
|
||||
|
Loading…
Reference in New Issue
Block a user