migrate legacy API

Signed-off-by: hongming <talonwan@yunify.com>
This commit is contained in:
hongming
2020-04-14 13:59:37 +08:00
parent d38e396e8c
commit 5f951508c5
45 changed files with 1475 additions and 1358 deletions

View File

@@ -48,11 +48,12 @@ func newPagination(limit int, offset int) *Pagination {
}
func (p *Pagination) GetValidPagination(total int) (startIndex, endIndex int) {
if p.Limit == NoPagination.Limit {
return 0, total
}
if p.Limit < 0 || p.Offset < 0 {
if p.Limit < 0 || p.Offset < 0 || total == 0 {
return 0, 0
}