From 4bff651f78cc394dfa7b9e8fc878f7318fc9687f Mon Sep 17 00:00:00 2001 From: zetaloop Date: Sat, 4 Apr 2026 07:44:24 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=B8=B8=E6=88=8F=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=8C=89=E5=88=86=E9=A1=B5=E8=AF=AD=E4=B9=89=E8=BD=AC=E6=8D=A2?= =?UTF-8?q?=20offset?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/game/api/internal/logic/game/listGamesLogic.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/game/api/internal/logic/game/listGamesLogic.go b/app/game/api/internal/logic/game/listGamesLogic.go index 46a3530..b28204d 100644 --- a/app/game/api/internal/logic/game/listGamesLogic.go +++ b/app/game/api/internal/logic/game/listGamesLogic.go @@ -29,9 +29,13 @@ func NewListGamesLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListGam } func (l *ListGamesLogic) ListGames(req *types.PageReq) (resp *types.GameListResp, err error) { - // todo: add your logic here and delete this line + page := req.Offset + if req.Limit > 0 { + page = req.Offset/req.Limit + 1 + } + all, err := l.svcCtx.GameRpc.SearchGames(l.ctx, &pb.SearchGamesReq{ - Page: req.Offset, + Page: page, Limit: req.Limit, }) if err != nil {