12345678910111213141516171819202122232425262728293031323334353637 |
- 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("pageSize")
- currentIndex, _ := l.GetInt("currentIndex")
- LatestId, _ := l.GetInt64("latestId")
- total, _ := l.GetInt64("total")
- 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,
- Total: total,
- }
- }
- func (l *ListController) Finish() {
- l.PageInfo.Reset()
- }
|