Skip to content

Commit

Permalink
add page limit, change page index to begin from 1
Browse files Browse the repository at this point in the history
  • Loading branch information
colinlyguo committed Dec 10, 2023
1 parent 90302fb commit 61e9657
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions bridge-history-api/internal/logic/history_logic.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,8 @@ func getTxHistoryInfo(message *orm.CrossMessage) *types.TxHistoryInfo {
}

func (h *HistoryLogic) getCachedTxsInfo(ctx context.Context, cacheKey string, pageNum, pageSize uint64) ([]*types.TxHistoryInfo, uint64, bool, error) {
start := int64(pageNum * pageSize)
end := int64((pageNum+1)*pageSize - 1)
start := int64((pageNum - 1) * pageSize)
end := int64(pageNum*pageSize - 1)

total, err := h.redis.ZCard(ctx, cacheKey).Result()
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion bridge-history-api/internal/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const (
// QueryByAddressRequest the request parameter of address api
type QueryByAddressRequest struct {
Address string `form:"address" binding:"required"`
Page uint64 `form:"page" binding:"required"`
Page uint64 `form:"page" binding:"required,min=1"`
PageSize uint64 `form:"page_size" binding:"required,min=1,max=100"`
}

Expand Down

0 comments on commit 61e9657

Please sign in to comment.