|
|
@ -3,9 +3,10 @@ package page |
|
|
|
// 服务端用
|
|
|
|
// 服务端用
|
|
|
|
|
|
|
|
|
|
|
|
const ( |
|
|
|
const ( |
|
|
|
DefaultFrontPage = 1 |
|
|
|
DefaultFrontPage = 1 |
|
|
|
MinFrontPageSize = 10 |
|
|
|
DefaultFrontPageSize = 10 |
|
|
|
MaxFrontPageSize = 100 |
|
|
|
MinFrontPageSize = 1 |
|
|
|
|
|
|
|
MaxFrontPageSize = 100 |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
type PaginationFront struct { |
|
|
|
type PaginationFront struct { |
|
|
@ -19,6 +20,10 @@ func FrontToBackend[T Integer](frontPage, frontPerPage T) (page, pageSize T) { |
|
|
|
frontPage = DefaultPage |
|
|
|
frontPage = DefaultPage |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if frontPerPage <= 0 { |
|
|
|
|
|
|
|
frontPerPage = DefaultFrontPageSize |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if frontPerPage <= MinFrontPageSize { |
|
|
|
if frontPerPage <= MinFrontPageSize { |
|
|
|
frontPerPage = MinFrontPageSize |
|
|
|
frontPerPage = MinFrontPageSize |
|
|
|
} |
|
|
|
} |
|
|
|