fix: 游戏列表按分页语义转换 offset
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user