fix: 统一所有 RPC 分页校验为 max=100 并补齐默认值

This commit is contained in:
zetaloop
2026-04-24 06:31:40 +08:00
parent 37faf1c920
commit 809dbf2cac
15 changed files with 85 additions and 16 deletions
@@ -30,9 +30,12 @@ func (l *SearchShopInvitationsLogic) SearchShopInvitations(in *pb.SearchShopInvi
if in.Limit <= 0 {
in.Limit = 20
}
if in.Limit > 1000 {
if in.Limit > 100 {
return nil, errors.New("limit too large")
}
if in.Offset < 0 {
in.Offset = 0
}
preds := make([]predicate.ShopInvitations, 0, 8)
if in.Id > 0 {
@@ -30,9 +30,12 @@ func (l *SearchShopPlayersLogic) SearchShopPlayers(in *pb.SearchShopPlayersReq)
if in.Limit <= 0 {
in.Limit = 20
}
if in.Limit > 1000 {
if in.Limit > 100 {
return nil, errors.New("limit too large")
}
if in.Offset < 0 {
in.Offset = 0
}
preds := make([]predicate.ShopPlayers, 0, 8)
if in.ShopId > 0 {
@@ -34,9 +34,12 @@ func (l *SearchShopsLogic) SearchShops(in *pb.SearchShopsReq) (*pb.SearchShopsRe
if in.Limit <= 0 {
in.Limit = 20
}
if in.Limit > 1000 {
if in.Limit > 100 {
return nil, errors.New("limit too large")
}
if in.Offset < 0 {
in.Offset = 0
}
preds := make([]predicate.Shops, 0, 12)
if in.Id > 0 {