go-common/app/interface/main/tv/http/zone_index.go

38 lines
694 B
Go
Raw Normal View History

2019-04-22 10:49:16 +00:00
package http
import (
"go-common/app/interface/main/tv/model"
"go-common/library/ecode"
bm "go-common/library/net/http/blademaster"
)
func zoneIdx(c *bm.Context) {
var (
req = c.Request.Form
typeStr string
typeV int
pageStr string
pageV int
)
takeBuild(req) // take build number
if typeStr = req.Get("season_type"); typeStr == "" {
c.JSON(nil, ecode.RequestErr)
return
}
typeV = atoi(typeStr)
if pageStr = req.Get("page"); pageStr == "" {
pageV = 1
} else {
pageV = atoi(pageStr)
}
seasons, pager, err := tvSvc.LoadZoneIdx(pageV, typeV)
if err != nil {
c.JSON(nil, err)
return
}
c.JSON(model.IdxData{
List: seasons,
Pager: pager,
}, nil)
}