12345678910111213141516171819202122232425262728293031 |
- package controllers
- import (
- "eta_mini_ht_api/common/contants"
- "eta_mini_ht_api/common/utils/page"
- )
- type ListController struct {
- BaseController
- PageInfo page.PageInfo
- }
- func (l *ListController) Prepare() {
- pageSize, _ := l.GetInt("page_size")
- currentIndex, _ := l.GetInt("current_index")
- LatestId, _ := l.GetInt64("latest_id")
- if pageSize <= 0 {
- pageSize = contants.PageSizeDefault
- }
- if currentIndex <= 0 {
- currentIndex = 1
- }
- if LatestId < 0 {
- LatestId = 0
- }
- l.PageInfo = page.PageInfo{
- LatestId: LatestId,
- Current: currentIndex,
- PageSize: pageSize,
- }
- }
|