diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 57417fd..1b5652f 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -13,7 +13,7 @@ // Use this environment variable if you need to bind mount your local source code into a new container. "remoteEnv": { "LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}", - "PROTOBUF_VERSION": "21.5" + "PROTOBUF_VERSION": "3.20.1" }, // Configure tool-specific properties. "customizations": { diff --git a/Cargo.toml b/Cargo.toml index dc4f313..d4c645c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,8 +11,8 @@ path = "./src/lib.rs" [dependencies] -prost = "0.10" +prost = "0" [build-dependencies] -prost-build = "0.10" once_cell = "1" +prost-build = "0" diff --git a/build.rs b/build.rs index a0494c2..e8fea12 100644 --- a/build.rs +++ b/build.rs @@ -42,12 +42,14 @@ static TARGETS: Lazy>> = Lazy::new(|| { "./proto/models/member_permission.proto", "./proto/models/member_role.proto", "./proto/models/member_session.proto", + "./proto/models/member_referrer.proto", "./proto/models/member.proto", "./proto/models/resource_action.proto", "./proto/models/resource.proto", "./proto/models/role.proto", "./proto/models/site.proto", "./proto/models/api/vendor.proto", + "./proto/models/api/game.proto", ], ); @@ -61,10 +63,12 @@ static TARGETS: Lazy>> = Lazy::new(|| { "./proto/c2se/member_bank_withdraw.proto", "./proto/c2se/member_class.proto", "./proto/c2se/member_level.proto", + "./proto/c2se/member_referrer.proto", "./proto/c2se/member.proto", "./proto/c2se/site.proto", "./proto/c2se/core/network.proto", "./proto/c2se/api/vendor.proto", + "./proto/c2se/api/game.proto", "./proto/c2se/backend/bank.proto", "./proto/c2se/backend/identity.proto", "./proto/c2se/backend/member_bank_account.proto", @@ -72,9 +76,11 @@ static TARGETS: Lazy>> = Lazy::new(|| { "./proto/c2se/backend/member_bank_withdraw.proto", "./proto/c2se/backend/member_class.proto", "./proto/c2se/backend/member_level.proto", + "./proto/c2se/backend/member_referrer.proto", "./proto/c2se/backend/member.proto", "./proto/c2se/backend/site.proto", "./proto/c2se/backend/api/vendor.proto", + "./proto/c2se/backend/api/game.proto", "./proto/c2se/frontend/bank.proto", "./proto/c2se/frontend/identity.proto", ], @@ -90,9 +96,11 @@ static TARGETS: Lazy>> = Lazy::new(|| { "./proto/ss/member_bank_withdraw.proto", "./proto/ss/member_class.proto", "./proto/ss/member_level.proto", + "./proto/ss/member_referrer.proto", "./proto/ss/member.proto", "./proto/ss/site.proto", "./proto/ss/api/vendor.proto", + "./proto/ss/api/game.proto", ], ); diff --git a/proto/c2se/api/game.proto b/proto/c2se/api/game.proto new file mode 100644 index 0000000..f058cd2 --- /dev/null +++ b/proto/c2se/api/game.proto @@ -0,0 +1,30 @@ +syntax = "proto3"; + +package bet.beteran.c2se.api.game; + +import "protobuf/rpc.proto"; +import "protobuf/pagination.proto"; +import "models/core/network.proto"; + +import "models/api/game.proto"; + +message ListGamesRequest { + message Search { + optional uint64 vendor_id = 1; + optional string key_like = 2; + optional string platform_like = 3; + optional string category_like = 4; + optional string game_type_like = 5; + } + optional bet.protobuf.pagination.Pagination pagination = 1; + repeated bet.protobuf.pagination.Sort sorts = 2; + optional Search search = 3; +} + +message ListGamesResponse { + message Result { + repeated bet.beteran.api.game.Game games = 1; + } + optional bet.protobuf.rpc.Error error = 1; + optional Result result = 2; +} diff --git a/proto/c2se/backend/api/game.proto b/proto/c2se/backend/api/game.proto new file mode 100644 index 0000000..d78550f --- /dev/null +++ b/proto/c2se/backend/api/game.proto @@ -0,0 +1,5 @@ +syntax = "proto3"; + +package bet.beteran.c2se.backend.api.game; + +// subject = bet.beteran.c2se.backend.api.game.ListGames diff --git a/proto/c2se/backend/member_referrer.proto b/proto/c2se/backend/member_referrer.proto new file mode 100644 index 0000000..9ae533b --- /dev/null +++ b/proto/c2se/backend/member_referrer.proto @@ -0,0 +1,9 @@ +syntax = "proto3"; + +package bet.beteran.c2se.backend.member_referrer; + +// subject = bet.beteran.c2se.backend.member_referrer.CreateMemberReferrer +// subject = bet.beteran.c2se.backend.member_referrer.ListMemberReferrers +// subject = bet.beteran.c2se.backend.member_referrer.GetMemberReferrer +// subject = bet.beteran.c2se.backend.member_referrer.UpdateMemberReferrer +// subject = bet.beteran.c2se.backend.member_referrer.DeleteMemberReferrer diff --git a/proto/c2se/member.proto b/proto/c2se/member.proto index 5621e9f..f404ef3 100644 --- a/proto/c2se/member.proto +++ b/proto/c2se/member.proto @@ -38,7 +38,7 @@ message ListMembersRequest { optional string site_id = 1; optional string member_class_id = 2; optional string member_level_id = 3; - optional string referrer_member_id = 4; + optional string parent_member_id = 4; optional string username_like = 5; optional string nickname_like = 6; optional string mobile_phone_number_like = 7; diff --git a/proto/c2se/member_referrer.proto b/proto/c2se/member_referrer.proto new file mode 100644 index 0000000..743389c --- /dev/null +++ b/proto/c2se/member_referrer.proto @@ -0,0 +1,75 @@ +syntax = "proto3"; + +package bet.beteran.c2se.member_referrer; + +import "protobuf/rpc.proto"; +import "protobuf/pagination.proto"; +import "models/member_referrer.proto"; + +message CreateMemberReferrerRequest { + string member_id = 1; +} + +message CreateMemberReferrerResponse { + message Result { + bet.beteran.member_referrer.MemberReferrer member_referrer = 1; + } + optional bet.protobuf.rpc.Error error = 1; + optional Result result = 2; +} + +message ListMemberReferrersRequest { + message Search { + optional string member_id = 1; + optional bool can_use = 2; + optional string memo_like = 3; + } + optional bet.protobuf.pagination.Pagination pagination = 1; + repeated bet.protobuf.pagination.Sort sorts = 2; + optional Search search = 3; +} + +message ListMemberReferrersResponse { + message Result { + repeated bet.beteran.member_referrer.MemberReferrerModel member_referrers = 1; + } + optional bet.protobuf.rpc.Error error = 1; + optional Result result = 2; +} + +message GetMemberReferrerRequest { + string id = 1; +} + +message GetMemberReferrerResponse { + message Result { + bet.beteran.member_referrer.MemberReferrerModel member_referrer = 1; + } + optional bet.protobuf.rpc.Error error = 1; + optional Result result = 2; +} + +message UpdateMemberReferrerRequest { + string id = 1; + bool can_use = 2; + optional string memo = 3; +} + +message UpdateMemberReferrerResponse { + message Result { + bet.beteran.member_referrer.MemberReferrerModel member_referrer = 1; + } + optional bet.protobuf.rpc.Error error = 1; + optional Result result = 2; +} + +message DeleteMemberReferrerRequest { + string id = 1; +} + +message DeleteMemberReferrerResponse { + message Result { + } + optional bet.protobuf.rpc.Error error = 1; + optional Result result = 2; +} diff --git a/proto/models/api/game.proto b/proto/models/api/game.proto new file mode 100644 index 0000000..b6bc753 --- /dev/null +++ b/proto/models/api/game.proto @@ -0,0 +1,16 @@ +syntax = "proto3"; + +package bet.beteran.api.game; + +message Game { + uint64 id = 1; + uint64 vendor_id = 2; + string key = 3; + string names = 4; + string platform = 5; + string category = 6; + string game_type = 7; + optional string image = 8; + uint64 created_at = 9; + uint64 updated_at = 10; +} diff --git a/proto/models/member.proto b/proto/models/member.proto index fbf07f0..c50f4bb 100644 --- a/proto/models/member.proto +++ b/proto/models/member.proto @@ -24,8 +24,8 @@ message Member { string site_id = 2; string member_class_id = 3; string member_level_id = 4; - optional string referrer_member_id = 5; - uint64 referred_count = 6; + optional string parent_member_id = 5; + uint64 child_member_count = 6; string username = 7; string nickname = 8; optional string mobile_phone_number = 9; @@ -44,8 +44,8 @@ message MemberModel { bet.beteran.member_class.MemberClass member_class = 3; bet.beteran.member_level.MemberLevel member_level = 4; optional bet.beteran.member_bank_account.MemberBankAccountModel bank_account = 5; - optional Member referrer_member = 6; - uint64 referred_count = 7; + optional Member parent_member = 6; + uint64 child_member_count = 7; string username = 8; string nickname = 9; optional string mobile_phone_number = 10; diff --git a/proto/models/member_referrer.proto b/proto/models/member_referrer.proto new file mode 100644 index 0000000..080f015 --- /dev/null +++ b/proto/models/member_referrer.proto @@ -0,0 +1,23 @@ +syntax = "proto3"; + +package bet.beteran.member_referrer; + +import "models/member.proto"; + +message MemberReferrer { + string id = 1; + string member_id = 2; + bool can_use = 3; + optional string memo = 4; + uint64 created_at = 5; + uint64 updated_at = 6; +} + +message MemberReferrerModel { + string id = 1; + bet.beteran.member.Member member = 2; + bool can_use = 3; + optional string memo = 4; + uint64 created_at = 5; + uint64 updated_at = 6; +} diff --git a/proto/ss/api/game.proto b/proto/ss/api/game.proto new file mode 100644 index 0000000..c713847 --- /dev/null +++ b/proto/ss/api/game.proto @@ -0,0 +1,36 @@ +syntax = "proto3"; + +package bet.beteran.ss.api.game; + +import "protobuf/rpc.proto"; +import "protobuf/pagination.proto"; +import "models/core/network.proto"; + +import "models/api/game.proto"; + + +// subject = bet.beteran.ss.api.game.ListGames +message ListGamesRequest { + message Request { + message Search { + optional uint64 vendor_id = 1; + optional string key_like = 2; + optional string platform_like = 3; + optional string category_like = 4; + optional string game_type_like = 5; + } + optional bet.protobuf.pagination.Pagination pagination = 1; + repeated bet.protobuf.pagination.Sort sorts = 2; + optional Search search = 3; + } + bet.beteran.core.network.Client client = 1; + Request request = 2; +} + +message ListGamesResponse { + message Result { + repeated bet.beteran.api.game.Game games = 1; + } + optional bet.protobuf.rpc.Error error = 1; + optional Result result = 2; +} diff --git a/proto/ss/member.proto b/proto/ss/member.proto index 40c3b4b..305ff9f 100644 --- a/proto/ss/member.proto +++ b/proto/ss/member.proto @@ -2,10 +2,9 @@ syntax = "proto3"; package bet.beteran.ss.member; +import "models/core/network.proto"; import "protobuf/rpc.proto"; import "protobuf/pagination.proto"; -import "models/core/network.proto"; - import "models/member.proto"; // subject = bet.beteran.ss.member.CreateMember @@ -46,7 +45,7 @@ message ListMembersRequest { optional string site_id = 1; optional string member_class_id = 2; optional string member_level_id = 3; - optional string referrer_member_id = 4; + optional string parent_member_id = 4; optional string username_like = 5; optional string nickname_like = 6; optional string mobile_phone_number_like = 7; diff --git a/proto/ss/member_referrer.proto b/proto/ss/member_referrer.proto new file mode 100644 index 0000000..c6b1796 --- /dev/null +++ b/proto/ss/member_referrer.proto @@ -0,0 +1,102 @@ +syntax = "proto3"; + +package bet.beteran.ss.member_referrer; + +import "models/core/network.proto"; +import "protobuf/rpc.proto"; +import "protobuf/pagination.proto"; +import "models/member_referrer.proto"; + +// subject = bet.beteran.ss.member_referrer.CreateMemberReferrer +message CreateMemberReferrerRequest { + message Request { + string member_id = 1; + } + bet.beteran.core.network.Client client = 1; + Request request = 2; + +} + +message CreateMemberReferrerResponse { + message Result { + bet.beteran.member_referrer.MemberReferrer member_referrer = 1; + } + optional bet.protobuf.rpc.Error error = 1; + optional Result result = 2; +} + +// subject = bet.beteran.ss.member_referrer.ListMemberReferrers +message ListMemberReferrersRequest { + message Request { + message Search { + optional string member_id = 1; + optional bool can_use = 2; + optional string memo_like = 3; + } + optional bet.protobuf.pagination.Pagination pagination = 1; + repeated bet.protobuf.pagination.Sort sorts = 2; + optional Search search = 3; + } + bet.beteran.core.network.Client client = 1; + Request request = 2; +} + +message ListMemberReferrersResponse { + message Result { + repeated bet.beteran.member_referrer.MemberReferrerModel member_referrers = 1; + } + optional bet.protobuf.rpc.Error error = 1; + optional Result result = 2; +} + +// subject = bet.beteran.ss.member_referrer.GetMemberReferrer +message GetMemberReferrerRequest { + message Request { + string id = 1; + } + bet.beteran.core.network.Client client = 1; + Request request = 2; +} + +message GetMemberReferrerResponse { + message Result { + bet.beteran.member_referrer.MemberReferrerModel member_referrer = 1; + } + optional bet.protobuf.rpc.Error error = 1; + optional Result result = 2; +} + +// subject = bet.beteran.ss.member_referrer.UpdateMemberReferrer +message UpdateMemberReferrerRequest { + message Request { + string id = 1; + bool can_use = 2; + optional string memo = 3; + } + bet.beteran.core.network.Client client = 1; + Request request = 2; +} + +message UpdateMemberReferrerResponse { + message Result { + bet.beteran.member_referrer.MemberReferrerModel member_referrer = 1; + } + optional bet.protobuf.rpc.Error error = 1; + optional Result result = 2; +} + +// subject = bet.beteran.ss.member_referrer.DeleteMemberReferrer +message DeleteMemberReferrerRequest { + message Request { + string id = 1; + } + bet.beteran.core.network.Client client = 1; + Request request = 2; +} + +message DeleteMemberReferrerResponse { + message Result { + } + optional bet.protobuf.rpc.Error error = 1; + optional Result result = 2; +}