ranking.go 597 B

12345678910111213141516171819202122232425262728
  1. package routes
  2. import (
  3. "strconv"
  4. "codeberg.org/vnpower/pixivfe/v2/core"
  5. "net/http"
  6. )
  7. func RankingPage(w http.ResponseWriter, r *http.Request) error {
  8. mode := GetQueryParam(r, "mode", "daily")
  9. content := GetQueryParam(r, "content", "all")
  10. date := GetQueryParam(r, "date", "")
  11. page := GetQueryParam(r, "page", "1")
  12. pageInt, err := strconv.Atoi(page)
  13. if err != nil {
  14. return err
  15. }
  16. works, err := core.GetRanking(r, mode, content, date, page)
  17. if err != nil {
  18. return err
  19. }
  20. return Render(w, r, Data_rank{Title: "Ranking", Page: pageInt, PageLimit: 10, Date: date, Data: works})
  21. }