ranking.go 551 B

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