From d153b5cf51cf6c11190aeb8478af05006aced6e3 Mon Sep 17 00:00:00 2001 From: zetaloop Date: Tue, 7 Apr 2026 17:56:38 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=BB=9F=E4=B8=80=E5=88=86=E9=A1=B5?= =?UTF-8?q?=E8=AF=B7=E6=B1=82=E7=9A=84=20offset=20=E8=AF=AD=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../logic/community/createCommentLogic.go | 2 +- .../logic/community/createPostLogic.go | 2 +- .../internal/logic/community/getPostLogic.go | 2 +- .../logic/community/listCommentsLogic.go | 4 +- .../logic/community/listPostsLogic.go | 4 +- .../logic/community/listUserPostsLogic.go | 4 +- .../internal/logic/searchCommentLikesLogic.go | 2 +- .../rpc/internal/logic/searchCommentsLogic.go | 2 +- .../internal/logic/searchPostLikesLogic.go | 2 +- .../rpc/internal/logic/searchPostsLogic.go | 2 +- app/community/rpc/pb/community.pb.go | 50 ++-- .../api/internal/logic/game/listGamesLogic.go | 13 +- .../rpc/internal/logic/searchGamesLogic.go | 4 +- app/game/rpc/pb/game.pb.go | 127 +++++------ .../internal/logic/order/listOrdersLogic.go | 8 +- .../logic/searchOrderStateLogsLogic.go | 2 +- .../rpc/internal/logic/searchOrdersLogic.go | 2 +- app/order/rpc/pb/order.pb.go | 26 +-- .../logic/player/listPlayerServicesLogic.go | 6 +- .../internal/logic/player/listPlayersLogic.go | 6 +- .../logic/player/listServicesLogic.go | 6 +- .../logic/searchPlayerServicesLogic.go | 2 +- .../rpc/internal/logic/searchPlayersLogic.go | 2 +- app/player/rpc/pb/player.pb.go | 214 +++++++++--------- app/shop/api/internal/logic/shop/helpers.go | 2 +- .../api/internal/logic/shop/listShopsLogic.go | 4 +- .../logic/searchShopInvitationsLogic.go | 2 +- .../internal/logic/searchShopPlayersLogic.go | 2 +- .../rpc/internal/logic/searchShopsLogic.go | 2 +- app/shop/rpc/pb/shop.pb.go | 38 ++-- .../logic/searchUserVerificationsLogic.go | 2 +- .../rpc/pb/user_verifications.pb.go | 14 +- .../getVerificationsLogic.go | 2 +- .../rpc/internal/logic/searchUsersLogic.go | 8 +- app/users/rpc/pb/users.pb.go | 44 ++-- .../logic/wallet/listTransactionsLogic.go | 2 +- .../logic/searchWalletTransactionsLogic.go | 2 +- app/wallet/rpc/pb/wallet.pb.go | 26 +-- desc/rpc/community.proto | 8 +- desc/rpc/game.proto | 2 +- desc/rpc/order.proto | 4 +- desc/rpc/player.proto | 4 +- desc/rpc/shop.proto | 6 +- desc/rpc/user_verifications.proto | 2 +- desc/rpc/users.proto | 6 +- desc/rpc/wallet.proto | 4 +- 46 files changed, 334 insertions(+), 346 deletions(-) diff --git a/app/community/api/internal/logic/community/createCommentLogic.go b/app/community/api/internal/logic/community/createCommentLogic.go index e0800af..2caf11f 100644 --- a/app/community/api/internal/logic/community/createCommentLogic.go +++ b/app/community/api/internal/logic/community/createCommentLogic.go @@ -43,7 +43,7 @@ func (l *CreateCommentLogic) CreateComment(req *types.CreateCommentReq) (resp *t return nil, err } comments, err := l.svcCtx.CommunityRpc.SearchComments(l.ctx, &communitypb.SearchCommentsReq{ - Page: 0, + Offset: 0, Limit: 1, PostId: req.PostId, AuthorId: uid, diff --git a/app/community/api/internal/logic/community/createPostLogic.go b/app/community/api/internal/logic/community/createPostLogic.go index 49b5773..b6db6ce 100644 --- a/app/community/api/internal/logic/community/createPostLogic.go +++ b/app/community/api/internal/logic/community/createPostLogic.go @@ -52,7 +52,7 @@ func (l *CreatePostLogic) CreatePost(req *types.CreatePostReq) (resp *types.Post return nil, err } posts, err := l.svcCtx.CommunityRpc.SearchPosts(l.ctx, &communitypb.SearchPostsReq{ - Page: 0, + Offset: 0, Limit: 1, AuthorId: &uid, }) diff --git a/app/community/api/internal/logic/community/getPostLogic.go b/app/community/api/internal/logic/community/getPostLogic.go index f389ffb..30b59c9 100644 --- a/app/community/api/internal/logic/community/getPostLogic.go +++ b/app/community/api/internal/logic/community/getPostLogic.go @@ -36,7 +36,7 @@ func (l *GetPostLogic) GetPost(req *types.PathId) (resp *types.Post, err error) uid := currentUserIDOrZero(l.ctx) liked := false if uid > 0 { - likes, e := l.svcCtx.CommunityRpc.SearchPostLikes(l.ctx, &communitypb.SearchPostLikesReq{Page: 0, Limit: 1, PostId: &req.Id, UserId: &uid}) + likes, e := l.svcCtx.CommunityRpc.SearchPostLikes(l.ctx, &communitypb.SearchPostLikesReq{Offset: 0, Limit: 1, PostId: &req.Id, UserId: &uid}) liked = e == nil && len(likes.GetPostLikes()) > 0 } post := mapPost(l.ctx, l.svcCtx, out.GetPosts(), liked) diff --git a/app/community/api/internal/logic/community/listCommentsLogic.go b/app/community/api/internal/logic/community/listCommentsLogic.go index fcf02ab..b78d2af 100644 --- a/app/community/api/internal/logic/community/listCommentsLogic.go +++ b/app/community/api/internal/logic/community/listCommentsLogic.go @@ -33,7 +33,7 @@ func (l *ListCommentsLogic) ListComments(req *types.ListCommentsReq) (resp *type req.Limit = 20 } out, err := l.svcCtx.CommunityRpc.SearchComments(l.ctx, &communitypb.SearchCommentsReq{ - Page: req.Offset, + Offset: req.Offset, Limit: req.Limit, PostId: req.Id, }) @@ -45,7 +45,7 @@ func (l *ListCommentsLogic) ListComments(req *types.ListCommentsReq) (resp *type for _, c := range out.GetComments() { liked := false if uid > 0 { - likes, e := l.svcCtx.CommunityRpc.SearchCommentLikes(l.ctx, &communitypb.SearchCommentLikesReq{Page: 0, Limit: 1, CommentId: c.Id, UserId: uid}) + likes, e := l.svcCtx.CommunityRpc.SearchCommentLikes(l.ctx, &communitypb.SearchCommentLikesReq{Offset: 0, Limit: 1, CommentId: c.Id, UserId: uid}) liked = e == nil && len(likes.GetCommentLikes()) > 0 } items = append(items, mapComment(l.ctx, l.svcCtx, c, liked)) diff --git a/app/community/api/internal/logic/community/listPostsLogic.go b/app/community/api/internal/logic/community/listPostsLogic.go index d3f46fc..a53e796 100644 --- a/app/community/api/internal/logic/community/listPostsLogic.go +++ b/app/community/api/internal/logic/community/listPostsLogic.go @@ -33,7 +33,7 @@ func (l *ListPostsLogic) ListPosts(req *types.PostListReq) (resp *types.PostList if req.Limit <= 0 { req.Limit = 20 } - in := &communitypb.SearchPostsReq{Page: req.Offset, Limit: req.Limit} + in := &communitypb.SearchPostsReq{Offset: req.Offset, Limit: req.Limit} if req.Tags != "" { in.Tags = strings.Split(req.Tags, ",") } @@ -46,7 +46,7 @@ func (l *ListPostsLogic) ListPosts(req *types.PostListReq) (resp *types.PostList for _, p := range posts.GetPosts() { liked := false if uid > 0 { - likes, e := l.svcCtx.CommunityRpc.SearchPostLikes(l.ctx, &communitypb.SearchPostLikesReq{Page: 0, Limit: 1, PostId: &p.Id, UserId: &uid}) + likes, e := l.svcCtx.CommunityRpc.SearchPostLikes(l.ctx, &communitypb.SearchPostLikesReq{Offset: 0, Limit: 1, PostId: &p.Id, UserId: &uid}) liked = e == nil && len(likes.GetPostLikes()) > 0 } items = append(items, mapPost(l.ctx, l.svcCtx, p, liked)) diff --git a/app/community/api/internal/logic/community/listUserPostsLogic.go b/app/community/api/internal/logic/community/listUserPostsLogic.go index 5b2ec8b..0f55f5c 100644 --- a/app/community/api/internal/logic/community/listUserPostsLogic.go +++ b/app/community/api/internal/logic/community/listUserPostsLogic.go @@ -33,7 +33,7 @@ func (l *ListUserPostsLogic) ListUserPosts(req *types.ListCommentsReq) (resp *ty req.Limit = 20 } authorID := req.Id - out, err := l.svcCtx.CommunityRpc.SearchPosts(l.ctx, &communitypb.SearchPostsReq{Page: req.Offset, Limit: req.Limit, AuthorId: &authorID}) + out, err := l.svcCtx.CommunityRpc.SearchPosts(l.ctx, &communitypb.SearchPostsReq{Offset: req.Offset, Limit: req.Limit, AuthorId: &authorID}) if err != nil { return nil, err } @@ -42,7 +42,7 @@ func (l *ListUserPostsLogic) ListUserPosts(req *types.ListCommentsReq) (resp *ty for _, p := range out.GetPosts() { liked := false if uid > 0 { - likes, e := l.svcCtx.CommunityRpc.SearchPostLikes(l.ctx, &communitypb.SearchPostLikesReq{Page: 0, Limit: 1, PostId: &p.Id, UserId: &uid}) + likes, e := l.svcCtx.CommunityRpc.SearchPostLikes(l.ctx, &communitypb.SearchPostLikesReq{Offset: 0, Limit: 1, PostId: &p.Id, UserId: &uid}) liked = e == nil && len(likes.GetPostLikes()) > 0 } items = append(items, mapPost(l.ctx, l.svcCtx, p, liked)) diff --git a/app/community/rpc/internal/logic/searchCommentLikesLogic.go b/app/community/rpc/internal/logic/searchCommentLikesLogic.go index 8db9429..4172093 100644 --- a/app/community/rpc/internal/logic/searchCommentLikesLogic.go +++ b/app/community/rpc/internal/logic/searchCommentLikesLogic.go @@ -28,7 +28,7 @@ func (l *SearchCommentLikesLogic) SearchCommentLikes(in *pb.SearchCommentLikesRe if limit <= 0 { limit = 20 } - offset := in.GetPage() + offset := in.GetOffset() if offset < 0 { offset = 0 } diff --git a/app/community/rpc/internal/logic/searchCommentsLogic.go b/app/community/rpc/internal/logic/searchCommentsLogic.go index a65a2c9..1e8cbab 100644 --- a/app/community/rpc/internal/logic/searchCommentsLogic.go +++ b/app/community/rpc/internal/logic/searchCommentsLogic.go @@ -29,7 +29,7 @@ func (l *SearchCommentsLogic) SearchComments(in *pb.SearchCommentsReq) (*pb.Sear if limit <= 0 { limit = 20 } - offset := in.GetPage() + offset := in.GetOffset() if offset < 0 { offset = 0 } diff --git a/app/community/rpc/internal/logic/searchPostLikesLogic.go b/app/community/rpc/internal/logic/searchPostLikesLogic.go index 00fc239..9a8d228 100644 --- a/app/community/rpc/internal/logic/searchPostLikesLogic.go +++ b/app/community/rpc/internal/logic/searchPostLikesLogic.go @@ -28,7 +28,7 @@ func (l *SearchPostLikesLogic) SearchPostLikes(in *pb.SearchPostLikesReq) (*pb.S if limit <= 0 { limit = 20 } - offset := in.GetPage() + offset := in.GetOffset() if offset < 0 { offset = 0 } diff --git a/app/community/rpc/internal/logic/searchPostsLogic.go b/app/community/rpc/internal/logic/searchPostsLogic.go index 56f69aa..908803c 100644 --- a/app/community/rpc/internal/logic/searchPostsLogic.go +++ b/app/community/rpc/internal/logic/searchPostsLogic.go @@ -29,7 +29,7 @@ func (l *SearchPostsLogic) SearchPosts(in *pb.SearchPostsReq) (*pb.SearchPostsRe if limit <= 0 { limit = 20 } - offset := in.GetPage() + offset := in.GetOffset() if offset < 0 { offset = 0 } diff --git a/app/community/rpc/pb/community.pb.go b/app/community/rpc/pb/community.pb.go index 0f3fb88..2ca0bff 100644 --- a/app/community/rpc/pb/community.pb.go +++ b/app/community/rpc/pb/community.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.36.11 -// protoc v5.29.6 +// protoc v7.34.1 // source: community.proto package pb @@ -452,7 +452,7 @@ func (x *GetCommentLikesByIdResp) GetCommentLikes() *CommentLikes { type SearchCommentLikesReq struct { state protoimpl.MessageState `protogen:"open.v1"` - Page int64 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"` //page + Offset int64 `protobuf:"varint,1,opt,name=offset,proto3" json:"offset,omitempty"` //offset Limit int64 `protobuf:"varint,2,opt,name=limit,proto3" json:"limit,omitempty"` //limit CommentId int64 `protobuf:"varint,3,opt,name=commentId,proto3" json:"commentId,omitempty"` //commentId UserId int64 `protobuf:"varint,4,opt,name=userId,proto3" json:"userId,omitempty"` //userId @@ -491,9 +491,9 @@ func (*SearchCommentLikesReq) Descriptor() ([]byte, []int) { return file_community_proto_rawDescGZIP(), []int{9} } -func (x *SearchCommentLikesReq) GetPage() int64 { +func (x *SearchCommentLikesReq) GetOffset() int64 { if x != nil { - return x.Page + return x.Offset } return 0 } @@ -1081,7 +1081,7 @@ func (x *GetCommentsByIdResp) GetComments() *Comments { type SearchCommentsReq struct { state protoimpl.MessageState `protogen:"open.v1"` - Page int64 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"` //page + Offset int64 `protobuf:"varint,1,opt,name=offset,proto3" json:"offset,omitempty"` //offset Limit int64 `protobuf:"varint,2,opt,name=limit,proto3" json:"limit,omitempty"` //limit Id int64 `protobuf:"varint,3,opt,name=id,proto3" json:"id,omitempty"` //id PostId int64 `protobuf:"varint,4,opt,name=postId,proto3" json:"postId,omitempty"` //postId @@ -1124,9 +1124,9 @@ func (*SearchCommentsReq) Descriptor() ([]byte, []int) { return file_community_proto_rawDescGZIP(), []int{20} } -func (x *SearchCommentsReq) GetPage() int64 { +func (x *SearchCommentsReq) GetOffset() int64 { if x != nil { - return x.Page + return x.Offset } return 0 } @@ -1662,7 +1662,7 @@ func (x *GetPostLikesByIdResp) GetPostLikes() *PostLikes { type SearchPostLikesReq struct { state protoimpl.MessageState `protogen:"open.v1"` - Page int64 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"` //page + Offset int64 `protobuf:"varint,1,opt,name=offset,proto3" json:"offset,omitempty"` //offset Limit int64 `protobuf:"varint,2,opt,name=limit,proto3" json:"limit,omitempty"` //limit PostId *int64 `protobuf:"varint,3,opt,name=postId,proto3,oneof" json:"postId,omitempty"` //postId UserId *int64 `protobuf:"varint,4,opt,name=userId,proto3,oneof" json:"userId,omitempty"` //userId @@ -1701,9 +1701,9 @@ func (*SearchPostLikesReq) Descriptor() ([]byte, []int) { return file_community_proto_rawDescGZIP(), []int{31} } -func (x *SearchPostLikesReq) GetPage() int64 { +func (x *SearchPostLikesReq) GetOffset() int64 { if x != nil { - return x.Page + return x.Offset } return 0 } @@ -2507,7 +2507,7 @@ func (x *GetPostsByIdResp) GetPosts() *Posts { type SearchPostsReq struct { state protoimpl.MessageState `protogen:"open.v1"` - Page int64 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"` //page + Offset int64 `protobuf:"varint,1,opt,name=offset,proto3" json:"offset,omitempty"` //offset Limit int64 `protobuf:"varint,2,opt,name=limit,proto3" json:"limit,omitempty"` //limit Id int64 `protobuf:"varint,3,opt,name=id,proto3" json:"id,omitempty"` //id AuthorId *int64 `protobuf:"varint,4,opt,name=authorId,proto3,oneof" json:"authorId,omitempty"` //authorId @@ -2559,9 +2559,9 @@ func (*SearchPostsReq) Descriptor() ([]byte, []int) { return file_community_proto_rawDescGZIP(), []int{42} } -func (x *SearchPostsReq) GetPage() int64 { +func (x *SearchPostsReq) GetOffset() int64 { if x != nil { - return x.Page + return x.Offset } return 0 } @@ -2756,9 +2756,9 @@ const file_community_proto_rawDesc = "" + "\x16GetCommentLikesByIdReq\x12\x0e\n" + "\x02id\x18\x01 \x01(\x03R\x02id\"O\n" + "\x17GetCommentLikesByIdResp\x124\n" + - "\fcommentLikes\x18\x01 \x01(\v2\x10.pb.CommentLikesR\fcommentLikes\"\x95\x01\n" + - "\x15SearchCommentLikesReq\x12\x12\n" + - "\x04page\x18\x01 \x01(\x03R\x04page\x12\x14\n" + + "\fcommentLikes\x18\x01 \x01(\v2\x10.pb.CommentLikesR\fcommentLikes\"\x99\x01\n" + + "\x15SearchCommentLikesReq\x12\x16\n" + + "\x06offset\x18\x01 \x01(\x03R\x06offset\x12\x14\n" + "\x05limit\x18\x02 \x01(\x03R\x05limit\x12\x1c\n" + "\tcommentId\x18\x03 \x01(\x03R\tcommentId\x12\x16\n" + "\x06userId\x18\x04 \x01(\x03R\x06userId\x12\x1c\n" + @@ -2796,9 +2796,9 @@ const file_community_proto_rawDesc = "" + "\x12GetCommentsByIdReq\x12\x0e\n" + "\x02id\x18\x01 \x01(\x03R\x02id\"?\n" + "\x13GetCommentsByIdResp\x12(\n" + - "\bcomments\x18\x01 \x01(\v2\f.pb.CommentsR\bcomments\"\x99\x02\n" + - "\x11SearchCommentsReq\x12\x12\n" + - "\x04page\x18\x01 \x01(\x03R\x04page\x12\x14\n" + + "\bcomments\x18\x01 \x01(\v2\f.pb.CommentsR\bcomments\"\x9d\x02\n" + + "\x11SearchCommentsReq\x12\x16\n" + + "\x06offset\x18\x01 \x01(\x03R\x06offset\x12\x14\n" + "\x05limit\x18\x02 \x01(\x03R\x05limit\x12\x0e\n" + "\x02id\x18\x03 \x01(\x03R\x02id\x12\x16\n" + "\x06postId\x18\x04 \x01(\x03R\x06postId\x12\x1a\n" + @@ -2837,9 +2837,9 @@ const file_community_proto_rawDesc = "" + "\x13GetPostLikesByIdReq\x12\x0e\n" + "\x02id\x18\x01 \x01(\x03R\x02id\"C\n" + "\x14GetPostLikesByIdResp\x12+\n" + - "\tpostLikes\x18\x01 \x01(\v2\r.pb.PostLikesR\tpostLikes\"\xac\x01\n" + - "\x12SearchPostLikesReq\x12\x12\n" + - "\x04page\x18\x01 \x01(\x03R\x04page\x12\x14\n" + + "\tpostLikes\x18\x01 \x01(\v2\r.pb.PostLikesR\tpostLikes\"\xb0\x01\n" + + "\x12SearchPostLikesReq\x12\x16\n" + + "\x06offset\x18\x01 \x01(\x03R\x06offset\x12\x14\n" + "\x05limit\x18\x02 \x01(\x03R\x05limit\x12\x1b\n" + "\x06postId\x18\x03 \x01(\x03H\x00R\x06postId\x88\x01\x01\x12\x1b\n" + "\x06userId\x18\x04 \x01(\x03H\x01R\x06userId\x88\x01\x01\x12\x1c\n" + @@ -2940,9 +2940,9 @@ const file_community_proto_rawDesc = "" + "\x0fGetPostsByIdReq\x12\x0e\n" + "\x02id\x18\x01 \x01(\x03R\x02id\"3\n" + "\x10GetPostsByIdResp\x12\x1f\n" + - "\x05posts\x18\x01 \x01(\v2\t.pb.PostsR\x05posts\"\xf9\x05\n" + - "\x0eSearchPostsReq\x12\x12\n" + - "\x04page\x18\x01 \x01(\x03R\x04page\x12\x14\n" + + "\x05posts\x18\x01 \x01(\v2\t.pb.PostsR\x05posts\"\xfd\x05\n" + + "\x0eSearchPostsReq\x12\x16\n" + + "\x06offset\x18\x01 \x01(\x03R\x06offset\x12\x14\n" + "\x05limit\x18\x02 \x01(\x03R\x05limit\x12\x0e\n" + "\x02id\x18\x03 \x01(\x03R\x02id\x12\x1f\n" + "\bauthorId\x18\x04 \x01(\x03H\x00R\bauthorId\x88\x01\x01\x12#\n" + diff --git a/app/game/api/internal/logic/game/listGamesLogic.go b/app/game/api/internal/logic/game/listGamesLogic.go index b28204d..cb76ad9 100644 --- a/app/game/api/internal/logic/game/listGamesLogic.go +++ b/app/game/api/internal/logic/game/listGamesLogic.go @@ -29,14 +29,13 @@ func NewListGamesLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListGam } func (l *ListGamesLogic) ListGames(req *types.PageReq) (resp *types.GameListResp, err error) { - page := req.Offset - if req.Limit > 0 { - page = req.Offset/req.Limit + 1 + if req.Limit <= 0 { + req.Limit = 20 } all, err := l.svcCtx.GameRpc.SearchGames(l.ctx, &pb.SearchGamesReq{ - Page: page, - Limit: req.Limit, + Offset: req.Offset, + Limit: req.Limit, }) if err != nil { logx.Errorf("ListGames err:%v", err) @@ -56,8 +55,8 @@ func (l *ListGamesLogic) ListGames(req *types.PageReq) (resp *types.GameListResp Items: list, Meta: types.PageMeta{ Total: 0, - Offset: req.Offset + 1, - Limit: 20, + Offset: req.Offset, + Limit: req.Limit, }, }, nil diff --git a/app/game/rpc/internal/logic/searchGamesLogic.go b/app/game/rpc/internal/logic/searchGamesLogic.go index 766bb27..59c6299 100644 --- a/app/game/rpc/internal/logic/searchGamesLogic.go +++ b/app/game/rpc/internal/logic/searchGamesLogic.go @@ -27,10 +27,10 @@ func NewSearchGamesLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Searc func (l *SearchGamesLogic) SearchGames(in *pb.SearchGamesReq) (*pb.SearchGamesResp, error) { notFoundErr := entcache.ErrNotFound - if in.Page <= 0 || in.Limit <= 0 || in.Page > 1000 || in.Limit > 100 { + if in.Offset < 0 || in.Limit <= 0 || in.Limit > 100 { return nil, errors.New("invalid pagination parameters") } - all, err := l.svcCtx.GameModelRO.Games.Query().Limit(int(in.Limit)).Offset(int(in.Limit * (in.Page - 1))).All(l.ctx) + all, err := l.svcCtx.GameModelRO.Games.Query().Limit(int(in.Limit)).Offset(int(in.Offset)).All(l.ctx) if err != nil && !errors.As(err, ¬FoundErr) { logx.Errorf("failed to query games: %v", err) return nil, errors.New("failed to query games") diff --git a/app/game/rpc/pb/game.pb.go b/app/game/rpc/pb/game.pb.go index c34a00b..adcd1df 100644 --- a/app/game/rpc/pb/game.pb.go +++ b/app/game/rpc/pb/game.pb.go @@ -2,7 +2,7 @@ // versions: // protoc-gen-go v1.36.11 // protoc v7.34.1 -// source: desc/rpc/game.proto +// source: game.proto package pb @@ -38,7 +38,7 @@ type Games struct { func (x *Games) Reset() { *x = Games{} - mi := &file_desc_rpc_game_proto_msgTypes[0] + mi := &file_game_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -50,7 +50,7 @@ func (x *Games) String() string { func (*Games) ProtoMessage() {} func (x *Games) ProtoReflect() protoreflect.Message { - mi := &file_desc_rpc_game_proto_msgTypes[0] + mi := &file_game_proto_msgTypes[0] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -63,7 +63,7 @@ func (x *Games) ProtoReflect() protoreflect.Message { // Deprecated: Use Games.ProtoReflect.Descriptor instead. func (*Games) Descriptor() ([]byte, []int) { - return file_desc_rpc_game_proto_rawDescGZIP(), []int{0} + return file_game_proto_rawDescGZIP(), []int{0} } func (x *Games) GetId() int64 { @@ -137,7 +137,7 @@ type AddGamesReq struct { func (x *AddGamesReq) Reset() { *x = AddGamesReq{} - mi := &file_desc_rpc_game_proto_msgTypes[1] + mi := &file_game_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -149,7 +149,7 @@ func (x *AddGamesReq) String() string { func (*AddGamesReq) ProtoMessage() {} func (x *AddGamesReq) ProtoReflect() protoreflect.Message { - mi := &file_desc_rpc_game_proto_msgTypes[1] + mi := &file_game_proto_msgTypes[1] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -162,7 +162,7 @@ func (x *AddGamesReq) ProtoReflect() protoreflect.Message { // Deprecated: Use AddGamesReq.ProtoReflect.Descriptor instead. func (*AddGamesReq) Descriptor() ([]byte, []int) { - return file_desc_rpc_game_proto_rawDescGZIP(), []int{1} + return file_game_proto_rawDescGZIP(), []int{1} } func (x *AddGamesReq) GetName() string { @@ -223,7 +223,7 @@ type AddGamesResp struct { func (x *AddGamesResp) Reset() { *x = AddGamesResp{} - mi := &file_desc_rpc_game_proto_msgTypes[2] + mi := &file_game_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -235,7 +235,7 @@ func (x *AddGamesResp) String() string { func (*AddGamesResp) ProtoMessage() {} func (x *AddGamesResp) ProtoReflect() protoreflect.Message { - mi := &file_desc_rpc_game_proto_msgTypes[2] + mi := &file_game_proto_msgTypes[2] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -248,7 +248,7 @@ func (x *AddGamesResp) ProtoReflect() protoreflect.Message { // Deprecated: Use AddGamesResp.ProtoReflect.Descriptor instead. func (*AddGamesResp) Descriptor() ([]byte, []int) { - return file_desc_rpc_game_proto_rawDescGZIP(), []int{2} + return file_game_proto_rawDescGZIP(), []int{2} } func (x *AddGamesResp) GetGames() *Games { @@ -274,7 +274,7 @@ type UpdateGamesReq struct { func (x *UpdateGamesReq) Reset() { *x = UpdateGamesReq{} - mi := &file_desc_rpc_game_proto_msgTypes[3] + mi := &file_game_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -286,7 +286,7 @@ func (x *UpdateGamesReq) String() string { func (*UpdateGamesReq) ProtoMessage() {} func (x *UpdateGamesReq) ProtoReflect() protoreflect.Message { - mi := &file_desc_rpc_game_proto_msgTypes[3] + mi := &file_game_proto_msgTypes[3] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -299,7 +299,7 @@ func (x *UpdateGamesReq) ProtoReflect() protoreflect.Message { // Deprecated: Use UpdateGamesReq.ProtoReflect.Descriptor instead. func (*UpdateGamesReq) Descriptor() ([]byte, []int) { - return file_desc_rpc_game_proto_rawDescGZIP(), []int{3} + return file_game_proto_rawDescGZIP(), []int{3} } func (x *UpdateGamesReq) GetId() int64 { @@ -366,7 +366,7 @@ type UpdateGamesResp struct { func (x *UpdateGamesResp) Reset() { *x = UpdateGamesResp{} - mi := &file_desc_rpc_game_proto_msgTypes[4] + mi := &file_game_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -378,7 +378,7 @@ func (x *UpdateGamesResp) String() string { func (*UpdateGamesResp) ProtoMessage() {} func (x *UpdateGamesResp) ProtoReflect() protoreflect.Message { - mi := &file_desc_rpc_game_proto_msgTypes[4] + mi := &file_game_proto_msgTypes[4] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -391,7 +391,7 @@ func (x *UpdateGamesResp) ProtoReflect() protoreflect.Message { // Deprecated: Use UpdateGamesResp.ProtoReflect.Descriptor instead. func (*UpdateGamesResp) Descriptor() ([]byte, []int) { - return file_desc_rpc_game_proto_rawDescGZIP(), []int{4} + return file_game_proto_rawDescGZIP(), []int{4} } type DelGamesReq struct { @@ -403,7 +403,7 @@ type DelGamesReq struct { func (x *DelGamesReq) Reset() { *x = DelGamesReq{} - mi := &file_desc_rpc_game_proto_msgTypes[5] + mi := &file_game_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -415,7 +415,7 @@ func (x *DelGamesReq) String() string { func (*DelGamesReq) ProtoMessage() {} func (x *DelGamesReq) ProtoReflect() protoreflect.Message { - mi := &file_desc_rpc_game_proto_msgTypes[5] + mi := &file_game_proto_msgTypes[5] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -428,7 +428,7 @@ func (x *DelGamesReq) ProtoReflect() protoreflect.Message { // Deprecated: Use DelGamesReq.ProtoReflect.Descriptor instead. func (*DelGamesReq) Descriptor() ([]byte, []int) { - return file_desc_rpc_game_proto_rawDescGZIP(), []int{5} + return file_game_proto_rawDescGZIP(), []int{5} } func (x *DelGamesReq) GetId() int64 { @@ -446,7 +446,7 @@ type DelGamesResp struct { func (x *DelGamesResp) Reset() { *x = DelGamesResp{} - mi := &file_desc_rpc_game_proto_msgTypes[6] + mi := &file_game_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -458,7 +458,7 @@ func (x *DelGamesResp) String() string { func (*DelGamesResp) ProtoMessage() {} func (x *DelGamesResp) ProtoReflect() protoreflect.Message { - mi := &file_desc_rpc_game_proto_msgTypes[6] + mi := &file_game_proto_msgTypes[6] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -471,7 +471,7 @@ func (x *DelGamesResp) ProtoReflect() protoreflect.Message { // Deprecated: Use DelGamesResp.ProtoReflect.Descriptor instead. func (*DelGamesResp) Descriptor() ([]byte, []int) { - return file_desc_rpc_game_proto_rawDescGZIP(), []int{6} + return file_game_proto_rawDescGZIP(), []int{6} } type GetGamesByIdReq struct { @@ -483,7 +483,7 @@ type GetGamesByIdReq struct { func (x *GetGamesByIdReq) Reset() { *x = GetGamesByIdReq{} - mi := &file_desc_rpc_game_proto_msgTypes[7] + mi := &file_game_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -495,7 +495,7 @@ func (x *GetGamesByIdReq) String() string { func (*GetGamesByIdReq) ProtoMessage() {} func (x *GetGamesByIdReq) ProtoReflect() protoreflect.Message { - mi := &file_desc_rpc_game_proto_msgTypes[7] + mi := &file_game_proto_msgTypes[7] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -508,7 +508,7 @@ func (x *GetGamesByIdReq) ProtoReflect() protoreflect.Message { // Deprecated: Use GetGamesByIdReq.ProtoReflect.Descriptor instead. func (*GetGamesByIdReq) Descriptor() ([]byte, []int) { - return file_desc_rpc_game_proto_rawDescGZIP(), []int{7} + return file_game_proto_rawDescGZIP(), []int{7} } func (x *GetGamesByIdReq) GetId() int64 { @@ -527,7 +527,7 @@ type GetGamesByIdResp struct { func (x *GetGamesByIdResp) Reset() { *x = GetGamesByIdResp{} - mi := &file_desc_rpc_game_proto_msgTypes[8] + mi := &file_game_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -539,7 +539,7 @@ func (x *GetGamesByIdResp) String() string { func (*GetGamesByIdResp) ProtoMessage() {} func (x *GetGamesByIdResp) ProtoReflect() protoreflect.Message { - mi := &file_desc_rpc_game_proto_msgTypes[8] + mi := &file_game_proto_msgTypes[8] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -552,7 +552,7 @@ func (x *GetGamesByIdResp) ProtoReflect() protoreflect.Message { // Deprecated: Use GetGamesByIdResp.ProtoReflect.Descriptor instead. func (*GetGamesByIdResp) Descriptor() ([]byte, []int) { - return file_desc_rpc_game_proto_rawDescGZIP(), []int{8} + return file_game_proto_rawDescGZIP(), []int{8} } func (x *GetGamesByIdResp) GetGames() *Games { @@ -564,7 +564,7 @@ func (x *GetGamesByIdResp) GetGames() *Games { type SearchGamesReq struct { state protoimpl.MessageState `protogen:"open.v1"` - Page int64 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"` //page + Offset int64 `protobuf:"varint,1,opt,name=offset,proto3" json:"offset,omitempty"` //offset Limit int64 `protobuf:"varint,2,opt,name=limit,proto3" json:"limit,omitempty"` //limit Id int64 `protobuf:"varint,3,opt,name=id,proto3" json:"id,omitempty"` //id Name *string `protobuf:"bytes,4,opt,name=name,proto3,oneof" json:"name,omitempty"` //name @@ -580,7 +580,7 @@ type SearchGamesReq struct { func (x *SearchGamesReq) Reset() { *x = SearchGamesReq{} - mi := &file_desc_rpc_game_proto_msgTypes[9] + mi := &file_game_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -592,7 +592,7 @@ func (x *SearchGamesReq) String() string { func (*SearchGamesReq) ProtoMessage() {} func (x *SearchGamesReq) ProtoReflect() protoreflect.Message { - mi := &file_desc_rpc_game_proto_msgTypes[9] + mi := &file_game_proto_msgTypes[9] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -605,12 +605,12 @@ func (x *SearchGamesReq) ProtoReflect() protoreflect.Message { // Deprecated: Use SearchGamesReq.ProtoReflect.Descriptor instead. func (*SearchGamesReq) Descriptor() ([]byte, []int) { - return file_desc_rpc_game_proto_rawDescGZIP(), []int{9} + return file_game_proto_rawDescGZIP(), []int{9} } -func (x *SearchGamesReq) GetPage() int64 { +func (x *SearchGamesReq) GetOffset() int64 { if x != nil { - return x.Page + return x.Offset } return 0 } @@ -687,7 +687,7 @@ type SearchGamesResp struct { func (x *SearchGamesResp) Reset() { *x = SearchGamesResp{} - mi := &file_desc_rpc_game_proto_msgTypes[10] + mi := &file_game_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -699,7 +699,7 @@ func (x *SearchGamesResp) String() string { func (*SearchGamesResp) ProtoMessage() {} func (x *SearchGamesResp) ProtoReflect() protoreflect.Message { - mi := &file_desc_rpc_game_proto_msgTypes[10] + mi := &file_game_proto_msgTypes[10] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -712,7 +712,7 @@ func (x *SearchGamesResp) ProtoReflect() protoreflect.Message { // Deprecated: Use SearchGamesResp.ProtoReflect.Descriptor instead. func (*SearchGamesResp) Descriptor() ([]byte, []int) { - return file_desc_rpc_game_proto_rawDescGZIP(), []int{10} + return file_game_proto_rawDescGZIP(), []int{10} } func (x *SearchGamesResp) GetGames() []*Games { @@ -722,11 +722,12 @@ func (x *SearchGamesResp) GetGames() []*Games { return nil } -var File_desc_rpc_game_proto protoreflect.FileDescriptor +var File_game_proto protoreflect.FileDescriptor -const file_desc_rpc_game_proto_rawDesc = "" + +const file_game_proto_rawDesc = "" + "\n" + - "\x13desc/rpc/game.proto\x12\x02pb\"\xd1\x01\n" + + "\n" + + "game.proto\x12\x02pb\"\xd1\x01\n" + "\x05Games\x12\x0e\n" + "\x02id\x18\x01 \x01(\x03R\x02id\x12\x12\n" + "\x04name\x18\x02 \x01(\tR\x04name\x12\x12\n" + @@ -762,9 +763,9 @@ const file_desc_rpc_game_proto_rawDesc = "" + "\x0fGetGamesByIdReq\x12\x0e\n" + "\x02id\x18\x01 \x01(\x03R\x02id\"3\n" + "\x10GetGamesByIdResp\x12\x1f\n" + - "\x05games\x18\x01 \x01(\v2\t.pb.GamesR\x05games\"\xfd\x02\n" + - "\x0eSearchGamesReq\x12\x12\n" + - "\x04page\x18\x01 \x01(\x03R\x04page\x12\x14\n" + + "\x05games\x18\x01 \x01(\v2\t.pb.GamesR\x05games\"\x81\x03\n" + + "\x0eSearchGamesReq\x12\x16\n" + + "\x06offset\x18\x01 \x01(\x03R\x06offset\x12\x14\n" + "\x05limit\x18\x02 \x01(\x03R\x05limit\x12\x0e\n" + "\x02id\x18\x03 \x01(\x03R\x02id\x12\x17\n" + "\x04name\x18\x04 \x01(\tH\x00R\x04name\x88\x01\x01\x12\x17\n" + @@ -795,19 +796,19 @@ const file_desc_rpc_game_proto_rawDesc = "" + "\vSearchGames\x12\x12.pb.SearchGamesReq\x1a\x13.pb.SearchGamesRespB\x06Z\x04./pbb\x06proto3" var ( - file_desc_rpc_game_proto_rawDescOnce sync.Once - file_desc_rpc_game_proto_rawDescData []byte + file_game_proto_rawDescOnce sync.Once + file_game_proto_rawDescData []byte ) -func file_desc_rpc_game_proto_rawDescGZIP() []byte { - file_desc_rpc_game_proto_rawDescOnce.Do(func() { - file_desc_rpc_game_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_desc_rpc_game_proto_rawDesc), len(file_desc_rpc_game_proto_rawDesc))) +func file_game_proto_rawDescGZIP() []byte { + file_game_proto_rawDescOnce.Do(func() { + file_game_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_game_proto_rawDesc), len(file_game_proto_rawDesc))) }) - return file_desc_rpc_game_proto_rawDescData + return file_game_proto_rawDescData } -var file_desc_rpc_game_proto_msgTypes = make([]protoimpl.MessageInfo, 11) -var file_desc_rpc_game_proto_goTypes = []any{ +var file_game_proto_msgTypes = make([]protoimpl.MessageInfo, 11) +var file_game_proto_goTypes = []any{ (*Games)(nil), // 0: pb.Games (*AddGamesReq)(nil), // 1: pb.AddGamesReq (*AddGamesResp)(nil), // 2: pb.AddGamesResp @@ -820,7 +821,7 @@ var file_desc_rpc_game_proto_goTypes = []any{ (*SearchGamesReq)(nil), // 9: pb.SearchGamesReq (*SearchGamesResp)(nil), // 10: pb.SearchGamesResp } -var file_desc_rpc_game_proto_depIdxs = []int32{ +var file_game_proto_depIdxs = []int32{ 0, // 0: pb.AddGamesResp.games:type_name -> pb.Games 0, // 1: pb.GetGamesByIdResp.games:type_name -> pb.Games 0, // 2: pb.SearchGamesResp.games:type_name -> pb.Games @@ -841,27 +842,27 @@ var file_desc_rpc_game_proto_depIdxs = []int32{ 0, // [0:3] is the sub-list for field type_name } -func init() { file_desc_rpc_game_proto_init() } -func file_desc_rpc_game_proto_init() { - if File_desc_rpc_game_proto != nil { +func init() { file_game_proto_init() } +func file_game_proto_init() { + if File_game_proto != nil { return } - file_desc_rpc_game_proto_msgTypes[9].OneofWrappers = []any{} + file_game_proto_msgTypes[9].OneofWrappers = []any{} type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: unsafe.Slice(unsafe.StringData(file_desc_rpc_game_proto_rawDesc), len(file_desc_rpc_game_proto_rawDesc)), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_game_proto_rawDesc), len(file_game_proto_rawDesc)), NumEnums: 0, NumMessages: 11, NumExtensions: 0, NumServices: 1, }, - GoTypes: file_desc_rpc_game_proto_goTypes, - DependencyIndexes: file_desc_rpc_game_proto_depIdxs, - MessageInfos: file_desc_rpc_game_proto_msgTypes, + GoTypes: file_game_proto_goTypes, + DependencyIndexes: file_game_proto_depIdxs, + MessageInfos: file_game_proto_msgTypes, }.Build() - File_desc_rpc_game_proto = out.File - file_desc_rpc_game_proto_goTypes = nil - file_desc_rpc_game_proto_depIdxs = nil + File_game_proto = out.File + file_game_proto_goTypes = nil + file_game_proto_depIdxs = nil } diff --git a/app/order/api/internal/logic/order/listOrdersLogic.go b/app/order/api/internal/logic/order/listOrdersLogic.go index df40d62..3679b39 100644 --- a/app/order/api/internal/logic/order/listOrdersLogic.go +++ b/app/order/api/internal/logic/order/listOrdersLogic.go @@ -37,8 +37,8 @@ func NewListOrdersLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListOr func (l *ListOrdersLogic) ListOrders(req *types.OrderListReq) (resp *types.OrderListResp, err error) { searchReq := &orderservice.SearchOrdersReq{ - Page: req.Offset, - Limit: req.Limit, + Offset: req.Offset, + Limit: req.Limit, } if req.Status != "" { searchReq.Status = &req.Status @@ -84,7 +84,7 @@ func (l *ListOrdersLogic) ListOrders(req *types.OrderListReq) (resp *types.Order searchReq.PlayerId = &player.Id case "owner": shops, shopErr := l.svcCtx.ShopRpc.SearchShops(l.ctx, &shopservice.SearchShopsReq{ - Page: 0, + Offset: 0, Limit: 100, OwnerId: uid, }) @@ -96,7 +96,7 @@ func (l *ListOrdersLogic) ListOrders(req *types.OrderListReq) (resp *types.Order for _, shop := range shops.GetShops() { shopID := shop.GetId() q := &orderservice.SearchOrdersReq{ - Page: req.Offset, + Offset: req.Offset, Limit: req.Limit, ShopId: &shopID, } diff --git a/app/order/rpc/internal/logic/searchOrderStateLogsLogic.go b/app/order/rpc/internal/logic/searchOrderStateLogsLogic.go index 8e38480..5184285 100644 --- a/app/order/rpc/internal/logic/searchOrderStateLogsLogic.go +++ b/app/order/rpc/internal/logic/searchOrderStateLogsLogic.go @@ -66,7 +66,7 @@ func (l *SearchOrderStateLogsLogic) SearchOrderStateLogs(in *pb.SearchOrderState query = query.Where(orderstatelogs.And(preds...)) } - items, err := query.Offset(int(in.Page * in.Limit)).Limit(int(in.Limit)).All(l.ctx) + items, err := query.Offset(int(in.Offset)).Limit(int(in.Limit)).All(l.ctx) if err != nil { return nil, err } diff --git a/app/order/rpc/internal/logic/searchOrdersLogic.go b/app/order/rpc/internal/logic/searchOrdersLogic.go index beb44a1..50dc5c1 100644 --- a/app/order/rpc/internal/logic/searchOrdersLogic.go +++ b/app/order/rpc/internal/logic/searchOrdersLogic.go @@ -94,7 +94,7 @@ func (l *SearchOrdersLogic) SearchOrders(in *pb.SearchOrdersReq) (*pb.SearchOrde query = query.Where(orders.And(preds...)) } - items, err := query.Offset(int(in.Page * in.Limit)).Limit(int(in.Limit)).All(l.ctx) + items, err := query.Offset(int(in.Offset)).Limit(int(in.Limit)).All(l.ctx) if err != nil { return nil, err } diff --git a/app/order/rpc/pb/order.pb.go b/app/order/rpc/pb/order.pb.go index 75e150f..9e29940 100644 --- a/app/order/rpc/pb/order.pb.go +++ b/app/order/rpc/pb/order.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.36.11 -// protoc v6.33.5 +// protoc v7.34.1 // source: order.proto package pb @@ -788,7 +788,7 @@ func (x *GetOrdersByIdResp) GetOrders() *Orders { type SearchOrdersReq struct { state protoimpl.MessageState `protogen:"open.v1"` - Page int64 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"` //page + Offset int64 `protobuf:"varint,1,opt,name=offset,proto3" json:"offset,omitempty"` //offset Limit int64 `protobuf:"varint,2,opt,name=limit,proto3" json:"limit,omitempty"` //limit Id *int64 `protobuf:"varint,3,opt,name=id,proto3,oneof" json:"id,omitempty"` //id ConsumerId *int64 `protobuf:"varint,4,opt,name=consumerId,proto3,oneof" json:"consumerId,omitempty"` //consumerId @@ -841,9 +841,9 @@ func (*SearchOrdersReq) Descriptor() ([]byte, []int) { return file_order_proto_rawDescGZIP(), []int{9} } -func (x *SearchOrdersReq) GetPage() int64 { +func (x *SearchOrdersReq) GetOffset() int64 { if x != nil { - return x.Page + return x.Offset } return 0 } @@ -1585,7 +1585,7 @@ func (x *GetOrderStateLogsByIdResp) GetOrderStateLogs() *OrderStateLogs { type SearchOrderStateLogsReq struct { state protoimpl.MessageState `protogen:"open.v1"` - Page int64 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"` //page + Offset int64 `protobuf:"varint,1,opt,name=offset,proto3" json:"offset,omitempty"` //offset Limit int64 `protobuf:"varint,2,opt,name=limit,proto3" json:"limit,omitempty"` //limit Id *int64 `protobuf:"varint,3,opt,name=id,proto3,oneof" json:"id,omitempty"` //id OrderId *int64 `protobuf:"varint,4,opt,name=orderId,proto3,oneof" json:"orderId,omitempty"` //orderId @@ -1630,9 +1630,9 @@ func (*SearchOrderStateLogsReq) Descriptor() ([]byte, []int) { return file_order_proto_rawDescGZIP(), []int{20} } -func (x *SearchOrderStateLogsReq) GetPage() int64 { +func (x *SearchOrderStateLogsReq) GetOffset() int64 { if x != nil { - return x.Page + return x.Offset } return 0 } @@ -1890,9 +1890,9 @@ const file_order_proto_rawDesc = "" + "\x02id\x18\x01 \x01(\x03R\x02id\"7\n" + "\x11GetOrdersByIdResp\x12\"\n" + "\x06orders\x18\x01 \x01(\v2\n" + - ".pb.OrdersR\x06orders\"\xed\x06\n" + - "\x0fSearchOrdersReq\x12\x12\n" + - "\x04page\x18\x01 \x01(\x03R\x04page\x12\x14\n" + + ".pb.OrdersR\x06orders\"\xf1\x06\n" + + "\x0fSearchOrdersReq\x12\x16\n" + + "\x06offset\x18\x01 \x01(\x03R\x06offset\x12\x14\n" + "\x05limit\x18\x02 \x01(\x03R\x05limit\x12\x13\n" + "\x02id\x18\x03 \x01(\x03H\x00R\x02id\x88\x01\x01\x12#\n" + "\n" + @@ -2006,9 +2006,9 @@ const file_order_proto_rawDesc = "" + "\x18GetOrderStateLogsByIdReq\x12\x0e\n" + "\x02id\x18\x01 \x01(\x03R\x02id\"W\n" + "\x19GetOrderStateLogsByIdResp\x12:\n" + - "\x0eorderStateLogs\x18\x01 \x01(\v2\x12.pb.OrderStateLogsR\x0eorderStateLogs\"\xcf\x03\n" + - "\x17SearchOrderStateLogsReq\x12\x12\n" + - "\x04page\x18\x01 \x01(\x03R\x04page\x12\x14\n" + + "\x0eorderStateLogs\x18\x01 \x01(\v2\x12.pb.OrderStateLogsR\x0eorderStateLogs\"\xd3\x03\n" + + "\x17SearchOrderStateLogsReq\x12\x16\n" + + "\x06offset\x18\x01 \x01(\x03R\x06offset\x12\x14\n" + "\x05limit\x18\x02 \x01(\x03R\x05limit\x12\x13\n" + "\x02id\x18\x03 \x01(\x03H\x00R\x02id\x88\x01\x01\x12\x1d\n" + "\aorderId\x18\x04 \x01(\x03H\x01R\aorderId\x88\x01\x01\x12#\n" + diff --git a/app/player/api/internal/logic/player/listPlayerServicesLogic.go b/app/player/api/internal/logic/player/listPlayerServicesLogic.go index 3149304..aee11d5 100644 --- a/app/player/api/internal/logic/player/listPlayerServicesLogic.go +++ b/app/player/api/internal/logic/player/listPlayerServicesLogic.go @@ -31,12 +31,8 @@ func NewListPlayerServicesLogic(ctx context.Context, svcCtx *svc.ServiceContext) func (l *ListPlayerServicesLogic) ListPlayerServices(req *types.ListPlayerServicesReq) (resp *types.PlayerServiceListResp, err error) { resp = &types.PlayerServiceListResp{} - page := int64(0) - if req.Limit > 0 { - page = req.Offset / req.Limit - } s, err := l.svcCtx.PlayerRpc.SearchPlayerServices(l.ctx, &playerservice.SearchPlayerServicesReq{ - Page: page, + Offset: req.Offset, Limit: req.Limit, PlayerId: req.Id, }) diff --git a/app/player/api/internal/logic/player/listPlayersLogic.go b/app/player/api/internal/logic/player/listPlayersLogic.go index 57ff185..be91844 100644 --- a/app/player/api/internal/logic/player/listPlayersLogic.go +++ b/app/player/api/internal/logic/player/listPlayersLogic.go @@ -30,12 +30,8 @@ func NewListPlayersLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListP } func (l *ListPlayersLogic) ListPlayers(req *types.PlayerListReq) (resp *types.PlayerListResp, err error) { - page := int64(0) - if req.Limit > 0 { - page = req.Offset / req.Limit - } p, err := l.svcCtx.PlayerRpc.SearchPlayers(l.ctx, &pb.SearchPlayersReq{ - Page: &page, + Offset: &req.Offset, Limit: &req.Limit, Gender: &req.Gender, }) diff --git a/app/player/api/internal/logic/player/listServicesLogic.go b/app/player/api/internal/logic/player/listServicesLogic.go index 044569f..dc944be 100644 --- a/app/player/api/internal/logic/player/listServicesLogic.go +++ b/app/player/api/internal/logic/player/listServicesLogic.go @@ -31,12 +31,8 @@ func NewListServicesLogic(ctx context.Context, svcCtx *svc.ServiceContext) *List func (l *ListServicesLogic) ListServices(req *types.PageReq) (resp *types.PlayerServiceListResp, err error) { resp = &types.PlayerServiceListResp{} - page := int64(0) - if req.Limit > 0 { - page = req.Offset / req.Limit - } s, err := l.svcCtx.PlayerRpc.SearchPlayerServices(l.ctx, &playerservice.SearchPlayerServicesReq{ - Page: page, + Offset: req.Offset, Limit: req.Limit, PlayerId: 0, }) diff --git a/app/player/rpc/internal/logic/searchPlayerServicesLogic.go b/app/player/rpc/internal/logic/searchPlayerServicesLogic.go index 4f93b06..f5716f5 100644 --- a/app/player/rpc/internal/logic/searchPlayerServicesLogic.go +++ b/app/player/rpc/internal/logic/searchPlayerServicesLogic.go @@ -36,7 +36,7 @@ func (l *SearchPlayerServicesLogic) SearchPlayerServices(in *pb.SearchPlayerServ all, err := update. Limit(int(in.Limit)). - Offset(int(in.Limit * in.Page)). + Offset(int(in.Offset)). All(l.ctx) if err != nil { return nil, errors.New("query all player services err") diff --git a/app/player/rpc/internal/logic/searchPlayersLogic.go b/app/player/rpc/internal/logic/searchPlayersLogic.go index 13eda50..f587a2c 100644 --- a/app/player/rpc/internal/logic/searchPlayersLogic.go +++ b/app/player/rpc/internal/logic/searchPlayersLogic.go @@ -36,7 +36,7 @@ func (l *SearchPlayersLogic) SearchPlayers(in *pb.SearchPlayersReq) (*pb.SearchP } searcher.Where(players.GenderEQ(gender)) } - all, err := searcher.Limit(int(*in.Limit)).Offset(int(*in.Page * *in.Limit)).All(l.ctx) + all, err := searcher.Limit(int(*in.Limit)).Offset(int(*in.Offset)).All(l.ctx) if err != nil { logx.Errorf("SearchPlayers err: %v", err) return nil, errors.New("search players") diff --git a/app/player/rpc/pb/player.pb.go b/app/player/rpc/pb/player.pb.go index fb6162a..1fb5825 100644 --- a/app/player/rpc/pb/player.pb.go +++ b/app/player/rpc/pb/player.pb.go @@ -2,7 +2,7 @@ // versions: // protoc-gen-go v1.36.11 // protoc v7.34.1 -// source: desc/rpc/player.proto +// source: player.proto package pb @@ -43,7 +43,7 @@ type PlayerServices struct { func (x *PlayerServices) Reset() { *x = PlayerServices{} - mi := &file_desc_rpc_player_proto_msgTypes[0] + mi := &file_player_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -55,7 +55,7 @@ func (x *PlayerServices) String() string { func (*PlayerServices) ProtoMessage() {} func (x *PlayerServices) ProtoReflect() protoreflect.Message { - mi := &file_desc_rpc_player_proto_msgTypes[0] + mi := &file_player_proto_msgTypes[0] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -68,7 +68,7 @@ func (x *PlayerServices) ProtoReflect() protoreflect.Message { // Deprecated: Use PlayerServices.ProtoReflect.Descriptor instead. func (*PlayerServices) Descriptor() ([]byte, []int) { - return file_desc_rpc_player_proto_rawDescGZIP(), []int{0} + return file_player_proto_rawDescGZIP(), []int{0} } func (x *PlayerServices) GetId() int64 { @@ -182,7 +182,7 @@ type AddPlayerServicesReq struct { func (x *AddPlayerServicesReq) Reset() { *x = AddPlayerServicesReq{} - mi := &file_desc_rpc_player_proto_msgTypes[1] + mi := &file_player_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -194,7 +194,7 @@ func (x *AddPlayerServicesReq) String() string { func (*AddPlayerServicesReq) ProtoMessage() {} func (x *AddPlayerServicesReq) ProtoReflect() protoreflect.Message { - mi := &file_desc_rpc_player_proto_msgTypes[1] + mi := &file_player_proto_msgTypes[1] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -207,7 +207,7 @@ func (x *AddPlayerServicesReq) ProtoReflect() protoreflect.Message { // Deprecated: Use AddPlayerServicesReq.ProtoReflect.Descriptor instead. func (*AddPlayerServicesReq) Descriptor() ([]byte, []int) { - return file_desc_rpc_player_proto_rawDescGZIP(), []int{1} + return file_player_proto_rawDescGZIP(), []int{1} } func (x *AddPlayerServicesReq) GetPlayerId() int64 { @@ -303,7 +303,7 @@ type AddPlayerServicesResp struct { func (x *AddPlayerServicesResp) Reset() { *x = AddPlayerServicesResp{} - mi := &file_desc_rpc_player_proto_msgTypes[2] + mi := &file_player_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -315,7 +315,7 @@ func (x *AddPlayerServicesResp) String() string { func (*AddPlayerServicesResp) ProtoMessage() {} func (x *AddPlayerServicesResp) ProtoReflect() protoreflect.Message { - mi := &file_desc_rpc_player_proto_msgTypes[2] + mi := &file_player_proto_msgTypes[2] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -328,7 +328,7 @@ func (x *AddPlayerServicesResp) ProtoReflect() protoreflect.Message { // Deprecated: Use AddPlayerServicesResp.ProtoReflect.Descriptor instead. func (*AddPlayerServicesResp) Descriptor() ([]byte, []int) { - return file_desc_rpc_player_proto_rawDescGZIP(), []int{2} + return file_player_proto_rawDescGZIP(), []int{2} } func (x *AddPlayerServicesResp) GetPlayerServices() *PlayerServices { @@ -359,7 +359,7 @@ type UpdatePlayerServicesReq struct { func (x *UpdatePlayerServicesReq) Reset() { *x = UpdatePlayerServicesReq{} - mi := &file_desc_rpc_player_proto_msgTypes[3] + mi := &file_player_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -371,7 +371,7 @@ func (x *UpdatePlayerServicesReq) String() string { func (*UpdatePlayerServicesReq) ProtoMessage() {} func (x *UpdatePlayerServicesReq) ProtoReflect() protoreflect.Message { - mi := &file_desc_rpc_player_proto_msgTypes[3] + mi := &file_player_proto_msgTypes[3] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -384,7 +384,7 @@ func (x *UpdatePlayerServicesReq) ProtoReflect() protoreflect.Message { // Deprecated: Use UpdatePlayerServicesReq.ProtoReflect.Descriptor instead. func (*UpdatePlayerServicesReq) Descriptor() ([]byte, []int) { - return file_desc_rpc_player_proto_rawDescGZIP(), []int{3} + return file_player_proto_rawDescGZIP(), []int{3} } func (x *UpdatePlayerServicesReq) GetId() int64 { @@ -486,7 +486,7 @@ type UpdatePlayerServicesResp struct { func (x *UpdatePlayerServicesResp) Reset() { *x = UpdatePlayerServicesResp{} - mi := &file_desc_rpc_player_proto_msgTypes[4] + mi := &file_player_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -498,7 +498,7 @@ func (x *UpdatePlayerServicesResp) String() string { func (*UpdatePlayerServicesResp) ProtoMessage() {} func (x *UpdatePlayerServicesResp) ProtoReflect() protoreflect.Message { - mi := &file_desc_rpc_player_proto_msgTypes[4] + mi := &file_player_proto_msgTypes[4] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -511,7 +511,7 @@ func (x *UpdatePlayerServicesResp) ProtoReflect() protoreflect.Message { // Deprecated: Use UpdatePlayerServicesResp.ProtoReflect.Descriptor instead. func (*UpdatePlayerServicesResp) Descriptor() ([]byte, []int) { - return file_desc_rpc_player_proto_rawDescGZIP(), []int{4} + return file_player_proto_rawDescGZIP(), []int{4} } type DelPlayerServicesReq struct { @@ -523,7 +523,7 @@ type DelPlayerServicesReq struct { func (x *DelPlayerServicesReq) Reset() { *x = DelPlayerServicesReq{} - mi := &file_desc_rpc_player_proto_msgTypes[5] + mi := &file_player_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -535,7 +535,7 @@ func (x *DelPlayerServicesReq) String() string { func (*DelPlayerServicesReq) ProtoMessage() {} func (x *DelPlayerServicesReq) ProtoReflect() protoreflect.Message { - mi := &file_desc_rpc_player_proto_msgTypes[5] + mi := &file_player_proto_msgTypes[5] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -548,7 +548,7 @@ func (x *DelPlayerServicesReq) ProtoReflect() protoreflect.Message { // Deprecated: Use DelPlayerServicesReq.ProtoReflect.Descriptor instead. func (*DelPlayerServicesReq) Descriptor() ([]byte, []int) { - return file_desc_rpc_player_proto_rawDescGZIP(), []int{5} + return file_player_proto_rawDescGZIP(), []int{5} } func (x *DelPlayerServicesReq) GetId() int64 { @@ -566,7 +566,7 @@ type DelPlayerServicesResp struct { func (x *DelPlayerServicesResp) Reset() { *x = DelPlayerServicesResp{} - mi := &file_desc_rpc_player_proto_msgTypes[6] + mi := &file_player_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -578,7 +578,7 @@ func (x *DelPlayerServicesResp) String() string { func (*DelPlayerServicesResp) ProtoMessage() {} func (x *DelPlayerServicesResp) ProtoReflect() protoreflect.Message { - mi := &file_desc_rpc_player_proto_msgTypes[6] + mi := &file_player_proto_msgTypes[6] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -591,7 +591,7 @@ func (x *DelPlayerServicesResp) ProtoReflect() protoreflect.Message { // Deprecated: Use DelPlayerServicesResp.ProtoReflect.Descriptor instead. func (*DelPlayerServicesResp) Descriptor() ([]byte, []int) { - return file_desc_rpc_player_proto_rawDescGZIP(), []int{6} + return file_player_proto_rawDescGZIP(), []int{6} } type GetPlayerServicesByIdReq struct { @@ -603,7 +603,7 @@ type GetPlayerServicesByIdReq struct { func (x *GetPlayerServicesByIdReq) Reset() { *x = GetPlayerServicesByIdReq{} - mi := &file_desc_rpc_player_proto_msgTypes[7] + mi := &file_player_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -615,7 +615,7 @@ func (x *GetPlayerServicesByIdReq) String() string { func (*GetPlayerServicesByIdReq) ProtoMessage() {} func (x *GetPlayerServicesByIdReq) ProtoReflect() protoreflect.Message { - mi := &file_desc_rpc_player_proto_msgTypes[7] + mi := &file_player_proto_msgTypes[7] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -628,7 +628,7 @@ func (x *GetPlayerServicesByIdReq) ProtoReflect() protoreflect.Message { // Deprecated: Use GetPlayerServicesByIdReq.ProtoReflect.Descriptor instead. func (*GetPlayerServicesByIdReq) Descriptor() ([]byte, []int) { - return file_desc_rpc_player_proto_rawDescGZIP(), []int{7} + return file_player_proto_rawDescGZIP(), []int{7} } func (x *GetPlayerServicesByIdReq) GetId() int64 { @@ -647,7 +647,7 @@ type GetPlayerServicesByIdResp struct { func (x *GetPlayerServicesByIdResp) Reset() { *x = GetPlayerServicesByIdResp{} - mi := &file_desc_rpc_player_proto_msgTypes[8] + mi := &file_player_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -659,7 +659,7 @@ func (x *GetPlayerServicesByIdResp) String() string { func (*GetPlayerServicesByIdResp) ProtoMessage() {} func (x *GetPlayerServicesByIdResp) ProtoReflect() protoreflect.Message { - mi := &file_desc_rpc_player_proto_msgTypes[8] + mi := &file_player_proto_msgTypes[8] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -672,7 +672,7 @@ func (x *GetPlayerServicesByIdResp) ProtoReflect() protoreflect.Message { // Deprecated: Use GetPlayerServicesByIdResp.ProtoReflect.Descriptor instead. func (*GetPlayerServicesByIdResp) Descriptor() ([]byte, []int) { - return file_desc_rpc_player_proto_rawDescGZIP(), []int{8} + return file_player_proto_rawDescGZIP(), []int{8} } func (x *GetPlayerServicesByIdResp) GetPlayerServices() *PlayerServices { @@ -684,7 +684,7 @@ func (x *GetPlayerServicesByIdResp) GetPlayerServices() *PlayerServices { type SearchPlayerServicesReq struct { state protoimpl.MessageState `protogen:"open.v1"` - Page int64 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"` //page + Offset int64 `protobuf:"varint,1,opt,name=offset,proto3" json:"offset,omitempty"` //offset Limit int64 `protobuf:"varint,2,opt,name=limit,proto3" json:"limit,omitempty"` //limit Id int64 `protobuf:"varint,3,opt,name=id,proto3" json:"id,omitempty"` //id PlayerId int64 `protobuf:"varint,4,opt,name=playerId,proto3" json:"playerId,omitempty"` //playerId @@ -705,7 +705,7 @@ type SearchPlayerServicesReq struct { func (x *SearchPlayerServicesReq) Reset() { *x = SearchPlayerServicesReq{} - mi := &file_desc_rpc_player_proto_msgTypes[9] + mi := &file_player_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -717,7 +717,7 @@ func (x *SearchPlayerServicesReq) String() string { func (*SearchPlayerServicesReq) ProtoMessage() {} func (x *SearchPlayerServicesReq) ProtoReflect() protoreflect.Message { - mi := &file_desc_rpc_player_proto_msgTypes[9] + mi := &file_player_proto_msgTypes[9] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -730,12 +730,12 @@ func (x *SearchPlayerServicesReq) ProtoReflect() protoreflect.Message { // Deprecated: Use SearchPlayerServicesReq.ProtoReflect.Descriptor instead. func (*SearchPlayerServicesReq) Descriptor() ([]byte, []int) { - return file_desc_rpc_player_proto_rawDescGZIP(), []int{9} + return file_player_proto_rawDescGZIP(), []int{9} } -func (x *SearchPlayerServicesReq) GetPage() int64 { +func (x *SearchPlayerServicesReq) GetOffset() int64 { if x != nil { - return x.Page + return x.Offset } return 0 } @@ -847,7 +847,7 @@ type SearchPlayerServicesResp struct { func (x *SearchPlayerServicesResp) Reset() { *x = SearchPlayerServicesResp{} - mi := &file_desc_rpc_player_proto_msgTypes[10] + mi := &file_player_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -859,7 +859,7 @@ func (x *SearchPlayerServicesResp) String() string { func (*SearchPlayerServicesResp) ProtoMessage() {} func (x *SearchPlayerServicesResp) ProtoReflect() protoreflect.Message { - mi := &file_desc_rpc_player_proto_msgTypes[10] + mi := &file_player_proto_msgTypes[10] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -872,7 +872,7 @@ func (x *SearchPlayerServicesResp) ProtoReflect() protoreflect.Message { // Deprecated: Use SearchPlayerServicesResp.ProtoReflect.Descriptor instead. func (*SearchPlayerServicesResp) Descriptor() ([]byte, []int) { - return file_desc_rpc_player_proto_rawDescGZIP(), []int{10} + return file_player_proto_rawDescGZIP(), []int{10} } func (x *SearchPlayerServicesResp) GetPlayerServices() []*PlayerServices { @@ -903,7 +903,7 @@ type Players struct { func (x *Players) Reset() { *x = Players{} - mi := &file_desc_rpc_player_proto_msgTypes[11] + mi := &file_player_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -915,7 +915,7 @@ func (x *Players) String() string { func (*Players) ProtoMessage() {} func (x *Players) ProtoReflect() protoreflect.Message { - mi := &file_desc_rpc_player_proto_msgTypes[11] + mi := &file_player_proto_msgTypes[11] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -928,7 +928,7 @@ func (x *Players) ProtoReflect() protoreflect.Message { // Deprecated: Use Players.ProtoReflect.Descriptor instead. func (*Players) Descriptor() ([]byte, []int) { - return file_desc_rpc_player_proto_rawDescGZIP(), []int{11} + return file_player_proto_rawDescGZIP(), []int{11} } func (x *Players) GetId() int64 { @@ -1034,7 +1034,7 @@ type AddPlayersReq struct { func (x *AddPlayersReq) Reset() { *x = AddPlayersReq{} - mi := &file_desc_rpc_player_proto_msgTypes[12] + mi := &file_player_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1046,7 +1046,7 @@ func (x *AddPlayersReq) String() string { func (*AddPlayersReq) ProtoMessage() {} func (x *AddPlayersReq) ProtoReflect() protoreflect.Message { - mi := &file_desc_rpc_player_proto_msgTypes[12] + mi := &file_player_proto_msgTypes[12] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1059,7 +1059,7 @@ func (x *AddPlayersReq) ProtoReflect() protoreflect.Message { // Deprecated: Use AddPlayersReq.ProtoReflect.Descriptor instead. func (*AddPlayersReq) Descriptor() ([]byte, []int) { - return file_desc_rpc_player_proto_rawDescGZIP(), []int{12} + return file_player_proto_rawDescGZIP(), []int{12} } func (x *AddPlayersReq) GetUserId() int64 { @@ -1147,7 +1147,7 @@ type AddPlayersResp struct { func (x *AddPlayersResp) Reset() { *x = AddPlayersResp{} - mi := &file_desc_rpc_player_proto_msgTypes[13] + mi := &file_player_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1159,7 +1159,7 @@ func (x *AddPlayersResp) String() string { func (*AddPlayersResp) ProtoMessage() {} func (x *AddPlayersResp) ProtoReflect() protoreflect.Message { - mi := &file_desc_rpc_player_proto_msgTypes[13] + mi := &file_player_proto_msgTypes[13] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1172,7 +1172,7 @@ func (x *AddPlayersResp) ProtoReflect() protoreflect.Message { // Deprecated: Use AddPlayersResp.ProtoReflect.Descriptor instead. func (*AddPlayersResp) Descriptor() ([]byte, []int) { - return file_desc_rpc_player_proto_rawDescGZIP(), []int{13} + return file_player_proto_rawDescGZIP(), []int{13} } type UpdatePlayersReq struct { @@ -1195,7 +1195,7 @@ type UpdatePlayersReq struct { func (x *UpdatePlayersReq) Reset() { *x = UpdatePlayersReq{} - mi := &file_desc_rpc_player_proto_msgTypes[14] + mi := &file_player_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1207,7 +1207,7 @@ func (x *UpdatePlayersReq) String() string { func (*UpdatePlayersReq) ProtoMessage() {} func (x *UpdatePlayersReq) ProtoReflect() protoreflect.Message { - mi := &file_desc_rpc_player_proto_msgTypes[14] + mi := &file_player_proto_msgTypes[14] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1220,7 +1220,7 @@ func (x *UpdatePlayersReq) ProtoReflect() protoreflect.Message { // Deprecated: Use UpdatePlayersReq.ProtoReflect.Descriptor instead. func (*UpdatePlayersReq) Descriptor() ([]byte, []int) { - return file_desc_rpc_player_proto_rawDescGZIP(), []int{14} + return file_player_proto_rawDescGZIP(), []int{14} } func (x *UpdatePlayersReq) GetId() int64 { @@ -1315,7 +1315,7 @@ type UpdatePlayersResp struct { func (x *UpdatePlayersResp) Reset() { *x = UpdatePlayersResp{} - mi := &file_desc_rpc_player_proto_msgTypes[15] + mi := &file_player_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1327,7 +1327,7 @@ func (x *UpdatePlayersResp) String() string { func (*UpdatePlayersResp) ProtoMessage() {} func (x *UpdatePlayersResp) ProtoReflect() protoreflect.Message { - mi := &file_desc_rpc_player_proto_msgTypes[15] + mi := &file_player_proto_msgTypes[15] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1340,7 +1340,7 @@ func (x *UpdatePlayersResp) ProtoReflect() protoreflect.Message { // Deprecated: Use UpdatePlayersResp.ProtoReflect.Descriptor instead. func (*UpdatePlayersResp) Descriptor() ([]byte, []int) { - return file_desc_rpc_player_proto_rawDescGZIP(), []int{15} + return file_player_proto_rawDescGZIP(), []int{15} } type DelPlayersReq struct { @@ -1352,7 +1352,7 @@ type DelPlayersReq struct { func (x *DelPlayersReq) Reset() { *x = DelPlayersReq{} - mi := &file_desc_rpc_player_proto_msgTypes[16] + mi := &file_player_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1364,7 +1364,7 @@ func (x *DelPlayersReq) String() string { func (*DelPlayersReq) ProtoMessage() {} func (x *DelPlayersReq) ProtoReflect() protoreflect.Message { - mi := &file_desc_rpc_player_proto_msgTypes[16] + mi := &file_player_proto_msgTypes[16] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1377,7 +1377,7 @@ func (x *DelPlayersReq) ProtoReflect() protoreflect.Message { // Deprecated: Use DelPlayersReq.ProtoReflect.Descriptor instead. func (*DelPlayersReq) Descriptor() ([]byte, []int) { - return file_desc_rpc_player_proto_rawDescGZIP(), []int{16} + return file_player_proto_rawDescGZIP(), []int{16} } func (x *DelPlayersReq) GetId() int64 { @@ -1395,7 +1395,7 @@ type DelPlayersResp struct { func (x *DelPlayersResp) Reset() { *x = DelPlayersResp{} - mi := &file_desc_rpc_player_proto_msgTypes[17] + mi := &file_player_proto_msgTypes[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1407,7 +1407,7 @@ func (x *DelPlayersResp) String() string { func (*DelPlayersResp) ProtoMessage() {} func (x *DelPlayersResp) ProtoReflect() protoreflect.Message { - mi := &file_desc_rpc_player_proto_msgTypes[17] + mi := &file_player_proto_msgTypes[17] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1420,7 +1420,7 @@ func (x *DelPlayersResp) ProtoReflect() protoreflect.Message { // Deprecated: Use DelPlayersResp.ProtoReflect.Descriptor instead. func (*DelPlayersResp) Descriptor() ([]byte, []int) { - return file_desc_rpc_player_proto_rawDescGZIP(), []int{17} + return file_player_proto_rawDescGZIP(), []int{17} } type GetPlayersByIdReq struct { @@ -1432,7 +1432,7 @@ type GetPlayersByIdReq struct { func (x *GetPlayersByIdReq) Reset() { *x = GetPlayersByIdReq{} - mi := &file_desc_rpc_player_proto_msgTypes[18] + mi := &file_player_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1444,7 +1444,7 @@ func (x *GetPlayersByIdReq) String() string { func (*GetPlayersByIdReq) ProtoMessage() {} func (x *GetPlayersByIdReq) ProtoReflect() protoreflect.Message { - mi := &file_desc_rpc_player_proto_msgTypes[18] + mi := &file_player_proto_msgTypes[18] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1457,7 +1457,7 @@ func (x *GetPlayersByIdReq) ProtoReflect() protoreflect.Message { // Deprecated: Use GetPlayersByIdReq.ProtoReflect.Descriptor instead. func (*GetPlayersByIdReq) Descriptor() ([]byte, []int) { - return file_desc_rpc_player_proto_rawDescGZIP(), []int{18} + return file_player_proto_rawDescGZIP(), []int{18} } func (x *GetPlayersByIdReq) GetId() int64 { @@ -1476,7 +1476,7 @@ type GetPlayersByIdResp struct { func (x *GetPlayersByIdResp) Reset() { *x = GetPlayersByIdResp{} - mi := &file_desc_rpc_player_proto_msgTypes[19] + mi := &file_player_proto_msgTypes[19] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1488,7 +1488,7 @@ func (x *GetPlayersByIdResp) String() string { func (*GetPlayersByIdResp) ProtoMessage() {} func (x *GetPlayersByIdResp) ProtoReflect() protoreflect.Message { - mi := &file_desc_rpc_player_proto_msgTypes[19] + mi := &file_player_proto_msgTypes[19] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1501,7 +1501,7 @@ func (x *GetPlayersByIdResp) ProtoReflect() protoreflect.Message { // Deprecated: Use GetPlayersByIdResp.ProtoReflect.Descriptor instead. func (*GetPlayersByIdResp) Descriptor() ([]byte, []int) { - return file_desc_rpc_player_proto_rawDescGZIP(), []int{19} + return file_player_proto_rawDescGZIP(), []int{19} } func (x *GetPlayersByIdResp) GetPlayers() *Players { @@ -1513,7 +1513,7 @@ func (x *GetPlayersByIdResp) GetPlayers() *Players { type SearchPlayersReq struct { state protoimpl.MessageState `protogen:"open.v1"` - Page *int64 `protobuf:"varint,1,opt,name=page,proto3,oneof" json:"page,omitempty"` //page + Offset *int64 `protobuf:"varint,1,opt,name=offset,proto3,oneof" json:"offset,omitempty"` //offset Limit *int64 `protobuf:"varint,2,opt,name=limit,proto3,oneof" json:"limit,omitempty"` //limit Id *int64 `protobuf:"varint,3,opt,name=id,proto3,oneof" json:"id,omitempty"` //id UserId *int64 `protobuf:"varint,4,opt,name=userId,proto3,oneof" json:"userId,omitempty"` //userId @@ -1533,7 +1533,7 @@ type SearchPlayersReq struct { func (x *SearchPlayersReq) Reset() { *x = SearchPlayersReq{} - mi := &file_desc_rpc_player_proto_msgTypes[20] + mi := &file_player_proto_msgTypes[20] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1545,7 +1545,7 @@ func (x *SearchPlayersReq) String() string { func (*SearchPlayersReq) ProtoMessage() {} func (x *SearchPlayersReq) ProtoReflect() protoreflect.Message { - mi := &file_desc_rpc_player_proto_msgTypes[20] + mi := &file_player_proto_msgTypes[20] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1558,12 +1558,12 @@ func (x *SearchPlayersReq) ProtoReflect() protoreflect.Message { // Deprecated: Use SearchPlayersReq.ProtoReflect.Descriptor instead. func (*SearchPlayersReq) Descriptor() ([]byte, []int) { - return file_desc_rpc_player_proto_rawDescGZIP(), []int{20} + return file_player_proto_rawDescGZIP(), []int{20} } -func (x *SearchPlayersReq) GetPage() int64 { - if x != nil && x.Page != nil { - return *x.Page +func (x *SearchPlayersReq) GetOffset() int64 { + if x != nil && x.Offset != nil { + return *x.Offset } return 0 } @@ -1668,7 +1668,7 @@ type SearchPlayersResp struct { func (x *SearchPlayersResp) Reset() { *x = SearchPlayersResp{} - mi := &file_desc_rpc_player_proto_msgTypes[21] + mi := &file_player_proto_msgTypes[21] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1680,7 +1680,7 @@ func (x *SearchPlayersResp) String() string { func (*SearchPlayersResp) ProtoMessage() {} func (x *SearchPlayersResp) ProtoReflect() protoreflect.Message { - mi := &file_desc_rpc_player_proto_msgTypes[21] + mi := &file_player_proto_msgTypes[21] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1693,7 +1693,7 @@ func (x *SearchPlayersResp) ProtoReflect() protoreflect.Message { // Deprecated: Use SearchPlayersResp.ProtoReflect.Descriptor instead. func (*SearchPlayersResp) Descriptor() ([]byte, []int) { - return file_desc_rpc_player_proto_rawDescGZIP(), []int{21} + return file_player_proto_rawDescGZIP(), []int{21} } func (x *SearchPlayersResp) GetPlayers() []*Players { @@ -1703,11 +1703,11 @@ func (x *SearchPlayersResp) GetPlayers() []*Players { return nil } -var File_desc_rpc_player_proto protoreflect.FileDescriptor +var File_player_proto protoreflect.FileDescriptor -const file_desc_rpc_player_proto_rawDesc = "" + +const file_player_proto_rawDesc = "" + "\n" + - "\x15desc/rpc/player.proto\x12\x02pb\"\xe8\x02\n" + + "\fplayer.proto\x12\x02pb\"\xe8\x02\n" + "\x0ePlayerServices\x12\x0e\n" + "\x02id\x18\x01 \x01(\x03R\x02id\x12\x1a\n" + "\bplayerId\x18\x02 \x01(\x03R\bplayerId\x12\x16\n" + @@ -1776,9 +1776,9 @@ const file_desc_rpc_player_proto_rawDesc = "" + "\x18GetPlayerServicesByIdReq\x12\x0e\n" + "\x02id\x18\x01 \x01(\x03R\x02id\"W\n" + "\x19GetPlayerServicesByIdResp\x12:\n" + - "\x0eplayerServices\x18\x01 \x01(\v2\x12.pb.PlayerServicesR\x0eplayerServices\"\x9b\x03\n" + - "\x17SearchPlayerServicesReq\x12\x12\n" + - "\x04page\x18\x01 \x01(\x03R\x04page\x12\x14\n" + + "\x0eplayerServices\x18\x01 \x01(\v2\x12.pb.PlayerServicesR\x0eplayerServices\"\x9f\x03\n" + + "\x17SearchPlayerServicesReq\x12\x16\n" + + "\x06offset\x18\x01 \x01(\x03R\x06offset\x12\x14\n" + "\x05limit\x18\x02 \x01(\x03R\x05limit\x12\x0e\n" + "\x02id\x18\x03 \x01(\x03R\x02id\x12\x1a\n" + "\bplayerId\x18\x04 \x01(\x03R\bplayerId\x12\x16\n" + @@ -1856,9 +1856,9 @@ const file_desc_rpc_player_proto_rawDesc = "" + "\x11GetPlayersByIdReq\x12\x0e\n" + "\x02id\x18\x01 \x01(\x03R\x02id\";\n" + "\x12GetPlayersByIdResp\x12%\n" + - "\aplayers\x18\x01 \x01(\v2\v.pb.PlayersR\aplayers\"\xc3\x04\n" + - "\x10SearchPlayersReq\x12\x17\n" + - "\x04page\x18\x01 \x01(\x03H\x00R\x04page\x88\x01\x01\x12\x19\n" + + "\aplayers\x18\x01 \x01(\v2\v.pb.PlayersR\aplayers\"\xc9\x04\n" + + "\x10SearchPlayersReq\x12\x1b\n" + + "\x06offset\x18\x01 \x01(\x03H\x00R\x06offset\x88\x01\x01\x12\x19\n" + "\x05limit\x18\x02 \x01(\x03H\x01R\x05limit\x88\x01\x01\x12\x13\n" + "\x02id\x18\x03 \x01(\x03H\x02R\x02id\x88\x01\x01\x12\x1b\n" + "\x06userId\x18\x04 \x01(\x03H\x03R\x06userId\x88\x01\x01\x12\x1b\n" + @@ -1873,8 +1873,8 @@ const file_desc_rpc_player_proto_rawDesc = "" + "\tcreatedAt\x18\f \x01(\x03H\tR\tcreatedAt\x88\x01\x01\x12!\n" + "\tupdatedAt\x18\r \x01(\x03H\n" + "R\tupdatedAt\x88\x01\x01\x12\x1b\n" + - "\x06gender\x18\x0e \x01(\x03H\vR\x06gender\x88\x01\x01B\a\n" + - "\x05_pageB\b\n" + + "\x06gender\x18\x0e \x01(\x03H\vR\x06gender\x88\x01\x01B\t\n" + + "\a_offsetB\b\n" + "\x06_limitB\x05\n" + "\x03_idB\t\n" + "\a_userIdB\t\n" + @@ -1906,19 +1906,19 @@ const file_desc_rpc_player_proto_rawDesc = "" + "\rSearchPlayers\x12\x14.pb.SearchPlayersReq\x1a\x15.pb.SearchPlayersRespB\x06Z\x04./pbb\x06proto3" var ( - file_desc_rpc_player_proto_rawDescOnce sync.Once - file_desc_rpc_player_proto_rawDescData []byte + file_player_proto_rawDescOnce sync.Once + file_player_proto_rawDescData []byte ) -func file_desc_rpc_player_proto_rawDescGZIP() []byte { - file_desc_rpc_player_proto_rawDescOnce.Do(func() { - file_desc_rpc_player_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_desc_rpc_player_proto_rawDesc), len(file_desc_rpc_player_proto_rawDesc))) +func file_player_proto_rawDescGZIP() []byte { + file_player_proto_rawDescOnce.Do(func() { + file_player_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_player_proto_rawDesc), len(file_player_proto_rawDesc))) }) - return file_desc_rpc_player_proto_rawDescData + return file_player_proto_rawDescData } -var file_desc_rpc_player_proto_msgTypes = make([]protoimpl.MessageInfo, 22) -var file_desc_rpc_player_proto_goTypes = []any{ +var file_player_proto_msgTypes = make([]protoimpl.MessageInfo, 22) +var file_player_proto_goTypes = []any{ (*PlayerServices)(nil), // 0: pb.PlayerServices (*AddPlayerServicesReq)(nil), // 1: pb.AddPlayerServicesReq (*AddPlayerServicesResp)(nil), // 2: pb.AddPlayerServicesResp @@ -1942,7 +1942,7 @@ var file_desc_rpc_player_proto_goTypes = []any{ (*SearchPlayersReq)(nil), // 20: pb.SearchPlayersReq (*SearchPlayersResp)(nil), // 21: pb.SearchPlayersResp } -var file_desc_rpc_player_proto_depIdxs = []int32{ +var file_player_proto_depIdxs = []int32{ 0, // 0: pb.AddPlayerServicesResp.playerServices:type_name -> pb.PlayerServices 0, // 1: pb.GetPlayerServicesByIdResp.playerServices:type_name -> pb.PlayerServices 0, // 2: pb.SearchPlayerServicesResp.playerServices:type_name -> pb.PlayerServices @@ -1977,29 +1977,29 @@ var file_desc_rpc_player_proto_depIdxs = []int32{ 0, // [0:5] is the sub-list for field type_name } -func init() { file_desc_rpc_player_proto_init() } -func file_desc_rpc_player_proto_init() { - if File_desc_rpc_player_proto != nil { +func init() { file_player_proto_init() } +func file_player_proto_init() { + if File_player_proto != nil { return } - file_desc_rpc_player_proto_msgTypes[3].OneofWrappers = []any{} - file_desc_rpc_player_proto_msgTypes[14].OneofWrappers = []any{} - file_desc_rpc_player_proto_msgTypes[20].OneofWrappers = []any{} + file_player_proto_msgTypes[3].OneofWrappers = []any{} + file_player_proto_msgTypes[14].OneofWrappers = []any{} + file_player_proto_msgTypes[20].OneofWrappers = []any{} type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: unsafe.Slice(unsafe.StringData(file_desc_rpc_player_proto_rawDesc), len(file_desc_rpc_player_proto_rawDesc)), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_player_proto_rawDesc), len(file_player_proto_rawDesc)), NumEnums: 0, NumMessages: 22, NumExtensions: 0, NumServices: 1, }, - GoTypes: file_desc_rpc_player_proto_goTypes, - DependencyIndexes: file_desc_rpc_player_proto_depIdxs, - MessageInfos: file_desc_rpc_player_proto_msgTypes, + GoTypes: file_player_proto_goTypes, + DependencyIndexes: file_player_proto_depIdxs, + MessageInfos: file_player_proto_msgTypes, }.Build() - File_desc_rpc_player_proto = out.File - file_desc_rpc_player_proto_goTypes = nil - file_desc_rpc_player_proto_depIdxs = nil + File_player_proto = out.File + file_player_proto_goTypes = nil + file_player_proto_depIdxs = nil } diff --git a/app/shop/api/internal/logic/shop/helpers.go b/app/shop/api/internal/logic/shop/helpers.go index a7ded8d..b7fa32a 100644 --- a/app/shop/api/internal/logic/shop/helpers.go +++ b/app/shop/api/internal/logic/shop/helpers.go @@ -51,7 +51,7 @@ func toShopProfile(in *pb.Shops) *types.ShopProfile { func getShopByOwnerID(ctx context.Context, rpc shopservice.ShopService, ownerID int64) (*pb.Shops, error) { list, err := rpc.SearchShops(ctx, &pb.SearchShopsReq{ - Page: 0, + Offset: 0, Limit: 1, OwnerId: ownerID, }) diff --git a/app/shop/api/internal/logic/shop/listShopsLogic.go b/app/shop/api/internal/logic/shop/listShopsLogic.go index 706d3b9..8dfc10c 100644 --- a/app/shop/api/internal/logic/shop/listShopsLogic.go +++ b/app/shop/api/internal/logic/shop/listShopsLogic.go @@ -35,8 +35,8 @@ func (l *ListShopsLogic) ListShops(req *types.PageReq) (resp *types.ShopListResp } result, err := l.svcCtx.ShopRpc.SearchShops(l.ctx, &pb.SearchShopsReq{ - Page: req.Offset / req.Limit, - Limit: req.Limit, + Offset: req.Offset, + Limit: req.Limit, }) if err != nil { return nil, err diff --git a/app/shop/rpc/internal/logic/searchShopInvitationsLogic.go b/app/shop/rpc/internal/logic/searchShopInvitationsLogic.go index 2b1e66b..88b84bd 100644 --- a/app/shop/rpc/internal/logic/searchShopInvitationsLogic.go +++ b/app/shop/rpc/internal/logic/searchShopInvitationsLogic.go @@ -63,7 +63,7 @@ func (l *SearchShopInvitationsLogic) SearchShopInvitations(in *pb.SearchShopInvi } list, err := query. - Offset(int(in.Page * in.Limit)). + Offset(int(in.Offset)). Limit(int(in.Limit)). All(l.ctx) if err != nil { diff --git a/app/shop/rpc/internal/logic/searchShopPlayersLogic.go b/app/shop/rpc/internal/logic/searchShopPlayersLogic.go index db9042f..8a1a6e6 100644 --- a/app/shop/rpc/internal/logic/searchShopPlayersLogic.go +++ b/app/shop/rpc/internal/logic/searchShopPlayersLogic.go @@ -57,7 +57,7 @@ func (l *SearchShopPlayersLogic) SearchShopPlayers(in *pb.SearchShopPlayersReq) } list, err := query. - Offset(int(in.Page * in.Limit)). + Offset(int(in.Offset)). Limit(int(in.Limit)). All(l.ctx) if err != nil { diff --git a/app/shop/rpc/internal/logic/searchShopsLogic.go b/app/shop/rpc/internal/logic/searchShopsLogic.go index 6e23343..1704dc2 100644 --- a/app/shop/rpc/internal/logic/searchShopsLogic.go +++ b/app/shop/rpc/internal/logic/searchShopsLogic.go @@ -96,7 +96,7 @@ func (l *SearchShopsLogic) SearchShops(in *pb.SearchShopsReq) (*pb.SearchShopsRe } list, err := query. - Offset(int(in.Page * in.Limit)). + Offset(int(in.Offset)). Limit(int(in.Limit)). All(l.ctx) if err != nil { diff --git a/app/shop/rpc/pb/shop.pb.go b/app/shop/rpc/pb/shop.pb.go index e1ed03f..ca6f4ab 100644 --- a/app/shop/rpc/pb/shop.pb.go +++ b/app/shop/rpc/pb/shop.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.36.11 -// protoc v3.19.4 +// protoc v7.34.1 // source: shop.proto package pb @@ -540,7 +540,7 @@ func (x *GetShopInvitationsByIdResp) GetShopInvitations() *ShopInvitations { type SearchShopInvitationsReq struct { state protoimpl.MessageState `protogen:"open.v1"` - Page int64 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"` //page + Offset int64 `protobuf:"varint,1,opt,name=offset,proto3" json:"offset,omitempty"` //offset Limit int64 `protobuf:"varint,2,opt,name=limit,proto3" json:"limit,omitempty"` //limit Id int64 `protobuf:"varint,3,opt,name=id,proto3" json:"id,omitempty"` //id ShopId int64 `protobuf:"varint,4,opt,name=shopId,proto3" json:"shopId,omitempty"` //shopId @@ -583,9 +583,9 @@ func (*SearchShopInvitationsReq) Descriptor() ([]byte, []int) { return file_shop_proto_rawDescGZIP(), []int{9} } -func (x *SearchShopInvitationsReq) GetPage() int64 { +func (x *SearchShopInvitationsReq) GetOffset() int64 { if x != nil { - return x.Page + return x.Offset } return 0 } @@ -1177,7 +1177,7 @@ func (x *GetShopPlayersByIdResp) GetShopPlayers() *ShopPlayers { type SearchShopPlayersReq struct { state protoimpl.MessageState `protogen:"open.v1"` - Page int64 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"` //page + Offset int64 `protobuf:"varint,1,opt,name=offset,proto3" json:"offset,omitempty"` //offset Limit int64 `protobuf:"varint,2,opt,name=limit,proto3" json:"limit,omitempty"` //limit ShopId int64 `protobuf:"varint,3,opt,name=shopId,proto3" json:"shopId,omitempty"` //shopId PlayerId int64 `protobuf:"varint,4,opt,name=playerId,proto3" json:"playerId,omitempty"` //playerId @@ -1218,9 +1218,9 @@ func (*SearchShopPlayersReq) Descriptor() ([]byte, []int) { return file_shop_proto_rawDescGZIP(), []int{20} } -func (x *SearchShopPlayersReq) GetPage() int64 { +func (x *SearchShopPlayersReq) GetOffset() int64 { if x != nil { - return x.Page + return x.Offset } return 0 } @@ -2062,7 +2062,7 @@ func (x *GetShopsByIdResp) GetShops() *Shops { type SearchShopsReq struct { state protoimpl.MessageState `protogen:"open.v1"` - Page int64 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"` //page + Offset int64 `protobuf:"varint,1,opt,name=offset,proto3" json:"offset,omitempty"` //offset Limit int64 `protobuf:"varint,2,opt,name=limit,proto3" json:"limit,omitempty"` //limit Id int64 `protobuf:"varint,3,opt,name=id,proto3" json:"id,omitempty"` //id OwnerId int64 `protobuf:"varint,4,opt,name=ownerId,proto3" json:"ownerId,omitempty"` //ownerId @@ -2115,9 +2115,9 @@ func (*SearchShopsReq) Descriptor() ([]byte, []int) { return file_shop_proto_rawDescGZIP(), []int{31} } -func (x *SearchShopsReq) GetPage() int64 { +func (x *SearchShopsReq) GetOffset() int64 { if x != nil { - return x.Page + return x.Offset } return 0 } @@ -2330,9 +2330,9 @@ const file_shop_proto_rawDesc = "" + "\x19GetShopInvitationsByIdReq\x12\x0e\n" + "\x02id\x18\x01 \x01(\x03R\x02id\"[\n" + "\x1aGetShopInvitationsByIdResp\x12=\n" + - "\x0fshopInvitations\x18\x01 \x01(\v2\x13.pb.ShopInvitationsR\x0fshopInvitations\"\xfe\x01\n" + - "\x18SearchShopInvitationsReq\x12\x12\n" + - "\x04page\x18\x01 \x01(\x03R\x04page\x12\x14\n" + + "\x0fshopInvitations\x18\x01 \x01(\v2\x13.pb.ShopInvitationsR\x0fshopInvitations\"\x82\x02\n" + + "\x18SearchShopInvitationsReq\x12\x16\n" + + "\x06offset\x18\x01 \x01(\x03R\x06offset\x12\x14\n" + "\x05limit\x18\x02 \x01(\x03R\x05limit\x12\x0e\n" + "\x02id\x18\x03 \x01(\x03R\x02id\x12\x16\n" + "\x06shopId\x18\x04 \x01(\x03R\x06shopId\x12\x1a\n" + @@ -2371,9 +2371,9 @@ const file_shop_proto_rawDesc = "" + "\x06shopId\x18\x01 \x01(\x03R\x06shopId\x12\x1a\n" + "\bplayerId\x18\x02 \x01(\x03R\bplayerId\"K\n" + "\x16GetShopPlayersByIdResp\x121\n" + - "\vshopPlayers\x18\x01 \x01(\v2\x0f.pb.ShopPlayersR\vshopPlayers\"\xc6\x01\n" + - "\x14SearchShopPlayersReq\x12\x12\n" + - "\x04page\x18\x01 \x01(\x03R\x04page\x12\x14\n" + + "\vshopPlayers\x18\x01 \x01(\v2\x0f.pb.ShopPlayersR\vshopPlayers\"\xca\x01\n" + + "\x14SearchShopPlayersReq\x12\x16\n" + + "\x06offset\x18\x01 \x01(\x03R\x06offset\x12\x14\n" + "\x05limit\x18\x02 \x01(\x03R\x05limit\x12\x16\n" + "\x06shopId\x18\x03 \x01(\x03R\x06shopId\x12\x1a\n" + "\bplayerId\x18\x04 \x01(\x03R\bplayerId\x12\x1c\n" + @@ -2446,9 +2446,9 @@ const file_shop_proto_rawDesc = "" + "\x0fGetShopsByIdReq\x12\x0e\n" + "\x02id\x18\x01 \x01(\x03R\x02id\"3\n" + "\x10GetShopsByIdResp\x12\x1f\n" + - "\x05shops\x18\x01 \x01(\v2\t.pb.ShopsR\x05shops\"\xee\x04\n" + - "\x0eSearchShopsReq\x12\x12\n" + - "\x04page\x18\x01 \x01(\x03R\x04page\x12\x14\n" + + "\x05shops\x18\x01 \x01(\v2\t.pb.ShopsR\x05shops\"\xf2\x04\n" + + "\x0eSearchShopsReq\x12\x16\n" + + "\x06offset\x18\x01 \x01(\x03R\x06offset\x12\x14\n" + "\x05limit\x18\x02 \x01(\x03R\x05limit\x12\x0e\n" + "\x02id\x18\x03 \x01(\x03R\x02id\x12\x18\n" + "\aownerId\x18\x04 \x01(\x03R\aownerId\x12\x12\n" + diff --git a/app/user_verifications/rpc/internal/logic/searchUserVerificationsLogic.go b/app/user_verifications/rpc/internal/logic/searchUserVerificationsLogic.go index 9caefc4..17f39bc 100644 --- a/app/user_verifications/rpc/internal/logic/searchUserVerificationsLogic.go +++ b/app/user_verifications/rpc/internal/logic/searchUserVerificationsLogic.go @@ -44,7 +44,7 @@ func (l *SearchUserVerificationsLogic) SearchUserVerifications(in *pb.SearchUser } verifications, err := l.svcCtx.UserVeriModelRO.Query().Where(predicates...). - Offset(int(in.Page * in.Limit)). + Offset(int(in.Offset)). Limit(int(in.Limit)). All(l.ctx) if err != nil { diff --git a/app/user_verifications/rpc/pb/user_verifications.pb.go b/app/user_verifications/rpc/pb/user_verifications.pb.go index c1a7300..c0c956d 100644 --- a/app/user_verifications/rpc/pb/user_verifications.pb.go +++ b/app/user_verifications/rpc/pb/user_verifications.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.36.11 -// protoc v5.29.6 +// protoc v7.34.1 // source: user_verifications.proto package pb @@ -604,7 +604,7 @@ func (x *GetUserVerificationsByIdResp) GetUserVerifications() *UserVerifications type SearchUserVerificationsReq struct { state protoimpl.MessageState `protogen:"open.v1"` - Page int64 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"` //page + Offset int64 `protobuf:"varint,1,opt,name=offset,proto3" json:"offset,omitempty"` //offset Limit int64 `protobuf:"varint,2,opt,name=limit,proto3" json:"limit,omitempty"` //limit Id int64 `protobuf:"varint,3,opt,name=id,proto3" json:"id,omitempty"` //id UserId int64 `protobuf:"varint,4,opt,name=userId,proto3" json:"userId,omitempty"` //userId @@ -650,9 +650,9 @@ func (*SearchUserVerificationsReq) Descriptor() ([]byte, []int) { return file_user_verifications_proto_rawDescGZIP(), []int{9} } -func (x *SearchUserVerificationsReq) GetPage() int64 { +func (x *SearchUserVerificationsReq) GetOffset() int64 { if x != nil { - return x.Page + return x.Offset } return 0 } @@ -1035,9 +1035,9 @@ const file_user_verifications_proto_rawDesc = "" + "\x1bGetUserVerificationsByIdReq\x12\x0e\n" + "\x02id\x18\x01 \x01(\x03R\x02id\"c\n" + "\x1cGetUserVerificationsByIdResp\x12C\n" + - "\x11userVerifications\x18\x01 \x01(\v2\x15.pb.UserVerificationsR\x11userVerifications\"\xd8\x02\n" + - "\x1aSearchUserVerificationsReq\x12\x12\n" + - "\x04page\x18\x01 \x01(\x03R\x04page\x12\x14\n" + + "\x11userVerifications\x18\x01 \x01(\v2\x15.pb.UserVerificationsR\x11userVerifications\"\xdc\x02\n" + + "\x1aSearchUserVerificationsReq\x12\x16\n" + + "\x06offset\x18\x01 \x01(\x03R\x06offset\x12\x14\n" + "\x05limit\x18\x02 \x01(\x03R\x05limit\x12\x0e\n" + "\x02id\x18\x03 \x01(\x03R\x02id\x12\x16\n" + "\x06userId\x18\x04 \x01(\x03R\x06userId\x12\x12\n" + diff --git a/app/users/api/internal/logic/verification_admin/getVerificationsLogic.go b/app/users/api/internal/logic/verification_admin/getVerificationsLogic.go index cd4285a..365afa3 100644 --- a/app/users/api/internal/logic/verification_admin/getVerificationsLogic.go +++ b/app/users/api/internal/logic/verification_admin/getVerificationsLogic.go @@ -45,7 +45,7 @@ func (l *GetVerificationsLogic) GetVerifications(req *types.GetPendingListReq) ( limit = 20 } verifications, err := l.svcCtx.UserVerificationsRpc.SearchUserVerifications(l.ctx, &pb.SearchUserVerificationsReq{ - Page: offset / limit, + Offset: offset, Limit: limit, Role: req.Role, Status: req.Status, diff --git a/app/users/rpc/internal/logic/searchUsersLogic.go b/app/users/rpc/internal/logic/searchUsersLogic.go index 0deed8c..22e8354 100644 --- a/app/users/rpc/internal/logic/searchUsersLogic.go +++ b/app/users/rpc/internal/logic/searchUsersLogic.go @@ -30,9 +30,9 @@ func NewSearchUsersLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Searc var SearUsersErr = errors.New("search users failed") func (l *SearchUsersLogic) SearchUsers(in *pb.SearchUsersReq) (out *pb.SearchUsersResp, err error) { - if in.Page == nil || *in.Page < 0 { - logx.Errorf("Invalid page number: %v", in.Page) - return nil, errors.New("invalid page number") + if in.Offset == nil || *in.Offset < 0 { + logx.Errorf("invalid offset: %v", in.Offset) + return nil, errors.New("invalid offset") } if *in.Limit > 1000 { logx.Errorf("Limit exceeds max limit: %d", in.Limit) @@ -45,7 +45,7 @@ func (l *SearchUsersLogic) SearchUsers(in *pb.SearchUsersReq) (out *pb.SearchUse users.EmailContainsFold(*in.Username), users.CurrentRole(*in.CurrentRole), )). - Offset(int(*in.Page * *in.Limit)). + Offset(int(*in.Offset)). Limit(int(*in.Limit)). All(l.ctx) if err != nil { diff --git a/app/users/rpc/pb/users.pb.go b/app/users/rpc/pb/users.pb.go index e951dbe..c1bf7cb 100644 --- a/app/users/rpc/pb/users.pb.go +++ b/app/users/rpc/pb/users.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.36.11 -// protoc v5.29.6 +// protoc v7.34.1 // source: users.proto package pb @@ -725,7 +725,7 @@ func (x *GetUsersByIdResp) GetUsers() *Users { type SearchUsersReq struct { state protoimpl.MessageState `protogen:"open.v1"` - Page *int64 `protobuf:"varint,1,opt,name=page,proto3,oneof" json:"page,omitempty"` //page + Offset *int64 `protobuf:"varint,1,opt,name=offset,proto3,oneof" json:"offset,omitempty"` //offset Limit *int64 `protobuf:"varint,2,opt,name=limit,proto3,oneof" json:"limit,omitempty"` //limit Id *int64 `protobuf:"varint,3,opt,name=id,proto3,oneof" json:"id,omitempty"` //id Username *string `protobuf:"bytes,4,opt,name=username,proto3,oneof" json:"username,omitempty"` //username @@ -776,9 +776,9 @@ func (*SearchUsersReq) Descriptor() ([]byte, []int) { return file_users_proto_rawDescGZIP(), []int{9} } -func (x *SearchUsersReq) GetPage() int64 { - if x != nil && x.Page != nil { - return *x.Page +func (x *SearchUsersReq) GetOffset() int64 { + if x != nil && x.Offset != nil { + return *x.Offset } return 0 } @@ -2234,7 +2234,7 @@ func (x *GetUserFollowsByIdResp) GetUserFollows() *UserFollows { type SearchUserFollowsReq struct { state protoimpl.MessageState `protogen:"open.v1"` - Page int64 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"` //page + Offset int64 `protobuf:"varint,1,opt,name=offset,proto3" json:"offset,omitempty"` //offset Limit int64 `protobuf:"varint,2,opt,name=limit,proto3" json:"limit,omitempty"` //limit Id int64 `protobuf:"varint,3,opt,name=id,proto3" json:"id,omitempty"` //id FollowerId int64 `protobuf:"varint,4,opt,name=followerId,proto3" json:"followerId,omitempty"` //followerId @@ -2274,9 +2274,9 @@ func (*SearchUserFollowsReq) Descriptor() ([]byte, []int) { return file_users_proto_rawDescGZIP(), []int{36} } -func (x *SearchUserFollowsReq) GetPage() int64 { +func (x *SearchUserFollowsReq) GetOffset() int64 { if x != nil { - return x.Page + return x.Offset } return 0 } @@ -2879,7 +2879,7 @@ func (x *GetUserPreferencesByIdResp) GetUserPreferences() *UserPreferences { type SearchUserPreferencesReq struct { state protoimpl.MessageState `protogen:"open.v1"` - Page int64 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"` //page + Offset int64 `protobuf:"varint,1,opt,name=offset,proto3" json:"offset,omitempty"` //offset Limit int64 `protobuf:"varint,2,opt,name=limit,proto3" json:"limit,omitempty"` //limit UserId int64 `protobuf:"varint,3,opt,name=userId,proto3" json:"userId,omitempty"` //userId NotificationOrder bool `protobuf:"varint,4,opt,name=notificationOrder,proto3" json:"notificationOrder,omitempty"` //notificationOrder @@ -2922,9 +2922,9 @@ func (*SearchUserPreferencesReq) Descriptor() ([]byte, []int) { return file_users_proto_rawDescGZIP(), []int{47} } -func (x *SearchUserPreferencesReq) GetPage() int64 { +func (x *SearchUserPreferencesReq) GetOffset() int64 { if x != nil { - return x.Page + return x.Offset } return 0 } @@ -3110,9 +3110,9 @@ const file_users_proto_rawDesc = "" + "\x0fGetUsersByIdReq\x12\x0e\n" + "\x02id\x18\x01 \x01(\x03R\x02id\"3\n" + "\x10GetUsersByIdResp\x12\x1f\n" + - "\x05users\x18\x01 \x01(\v2\t.pb.UsersR\x05users\"\x81\x06\n" + - "\x0eSearchUsersReq\x12\x17\n" + - "\x04page\x18\x01 \x01(\x03H\x00R\x04page\x88\x01\x01\x12\x19\n" + + "\x05users\x18\x01 \x01(\v2\t.pb.UsersR\x05users\"\x87\x06\n" + + "\x0eSearchUsersReq\x12\x1b\n" + + "\x06offset\x18\x01 \x01(\x03H\x00R\x06offset\x88\x01\x01\x12\x19\n" + "\x05limit\x18\x02 \x01(\x03H\x01R\x05limit\x88\x01\x01\x12\x13\n" + "\x02id\x18\x03 \x01(\x03H\x02R\x02id\x88\x01\x01\x12\x1f\n" + "\busername\x18\x04 \x01(\tH\x03R\busername\x88\x01\x01\x12'\n" + @@ -3130,8 +3130,8 @@ const file_users_proto_rawDesc = "" + "\aisAdmin\x18\x0e \x01(\bH\fR\aisAdmin\x88\x01\x01\x12!\n" + "\tcreatedAt\x18\x0f \x01(\x03H\rR\tcreatedAt\x88\x01\x01\x12!\n" + "\tupdatedAt\x18\x10 \x01(\x03H\x0eR\tupdatedAt\x88\x01\x01\x12!\n" + - "\tdeletedAt\x18\x11 \x01(\x03H\x0fR\tdeletedAt\x88\x01\x01B\a\n" + - "\x05_pageB\b\n" + + "\tdeletedAt\x18\x11 \x01(\x03H\x0fR\tdeletedAt\x88\x01\x01B\t\n" + + "\a_offsetB\b\n" + "\x06_limitB\x05\n" + "\x03_idB\v\n" + "\t_usernameB\x0f\n" + @@ -3239,9 +3239,9 @@ const file_users_proto_rawDesc = "" + "\x15GetUserFollowsByIdReq\x12\x0e\n" + "\x02id\x18\x01 \x01(\x03R\x02id\"K\n" + "\x16GetUserFollowsByIdResp\x121\n" + - "\vuserFollows\x18\x01 \x01(\v2\x0f.pb.UserFollowsR\vuserFollows\"\xae\x01\n" + - "\x14SearchUserFollowsReq\x12\x12\n" + - "\x04page\x18\x01 \x01(\x03R\x04page\x12\x14\n" + + "\vuserFollows\x18\x01 \x01(\v2\x0f.pb.UserFollowsR\vuserFollows\"\xb2\x01\n" + + "\x14SearchUserFollowsReq\x12\x16\n" + + "\x06offset\x18\x01 \x01(\x03R\x06offset\x12\x14\n" + "\x05limit\x18\x02 \x01(\x03R\x05limit\x12\x0e\n" + "\x02id\x18\x03 \x01(\x03R\x02id\x12\x1e\n" + "\n" + @@ -3285,9 +3285,9 @@ const file_users_proto_rawDesc = "" + "\x19GetUserPreferencesByIdReq\x12\x0e\n" + "\x02id\x18\x01 \x01(\x03R\x02id\"[\n" + "\x1aGetUserPreferencesByIdResp\x12=\n" + - "\x0fuserPreferences\x18\x01 \x01(\v2\x13.pb.UserPreferencesR\x0fuserPreferences\"\xc0\x02\n" + - "\x18SearchUserPreferencesReq\x12\x12\n" + - "\x04page\x18\x01 \x01(\x03R\x04page\x12\x14\n" + + "\x0fuserPreferences\x18\x01 \x01(\v2\x13.pb.UserPreferencesR\x0fuserPreferences\"\xc4\x02\n" + + "\x18SearchUserPreferencesReq\x12\x16\n" + + "\x06offset\x18\x01 \x01(\x03R\x06offset\x12\x14\n" + "\x05limit\x18\x02 \x01(\x03R\x05limit\x12\x16\n" + "\x06userId\x18\x03 \x01(\x03R\x06userId\x12,\n" + "\x11notificationOrder\x18\x04 \x01(\bR\x11notificationOrder\x124\n" + diff --git a/app/wallet/api/internal/logic/wallet/listTransactionsLogic.go b/app/wallet/api/internal/logic/wallet/listTransactionsLogic.go index 1e775a4..5a94111 100644 --- a/app/wallet/api/internal/logic/wallet/listTransactionsLogic.go +++ b/app/wallet/api/internal/logic/wallet/listTransactionsLogic.go @@ -43,7 +43,7 @@ func (l *ListTransactionsLogic) ListTransactions(req *types.PageReq) (resp *type } out, err := l.svcCtx.WalletRpc.SearchWalletTransactions(l.ctx, &pb.SearchWalletTransactionsReq{ - Page: req.Offset / req.Limit, + Offset: req.Offset, Limit: req.Limit, UserId: &userID, }) diff --git a/app/wallet/rpc/internal/logic/searchWalletTransactionsLogic.go b/app/wallet/rpc/internal/logic/searchWalletTransactionsLogic.go index 1246fc5..cb68a16 100644 --- a/app/wallet/rpc/internal/logic/searchWalletTransactionsLogic.go +++ b/app/wallet/rpc/internal/logic/searchWalletTransactionsLogic.go @@ -75,7 +75,7 @@ func (l *SearchWalletTransactionsLogic) SearchWalletTransactions(in *pb.SearchWa } list, err := query. - Offset(int(in.Page * in.Limit)). + Offset(int(in.Offset)). Limit(int(in.Limit)). All(l.ctx) if err != nil { diff --git a/app/wallet/rpc/pb/wallet.pb.go b/app/wallet/rpc/pb/wallet.pb.go index 746135b..07ce90c 100644 --- a/app/wallet/rpc/pb/wallet.pb.go +++ b/app/wallet/rpc/pb/wallet.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.36.11 -// protoc v5.29.6 +// protoc v7.34.1 // source: wallet.proto package pb @@ -580,7 +580,7 @@ func (x *GetWalletTransactionsByIdResp) GetWalletTransactions() *WalletTransacti type SearchWalletTransactionsReq struct { state protoimpl.MessageState `protogen:"open.v1"` - Page int64 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"` //page + Offset int64 `protobuf:"varint,1,opt,name=offset,proto3" json:"offset,omitempty"` //offset Limit int64 `protobuf:"varint,2,opt,name=limit,proto3" json:"limit,omitempty"` //limit Id int64 `protobuf:"varint,3,opt,name=id,proto3" json:"id,omitempty"` //id UserId *int64 `protobuf:"varint,4,opt,name=userId,proto3,oneof" json:"userId,omitempty"` //userId @@ -625,9 +625,9 @@ func (*SearchWalletTransactionsReq) Descriptor() ([]byte, []int) { return file_wallet_proto_rawDescGZIP(), []int{9} } -func (x *SearchWalletTransactionsReq) GetPage() int64 { +func (x *SearchWalletTransactionsReq) GetOffset() int64 { if x != nil { - return x.Page + return x.Offset } return 0 } @@ -1209,7 +1209,7 @@ func (x *GetWalletsByIdResp) GetWallets() *Wallets { type SearchWalletsReq struct { state protoimpl.MessageState `protogen:"open.v1"` - Page int64 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"` //page + Offset int64 `protobuf:"varint,1,opt,name=offset,proto3" json:"offset,omitempty"` //offset Limit int64 `protobuf:"varint,2,opt,name=limit,proto3" json:"limit,omitempty"` //limit UserId int64 `protobuf:"varint,3,opt,name=userId,proto3" json:"userId,omitempty"` //userId Balance *string `protobuf:"bytes,4,opt,name=balance,proto3,oneof" json:"balance,omitempty"` //balance @@ -1249,9 +1249,9 @@ func (*SearchWalletsReq) Descriptor() ([]byte, []int) { return file_wallet_proto_rawDescGZIP(), []int{20} } -func (x *SearchWalletsReq) GetPage() int64 { +func (x *SearchWalletsReq) GetOffset() int64 { if x != nil { - return x.Page + return x.Offset } return 0 } @@ -1393,9 +1393,9 @@ const file_wallet_proto_rawDesc = "" + "\x1cGetWalletTransactionsByIdReq\x12\x0e\n" + "\x02id\x18\x01 \x01(\x03R\x02id\"g\n" + "\x1dGetWalletTransactionsByIdResp\x12F\n" + - "\x12walletTransactions\x18\x01 \x01(\v2\x16.pb.WalletTransactionsR\x12walletTransactions\"\xca\x03\n" + - "\x1bSearchWalletTransactionsReq\x12\x12\n" + - "\x04page\x18\x01 \x01(\x03R\x04page\x12\x14\n" + + "\x12walletTransactions\x18\x01 \x01(\v2\x16.pb.WalletTransactionsR\x12walletTransactions\"\xce\x03\n" + + "\x1bSearchWalletTransactionsReq\x12\x16\n" + + "\x06offset\x18\x01 \x01(\x03R\x06offset\x12\x14\n" + "\x05limit\x18\x02 \x01(\x03R\x05limit\x12\x0e\n" + "\x02id\x18\x03 \x01(\x03R\x02id\x12\x1b\n" + "\x06userId\x18\x04 \x01(\x03H\x00R\x06userId\x88\x01\x01\x12\x17\n" + @@ -1453,9 +1453,9 @@ const file_wallet_proto_rawDesc = "" + "\x11GetWalletsByIdReq\x12\x0e\n" + "\x02id\x18\x01 \x01(\x03R\x02id\";\n" + "\x12GetWalletsByIdResp\x12%\n" + - "\awallets\x18\x01 \x01(\v2\v.pb.WalletsR\awallets\"\xed\x01\n" + - "\x10SearchWalletsReq\x12\x12\n" + - "\x04page\x18\x01 \x01(\x03R\x04page\x12\x14\n" + + "\awallets\x18\x01 \x01(\v2\v.pb.WalletsR\awallets\"\xf1\x01\n" + + "\x10SearchWalletsReq\x12\x16\n" + + "\x06offset\x18\x01 \x01(\x03R\x06offset\x12\x14\n" + "\x05limit\x18\x02 \x01(\x03R\x05limit\x12\x16\n" + "\x06userId\x18\x03 \x01(\x03R\x06userId\x12\x1d\n" + "\abalance\x18\x04 \x01(\tH\x00R\abalance\x88\x01\x01\x12)\n" + diff --git a/desc/rpc/community.proto b/desc/rpc/community.proto index 5716531..f40eb07 100644 --- a/desc/rpc/community.proto +++ b/desc/rpc/community.proto @@ -50,7 +50,7 @@ message GetCommentLikesByIdResp { } message SearchCommentLikesReq { - int64 page = 1; //page + int64 offset = 1; //offset int64 limit = 2; //limit int64 commentId = 3; //commentId int64 userId = 4; //userId @@ -113,7 +113,7 @@ message GetCommentsByIdResp { } message SearchCommentsReq { - int64 page = 1; //page + int64 offset = 1; //offset int64 limit = 2; //limit int64 id = 3; //id int64 postId = 4; //postId @@ -170,7 +170,7 @@ message GetPostLikesByIdResp { } message SearchPostLikesReq { - int64 page = 1; //page + int64 offset = 1; //offset int64 limit = 2; //limit optional int64 postId = 3; //postId optional int64 userId = 4; //userId @@ -260,7 +260,7 @@ message GetPostsByIdResp { } message SearchPostsReq { - int64 page = 1; //page + int64 offset = 1; //offset int64 limit = 2; //limit int64 id = 3; //id optional int64 authorId = 4; //authorId diff --git a/desc/rpc/game.proto b/desc/rpc/game.proto index 49ff060..603151a 100644 --- a/desc/rpc/game.proto +++ b/desc/rpc/game.proto @@ -64,7 +64,7 @@ message GetGamesByIdResp { } message SearchGamesReq { - int64 page = 1; //page + int64 offset = 1; //offset int64 limit = 2; //limit int64 id = 3; //id optional string name = 4; //name diff --git a/desc/rpc/order.proto b/desc/rpc/order.proto index b1dda2a..21ae8f6 100644 --- a/desc/rpc/order.proto +++ b/desc/rpc/order.proto @@ -92,7 +92,7 @@ message GetOrdersByIdResp { } message SearchOrdersReq { - int64 page = 1; //page + int64 offset = 1; //offset int64 limit = 2; //limit optional int64 id = 3; //id optional int64 consumerId = 4; //consumerId @@ -176,7 +176,7 @@ message GetOrderStateLogsByIdResp { } message SearchOrderStateLogsReq { - int64 page = 1; //page + int64 offset = 1; //offset int64 limit = 2; //limit optional int64 id = 3; //id optional int64 orderId = 4; //orderId diff --git a/desc/rpc/player.proto b/desc/rpc/player.proto index 5ed0949..821d146 100644 --- a/desc/rpc/player.proto +++ b/desc/rpc/player.proto @@ -79,7 +79,7 @@ message GetPlayerServicesByIdResp { } message SearchPlayerServicesReq { - int64 page = 1; //page + int64 offset = 1; //offset int64 limit = 2; //limit int64 id = 3; //id int64 playerId = 4; //playerId @@ -167,7 +167,7 @@ message GetPlayersByIdResp { } message SearchPlayersReq { - optional int64 page = 1; //page + optional int64 offset = 1; //offset optional int64 limit = 2; //limit optional int64 id = 3; //id optional int64 userId = 4; //userId diff --git a/desc/rpc/shop.proto b/desc/rpc/shop.proto index d58ee3f..a7f14d9 100644 --- a/desc/rpc/shop.proto +++ b/desc/rpc/shop.proto @@ -61,7 +61,7 @@ message GetShopInvitationsByIdResp { } message SearchShopInvitationsReq { - int64 page = 1; //page + int64 offset = 1; //offset int64 limit = 2; //limit int64 id = 3; //id int64 shopId = 4; //shopId @@ -125,7 +125,7 @@ message GetShopPlayersByIdResp { } message SearchShopPlayersReq { - int64 page = 1; //page + int64 offset = 1; //offset int64 limit = 2; //limit int64 shopId = 3; //shopId int64 playerId = 4; //playerId @@ -220,7 +220,7 @@ message GetShopsByIdResp { } message SearchShopsReq { - int64 page = 1; //page + int64 offset = 1; //offset int64 limit = 2; //limit int64 id = 3; //id int64 ownerId = 4; //ownerId diff --git a/desc/rpc/user_verifications.proto b/desc/rpc/user_verifications.proto index 81d09cc..b14400d 100644 --- a/desc/rpc/user_verifications.proto +++ b/desc/rpc/user_verifications.proto @@ -69,7 +69,7 @@ message GetUserVerificationsByIdResp { } message SearchUserVerificationsReq { - int64 page = 1; //page + int64 offset = 1; //offset int64 limit = 2; //limit int64 id = 3; //id int64 userId = 4; //userId diff --git a/desc/rpc/users.proto b/desc/rpc/users.proto index 39c7372..8109b92 100644 --- a/desc/rpc/users.proto +++ b/desc/rpc/users.proto @@ -85,7 +85,7 @@ message GetUsersByIdResp { } message SearchUsersReq { - optional int64 page = 1; //page + optional int64 offset = 1; //offset optional int64 limit = 2; //limit optional int64 id = 3; //id optional string username = 4; //username @@ -236,7 +236,7 @@ message GetUserFollowsByIdResp { } message SearchUserFollowsReq { - int64 page = 1; //page + int64 offset = 1; //offset int64 limit = 2; //limit int64 id = 3; //id int64 followerId = 4; //followerId @@ -301,7 +301,7 @@ message GetUserPreferencesByIdResp { } message SearchUserPreferencesReq { - int64 page = 1; //page + int64 offset = 1; //offset int64 limit = 2; //limit int64 userId = 3; //userId bool notificationOrder = 4; //notificationOrder diff --git a/desc/rpc/wallet.proto b/desc/rpc/wallet.proto index cd62766..c2473cc 100644 --- a/desc/rpc/wallet.proto +++ b/desc/rpc/wallet.proto @@ -66,7 +66,7 @@ message GetWalletTransactionsByIdResp { } message SearchWalletTransactionsReq { - int64 page = 1; //page + int64 offset = 1; //offset int64 limit = 2; //limit int64 id = 3; //id optional int64 userId = 4; //userId @@ -129,7 +129,7 @@ message GetWalletsByIdResp { } message SearchWalletsReq { - int64 page = 1; //page + int64 offset = 1; //offset int64 limit = 2; //limit int64 userId = 3; //userId optional string balance = 4; //balance