chore: rename some request param

This commit is contained in:
Noah Hsu
2022-08-14 23:46:30 +08:00
parent 8cd05275f0
commit 02e2c809a8
6 changed files with 14 additions and 14 deletions

View File

@ -1,8 +1,8 @@
package common
type PageReq struct {
PageIndex int `json:"page_index" form:"page_index"`
PageSize int `json:"page_size" form:"page_size"`
Page int `json:"page_index" form:"page"`
PerPage int `json:"page_size" form:"per_page"`
}
const MaxUint = ^uint(0)
@ -11,10 +11,10 @@ const MaxInt = int(MaxUint >> 1)
const MinInt = -MaxInt - 1
func (p *PageReq) Validate() {
if p.PageIndex < 1 {
p.PageIndex = 1
if p.Page < 1 {
p.Page = 1
}
if p.PageSize < 1 {
p.PageSize = MaxInt
if p.PerPage < 1 {
p.PerPage = MaxInt
}
}