zone_index.go 694 B

12345678910111213141516171819202122232425262728293031323334353637
  1. package http
  2. import (
  3. "go-common/app/interface/main/tv/model"
  4. "go-common/library/ecode"
  5. bm "go-common/library/net/http/blademaster"
  6. )
  7. func zoneIdx(c *bm.Context) {
  8. var (
  9. req = c.Request.Form
  10. typeStr string
  11. typeV int
  12. pageStr string
  13. pageV int
  14. )
  15. takeBuild(req) // take build number
  16. if typeStr = req.Get("season_type"); typeStr == "" {
  17. c.JSON(nil, ecode.RequestErr)
  18. return
  19. }
  20. typeV = atoi(typeStr)
  21. if pageStr = req.Get("page"); pageStr == "" {
  22. pageV = 1
  23. } else {
  24. pageV = atoi(pageStr)
  25. }
  26. seasons, pager, err := tvSvc.LoadZoneIdx(pageV, typeV)
  27. if err != nil {
  28. c.JSON(nil, err)
  29. return
  30. }
  31. c.JSON(model.IdxData{
  32. List: seasons,
  33. Pager: pager,
  34. }, nil)
  35. }