list_contoller.go 501 B

1234567891011121314151617181920212223242526272829
  1. package controllers
  2. import "eta_mini_ht_api/common/contants"
  3. type ListController struct {
  4. BaseController
  5. PageInfo PageInfo
  6. }
  7. func (l *ListController) Prepare() {
  8. pageSize, _ := l.GetInt("pageSize")
  9. currentIndex, _ := l.GetInt("currentIndex")
  10. if pageSize <= 0 {
  11. pageSize = contants.PageSizeDefault
  12. }
  13. if currentIndex <= 0 {
  14. currentIndex = 1
  15. }
  16. l.PageInfo = PageInfo{
  17. Current: currentIndex,
  18. PageSize: pageSize,
  19. }
  20. }
  21. type PageInfo struct {
  22. id int
  23. Current int
  24. PageSize int
  25. }