chore: rename some request param
This commit is contained in:
@ -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
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user