commit e513dc6ee703d581db0f69f6cfac3a0d9d338afb Author: xiabin Date: Wed Feb 5 18:45:49 2025 +0800 first commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..723ef36 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..a63781d --- /dev/null +++ b/README.md @@ -0,0 +1,8 @@ +1. 用户模块:user_management +2. 抖音ecpm计算模块:douyin_ecpm_calculation_service +3. 排行榜模块:ranking_management +4. 认证模块:auth_service + +```go +goctl rpc protoc auth_service.proto --go_out=. --go-grpc_out=. --zrpc_out=. --style=go_zero +``` \ No newline at end of file diff --git a/auth_service/auth_service.go b/auth_service/auth_service.go new file mode 100644 index 0000000..7532f3b --- /dev/null +++ b/auth_service/auth_service.go @@ -0,0 +1,39 @@ +package main + +import ( + "flag" + "fmt" + + "gitea.youtukeji.com.cn/xiabin/youtu_grpc/auth_service/auth_service" + "gitea.youtukeji.com.cn/xiabin/youtu_grpc/auth_service/internal/config" + "gitea.youtukeji.com.cn/xiabin/youtu_grpc/auth_service/internal/server" + "gitea.youtukeji.com.cn/xiabin/youtu_grpc/auth_service/internal/svc" + + "github.com/zeromicro/go-zero/core/conf" + "github.com/zeromicro/go-zero/core/service" + "github.com/zeromicro/go-zero/zrpc" + "google.golang.org/grpc" + "google.golang.org/grpc/reflection" +) + +var configFile = flag.String("f", "etc/auth_service.yaml", "the config file") + +func main() { + flag.Parse() + + var c config.Config + conf.MustLoad(*configFile, &c) + ctx := svc.NewServiceContext(c) + + s := zrpc.MustNewServer(c.RpcServerConf, func(grpcServer *grpc.Server) { + auth_service.RegisterAuthServiceServer(grpcServer, server.NewAuthServiceServer(ctx)) + + if c.Mode == service.DevMode || c.Mode == service.TestMode { + reflection.Register(grpcServer) + } + }) + defer s.Stop() + + fmt.Printf("Starting rpc server at %s...\n", c.ListenOn) + s.Start() +} diff --git a/auth_service/auth_service.proto b/auth_service/auth_service.proto new file mode 100644 index 0000000..dd7044a --- /dev/null +++ b/auth_service/auth_service.proto @@ -0,0 +1,40 @@ +syntax = "proto3"; + +package auth_service; +option go_package = "./auth_service"; + +message Request { + string ping = 1; +} + +message Response { + string pong = 1; +} + +message Code2SessionRequest{ + string AppId = 1; + string Code = 2; +} + +message Code2SessionResponse{ + string OpenId = 1; + string UnionId = 2; +} + +message GetAccessTokenRequest{ + string AppId = 1; +} + +message GetAccessTokenResponse{ + string Access = 1; +} + + + +service auth_service { + rpc Ping(Request) returns(Response); + + rpc Code2Session(Code2SessionRequest) returns(Code2SessionResponse); + + rpc GetAccessToken(GetAccessTokenRequest) returns(GetAccessTokenResponse); +} diff --git a/auth_service/auth_service/auth_service.pb.go b/auth_service/auth_service/auth_service.pb.go new file mode 100644 index 0000000..eb28022 --- /dev/null +++ b/auth_service/auth_service/auth_service.pb.go @@ -0,0 +1,405 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.4 +// protoc v3.19.4 +// source: auth_service.proto + +package auth_service + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type Request struct { + state protoimpl.MessageState `protogen:"open.v1"` + Ping string `protobuf:"bytes,1,opt,name=ping,proto3" json:"ping,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Request) Reset() { + *x = Request{} + mi := &file_auth_service_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Request) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Request) ProtoMessage() {} + +func (x *Request) ProtoReflect() protoreflect.Message { + mi := &file_auth_service_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Request.ProtoReflect.Descriptor instead. +func (*Request) Descriptor() ([]byte, []int) { + return file_auth_service_proto_rawDescGZIP(), []int{0} +} + +func (x *Request) GetPing() string { + if x != nil { + return x.Ping + } + return "" +} + +type Response struct { + state protoimpl.MessageState `protogen:"open.v1"` + Pong string `protobuf:"bytes,1,opt,name=pong,proto3" json:"pong,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Response) Reset() { + *x = Response{} + mi := &file_auth_service_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Response) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Response) ProtoMessage() {} + +func (x *Response) ProtoReflect() protoreflect.Message { + mi := &file_auth_service_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Response.ProtoReflect.Descriptor instead. +func (*Response) Descriptor() ([]byte, []int) { + return file_auth_service_proto_rawDescGZIP(), []int{1} +} + +func (x *Response) GetPong() string { + if x != nil { + return x.Pong + } + return "" +} + +type Code2SessionRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + AppId string `protobuf:"bytes,1,opt,name=AppId,proto3" json:"AppId,omitempty"` + Code string `protobuf:"bytes,2,opt,name=Code,proto3" json:"Code,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Code2SessionRequest) Reset() { + *x = Code2SessionRequest{} + mi := &file_auth_service_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Code2SessionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Code2SessionRequest) ProtoMessage() {} + +func (x *Code2SessionRequest) ProtoReflect() protoreflect.Message { + mi := &file_auth_service_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Code2SessionRequest.ProtoReflect.Descriptor instead. +func (*Code2SessionRequest) Descriptor() ([]byte, []int) { + return file_auth_service_proto_rawDescGZIP(), []int{2} +} + +func (x *Code2SessionRequest) GetAppId() string { + if x != nil { + return x.AppId + } + return "" +} + +func (x *Code2SessionRequest) GetCode() string { + if x != nil { + return x.Code + } + return "" +} + +type Code2SessionResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + OpenId string `protobuf:"bytes,1,opt,name=OpenId,proto3" json:"OpenId,omitempty"` + UnionId string `protobuf:"bytes,2,opt,name=UnionId,proto3" json:"UnionId,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Code2SessionResponse) Reset() { + *x = Code2SessionResponse{} + mi := &file_auth_service_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Code2SessionResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Code2SessionResponse) ProtoMessage() {} + +func (x *Code2SessionResponse) ProtoReflect() protoreflect.Message { + mi := &file_auth_service_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Code2SessionResponse.ProtoReflect.Descriptor instead. +func (*Code2SessionResponse) Descriptor() ([]byte, []int) { + return file_auth_service_proto_rawDescGZIP(), []int{3} +} + +func (x *Code2SessionResponse) GetOpenId() string { + if x != nil { + return x.OpenId + } + return "" +} + +func (x *Code2SessionResponse) GetUnionId() string { + if x != nil { + return x.UnionId + } + return "" +} + +type GetAccessTokenRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + AppId string `protobuf:"bytes,1,opt,name=AppId,proto3" json:"AppId,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetAccessTokenRequest) Reset() { + *x = GetAccessTokenRequest{} + mi := &file_auth_service_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetAccessTokenRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetAccessTokenRequest) ProtoMessage() {} + +func (x *GetAccessTokenRequest) ProtoReflect() protoreflect.Message { + mi := &file_auth_service_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetAccessTokenRequest.ProtoReflect.Descriptor instead. +func (*GetAccessTokenRequest) Descriptor() ([]byte, []int) { + return file_auth_service_proto_rawDescGZIP(), []int{4} +} + +func (x *GetAccessTokenRequest) GetAppId() string { + if x != nil { + return x.AppId + } + return "" +} + +type GetAccessTokenResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Access string `protobuf:"bytes,1,opt,name=Access,proto3" json:"Access,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetAccessTokenResponse) Reset() { + *x = GetAccessTokenResponse{} + mi := &file_auth_service_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetAccessTokenResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetAccessTokenResponse) ProtoMessage() {} + +func (x *GetAccessTokenResponse) ProtoReflect() protoreflect.Message { + mi := &file_auth_service_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetAccessTokenResponse.ProtoReflect.Descriptor instead. +func (*GetAccessTokenResponse) Descriptor() ([]byte, []int) { + return file_auth_service_proto_rawDescGZIP(), []int{5} +} + +func (x *GetAccessTokenResponse) GetAccess() string { + if x != nil { + return x.Access + } + return "" +} + +var File_auth_service_proto protoreflect.FileDescriptor + +var file_auth_service_proto_rawDesc = string([]byte{ + 0x0a, 0x12, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x22, 0x1d, 0x0a, 0x07, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, + 0x04, 0x70, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x69, 0x6e, + 0x67, 0x22, 0x1e, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, + 0x04, 0x70, 0x6f, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x6f, 0x6e, + 0x67, 0x22, 0x3f, 0x0a, 0x13, 0x43, 0x6f, 0x64, 0x65, 0x32, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x41, 0x70, 0x70, 0x49, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x41, 0x70, 0x70, 0x49, 0x64, 0x12, 0x12, + 0x0a, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x43, 0x6f, + 0x64, 0x65, 0x22, 0x48, 0x0a, 0x14, 0x43, 0x6f, 0x64, 0x65, 0x32, 0x53, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x4f, 0x70, + 0x65, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x4f, 0x70, 0x65, 0x6e, + 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x55, 0x6e, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x07, 0x55, 0x6e, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x22, 0x2d, 0x0a, 0x15, + 0x47, 0x65, 0x74, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x41, 0x70, 0x70, 0x49, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x41, 0x70, 0x70, 0x49, 0x64, 0x22, 0x30, 0x0a, 0x16, 0x47, + 0x65, 0x74, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x32, 0xf9, 0x01, + 0x0a, 0x0c, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x35, + 0x0a, 0x04, 0x50, 0x69, 0x6e, 0x67, 0x12, 0x15, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, + 0x61, 0x75, 0x74, 0x68, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x55, 0x0a, 0x0c, 0x43, 0x6f, 0x64, 0x65, 0x32, 0x53, 0x65, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x21, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x2e, 0x43, 0x6f, 0x64, 0x65, 0x32, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x5f, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x43, 0x6f, 0x64, 0x65, 0x32, 0x53, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5b, 0x0a, 0x0e, + 0x47, 0x65, 0x74, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x23, + 0x2e, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x47, 0x65, + 0x74, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, + 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x10, 0x5a, 0x0e, 0x2e, 0x2f, 0x61, + 0x75, 0x74, 0x68, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, +}) + +var ( + file_auth_service_proto_rawDescOnce sync.Once + file_auth_service_proto_rawDescData []byte +) + +func file_auth_service_proto_rawDescGZIP() []byte { + file_auth_service_proto_rawDescOnce.Do(func() { + file_auth_service_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_auth_service_proto_rawDesc), len(file_auth_service_proto_rawDesc))) + }) + return file_auth_service_proto_rawDescData +} + +var file_auth_service_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_auth_service_proto_goTypes = []any{ + (*Request)(nil), // 0: auth_service.Request + (*Response)(nil), // 1: auth_service.Response + (*Code2SessionRequest)(nil), // 2: auth_service.Code2SessionRequest + (*Code2SessionResponse)(nil), // 3: auth_service.Code2SessionResponse + (*GetAccessTokenRequest)(nil), // 4: auth_service.GetAccessTokenRequest + (*GetAccessTokenResponse)(nil), // 5: auth_service.GetAccessTokenResponse +} +var file_auth_service_proto_depIdxs = []int32{ + 0, // 0: auth_service.auth_service.Ping:input_type -> auth_service.Request + 2, // 1: auth_service.auth_service.Code2Session:input_type -> auth_service.Code2SessionRequest + 4, // 2: auth_service.auth_service.GetAccessToken:input_type -> auth_service.GetAccessTokenRequest + 1, // 3: auth_service.auth_service.Ping:output_type -> auth_service.Response + 3, // 4: auth_service.auth_service.Code2Session:output_type -> auth_service.Code2SessionResponse + 5, // 5: auth_service.auth_service.GetAccessToken:output_type -> auth_service.GetAccessTokenResponse + 3, // [3:6] is the sub-list for method output_type + 0, // [0:3] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_auth_service_proto_init() } +func file_auth_service_proto_init() { + if File_auth_service_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_auth_service_proto_rawDesc), len(file_auth_service_proto_rawDesc)), + NumEnums: 0, + NumMessages: 6, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_auth_service_proto_goTypes, + DependencyIndexes: file_auth_service_proto_depIdxs, + MessageInfos: file_auth_service_proto_msgTypes, + }.Build() + File_auth_service_proto = out.File + file_auth_service_proto_goTypes = nil + file_auth_service_proto_depIdxs = nil +} diff --git a/auth_service/auth_service/auth_service_grpc.pb.go b/auth_service/auth_service/auth_service_grpc.pb.go new file mode 100644 index 0000000..deff839 --- /dev/null +++ b/auth_service/auth_service/auth_service_grpc.pb.go @@ -0,0 +1,197 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.5.1 +// - protoc v3.19.4 +// source: auth_service.proto + +package auth_service + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 + +const ( + AuthService_Ping_FullMethodName = "/auth_service.auth_service/Ping" + AuthService_Code2Session_FullMethodName = "/auth_service.auth_service/Code2Session" + AuthService_GetAccessToken_FullMethodName = "/auth_service.auth_service/GetAccessToken" +) + +// AuthServiceClient is the client API for AuthService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type AuthServiceClient interface { + Ping(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) + Code2Session(ctx context.Context, in *Code2SessionRequest, opts ...grpc.CallOption) (*Code2SessionResponse, error) + GetAccessToken(ctx context.Context, in *GetAccessTokenRequest, opts ...grpc.CallOption) (*GetAccessTokenResponse, error) +} + +type authServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewAuthServiceClient(cc grpc.ClientConnInterface) AuthServiceClient { + return &authServiceClient{cc} +} + +func (c *authServiceClient) Ping(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(Response) + err := c.cc.Invoke(ctx, AuthService_Ping_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *authServiceClient) Code2Session(ctx context.Context, in *Code2SessionRequest, opts ...grpc.CallOption) (*Code2SessionResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(Code2SessionResponse) + err := c.cc.Invoke(ctx, AuthService_Code2Session_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *authServiceClient) GetAccessToken(ctx context.Context, in *GetAccessTokenRequest, opts ...grpc.CallOption) (*GetAccessTokenResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetAccessTokenResponse) + err := c.cc.Invoke(ctx, AuthService_GetAccessToken_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// AuthServiceServer is the server API for AuthService service. +// All implementations must embed UnimplementedAuthServiceServer +// for forward compatibility. +type AuthServiceServer interface { + Ping(context.Context, *Request) (*Response, error) + Code2Session(context.Context, *Code2SessionRequest) (*Code2SessionResponse, error) + GetAccessToken(context.Context, *GetAccessTokenRequest) (*GetAccessTokenResponse, error) + mustEmbedUnimplementedAuthServiceServer() +} + +// UnimplementedAuthServiceServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedAuthServiceServer struct{} + +func (UnimplementedAuthServiceServer) Ping(context.Context, *Request) (*Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method Ping not implemented") +} +func (UnimplementedAuthServiceServer) Code2Session(context.Context, *Code2SessionRequest) (*Code2SessionResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Code2Session not implemented") +} +func (UnimplementedAuthServiceServer) GetAccessToken(context.Context, *GetAccessTokenRequest) (*GetAccessTokenResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetAccessToken not implemented") +} +func (UnimplementedAuthServiceServer) mustEmbedUnimplementedAuthServiceServer() {} +func (UnimplementedAuthServiceServer) testEmbeddedByValue() {} + +// UnsafeAuthServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to AuthServiceServer will +// result in compilation errors. +type UnsafeAuthServiceServer interface { + mustEmbedUnimplementedAuthServiceServer() +} + +func RegisterAuthServiceServer(s grpc.ServiceRegistrar, srv AuthServiceServer) { + // If the following call pancis, it indicates UnimplementedAuthServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&AuthService_ServiceDesc, srv) +} + +func _AuthService_Ping_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthServiceServer).Ping(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AuthService_Ping_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthServiceServer).Ping(ctx, req.(*Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _AuthService_Code2Session_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(Code2SessionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthServiceServer).Code2Session(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AuthService_Code2Session_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthServiceServer).Code2Session(ctx, req.(*Code2SessionRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AuthService_GetAccessToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetAccessTokenRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthServiceServer).GetAccessToken(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AuthService_GetAccessToken_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthServiceServer).GetAccessToken(ctx, req.(*GetAccessTokenRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// AuthService_ServiceDesc is the grpc.ServiceDesc for AuthService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var AuthService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "auth_service.auth_service", + HandlerType: (*AuthServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Ping", + Handler: _AuthService_Ping_Handler, + }, + { + MethodName: "Code2Session", + Handler: _AuthService_Code2Session_Handler, + }, + { + MethodName: "GetAccessToken", + Handler: _AuthService_GetAccessToken_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "auth_service.proto", +} diff --git a/auth_service/auth_service_client/auth_service.go b/auth_service/auth_service_client/auth_service.go new file mode 100644 index 0000000..77a5e38 --- /dev/null +++ b/auth_service/auth_service_client/auth_service.go @@ -0,0 +1,54 @@ +// Code generated by goctl. DO NOT EDIT. +// goctl 1.7.6 +// Source: auth_service.proto + +package auth_service_client + +import ( + "context" + + "gitea.youtukeji.com.cn/xiabin/youtu_grpc/auth_service/auth_service" + + "github.com/zeromicro/go-zero/zrpc" + "google.golang.org/grpc" +) + +type ( + Code2SessionRequest = auth_service.Code2SessionRequest + Code2SessionResponse = auth_service.Code2SessionResponse + GetAccessTokenRequest = auth_service.GetAccessTokenRequest + GetAccessTokenResponse = auth_service.GetAccessTokenResponse + Request = auth_service.Request + Response = auth_service.Response + + AuthService interface { + Ping(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) + Code2Session(ctx context.Context, in *Code2SessionRequest, opts ...grpc.CallOption) (*Code2SessionResponse, error) + GetAccessToken(ctx context.Context, in *GetAccessTokenRequest, opts ...grpc.CallOption) (*GetAccessTokenResponse, error) + } + + defaultAuthService struct { + cli zrpc.Client + } +) + +func NewAuthService(cli zrpc.Client) AuthService { + return &defaultAuthService{ + cli: cli, + } +} + +func (m *defaultAuthService) Ping(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) { + client := auth_service.NewAuthServiceClient(m.cli.Conn()) + return client.Ping(ctx, in, opts...) +} + +func (m *defaultAuthService) Code2Session(ctx context.Context, in *Code2SessionRequest, opts ...grpc.CallOption) (*Code2SessionResponse, error) { + client := auth_service.NewAuthServiceClient(m.cli.Conn()) + return client.Code2Session(ctx, in, opts...) +} + +func (m *defaultAuthService) GetAccessToken(ctx context.Context, in *GetAccessTokenRequest, opts ...grpc.CallOption) (*GetAccessTokenResponse, error) { + client := auth_service.NewAuthServiceClient(m.cli.Conn()) + return client.GetAccessToken(ctx, in, opts...) +} diff --git a/auth_service/etc/auth_service.yaml b/auth_service/etc/auth_service.yaml new file mode 100644 index 0000000..c53c3ea --- /dev/null +++ b/auth_service/etc/auth_service.yaml @@ -0,0 +1,6 @@ +Name: auth_service.rpc +ListenOn: 0.0.0.0:8080 +Etcd: + Hosts: + - 127.0.0.1:2379 + Key: auth_service.rpc diff --git a/auth_service/internal/config/config.go b/auth_service/internal/config/config.go new file mode 100644 index 0000000..c1f85b9 --- /dev/null +++ b/auth_service/internal/config/config.go @@ -0,0 +1,7 @@ +package config + +import "github.com/zeromicro/go-zero/zrpc" + +type Config struct { + zrpc.RpcServerConf +} diff --git a/auth_service/internal/logic/code2_session_logic.go b/auth_service/internal/logic/code2_session_logic.go new file mode 100644 index 0000000..073f668 --- /dev/null +++ b/auth_service/internal/logic/code2_session_logic.go @@ -0,0 +1,30 @@ +package logic + +import ( + "context" + + "gitea.youtukeji.com.cn/xiabin/youtu_grpc/auth_service/auth_service" + "gitea.youtukeji.com.cn/xiabin/youtu_grpc/auth_service/internal/svc" + + "github.com/zeromicro/go-zero/core/logx" +) + +type Code2SessionLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewCode2SessionLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Code2SessionLogic { + return &Code2SessionLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *Code2SessionLogic) Code2Session(in *auth_service.Code2SessionRequest) (*auth_service.Code2SessionResponse, error) { + // todo: add your logic here and delete this line + + return &auth_service.Code2SessionResponse{}, nil +} diff --git a/auth_service/internal/logic/get_access_token_logic.go b/auth_service/internal/logic/get_access_token_logic.go new file mode 100644 index 0000000..e145118 --- /dev/null +++ b/auth_service/internal/logic/get_access_token_logic.go @@ -0,0 +1,30 @@ +package logic + +import ( + "context" + + "gitea.youtukeji.com.cn/xiabin/youtu_grpc/auth_service/auth_service" + "gitea.youtukeji.com.cn/xiabin/youtu_grpc/auth_service/internal/svc" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GetAccessTokenLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewGetAccessTokenLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetAccessTokenLogic { + return &GetAccessTokenLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *GetAccessTokenLogic) GetAccessToken(in *auth_service.GetAccessTokenRequest) (*auth_service.GetAccessTokenResponse, error) { + // todo: add your logic here and delete this line + + return &auth_service.GetAccessTokenResponse{}, nil +} diff --git a/auth_service/internal/logic/ping_logic.go b/auth_service/internal/logic/ping_logic.go new file mode 100644 index 0000000..bfcb162 --- /dev/null +++ b/auth_service/internal/logic/ping_logic.go @@ -0,0 +1,30 @@ +package logic + +import ( + "context" + + "gitea.youtukeji.com.cn/xiabin/youtu_grpc/auth_service/auth_service" + "gitea.youtukeji.com.cn/xiabin/youtu_grpc/auth_service/internal/svc" + + "github.com/zeromicro/go-zero/core/logx" +) + +type PingLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewPingLogic(ctx context.Context, svcCtx *svc.ServiceContext) *PingLogic { + return &PingLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *PingLogic) Ping(in *auth_service.Request) (*auth_service.Response, error) { + // todo: add your logic here and delete this line + + return &auth_service.Response{}, nil +} diff --git a/auth_service/internal/server/auth_service_server.go b/auth_service/internal/server/auth_service_server.go new file mode 100644 index 0000000..7173606 --- /dev/null +++ b/auth_service/internal/server/auth_service_server.go @@ -0,0 +1,39 @@ +// Code generated by goctl. DO NOT EDIT. +// goctl 1.7.6 +// Source: auth_service.proto + +package server + +import ( + "context" + + "gitea.youtukeji.com.cn/xiabin/youtu_grpc/auth_service/auth_service" + "gitea.youtukeji.com.cn/xiabin/youtu_grpc/auth_service/internal/logic" + "gitea.youtukeji.com.cn/xiabin/youtu_grpc/auth_service/internal/svc" +) + +type AuthServiceServer struct { + svcCtx *svc.ServiceContext + auth_service.UnimplementedAuthServiceServer +} + +func NewAuthServiceServer(svcCtx *svc.ServiceContext) *AuthServiceServer { + return &AuthServiceServer{ + svcCtx: svcCtx, + } +} + +func (s *AuthServiceServer) Ping(ctx context.Context, in *auth_service.Request) (*auth_service.Response, error) { + l := logic.NewPingLogic(ctx, s.svcCtx) + return l.Ping(in) +} + +func (s *AuthServiceServer) Code2Session(ctx context.Context, in *auth_service.Code2SessionRequest) (*auth_service.Code2SessionResponse, error) { + l := logic.NewCode2SessionLogic(ctx, s.svcCtx) + return l.Code2Session(in) +} + +func (s *AuthServiceServer) GetAccessToken(ctx context.Context, in *auth_service.GetAccessTokenRequest) (*auth_service.GetAccessTokenResponse, error) { + l := logic.NewGetAccessTokenLogic(ctx, s.svcCtx) + return l.GetAccessToken(in) +} diff --git a/auth_service/internal/svc/service_context.go b/auth_service/internal/svc/service_context.go new file mode 100644 index 0000000..82ca498 --- /dev/null +++ b/auth_service/internal/svc/service_context.go @@ -0,0 +1,13 @@ +package svc + +import "gitea.youtukeji.com.cn/xiabin/youtu_grpc/auth_service/internal/config" + +type ServiceContext struct { + Config config.Config +} + +func NewServiceContext(c config.Config) *ServiceContext { + return &ServiceContext{ + Config: c, + } +} diff --git a/douyin_ecpm_calculation_service/douyin_ecpm_calculation_service.go b/douyin_ecpm_calculation_service/douyin_ecpm_calculation_service.go new file mode 100644 index 0000000..6c66465 --- /dev/null +++ b/douyin_ecpm_calculation_service/douyin_ecpm_calculation_service.go @@ -0,0 +1,39 @@ +package main + +import ( + "flag" + "fmt" + + "gitea.youtukeji.com.cn/xiabin/youtu_grpc/douyin_ecpm_calculation_service/douyin_ecpm_calculation_service" + "gitea.youtukeji.com.cn/xiabin/youtu_grpc/douyin_ecpm_calculation_service/internal/config" + "gitea.youtukeji.com.cn/xiabin/youtu_grpc/douyin_ecpm_calculation_service/internal/server" + "gitea.youtukeji.com.cn/xiabin/youtu_grpc/douyin_ecpm_calculation_service/internal/svc" + + "github.com/zeromicro/go-zero/core/conf" + "github.com/zeromicro/go-zero/core/service" + "github.com/zeromicro/go-zero/zrpc" + "google.golang.org/grpc" + "google.golang.org/grpc/reflection" +) + +var configFile = flag.String("f", "etc/douyin_ecpm_calculation_service.yaml", "the config file") + +func main() { + flag.Parse() + + var c config.Config + conf.MustLoad(*configFile, &c) + ctx := svc.NewServiceContext(c) + + s := zrpc.MustNewServer(c.RpcServerConf, func(grpcServer *grpc.Server) { + douyin_ecpm_calculation_service.RegisterDouyinEcpmCalculationServiceServer(grpcServer, server.NewDouyinEcpmCalculationServiceServer(ctx)) + + if c.Mode == service.DevMode || c.Mode == service.TestMode { + reflection.Register(grpcServer) + } + }) + defer s.Stop() + + fmt.Printf("Starting rpc server at %s...\n", c.ListenOn) + s.Start() +} diff --git a/douyin_ecpm_calculation_service/douyin_ecpm_calculation_service.proto b/douyin_ecpm_calculation_service/douyin_ecpm_calculation_service.proto new file mode 100644 index 0000000..b6c0620 --- /dev/null +++ b/douyin_ecpm_calculation_service/douyin_ecpm_calculation_service.proto @@ -0,0 +1,28 @@ +syntax = "proto3"; + +package douyin_ecpm_calculation_service; +option go_package="./douyin_ecpm_calculation_service"; + +message Request { + string ping = 1; +} + +message Response { + string pong = 1; +} + +message GetEcpmRequest{ + string appId =1; + string openId=2; +} + +message GetEcpmResponse{ + bool ok =1; +} + +service douyin_ecpm_calculation_service { + + rpc Ping(Request) returns(Response); + + rpc GetEcpm(GetEcpmRequest) returns(GetEcpmResponse); +} diff --git a/douyin_ecpm_calculation_service/douyin_ecpm_calculation_service/douyin_ecpm_calculation_service.pb.go b/douyin_ecpm_calculation_service/douyin_ecpm_calculation_service/douyin_ecpm_calculation_service.pb.go new file mode 100644 index 0000000..49e8555 --- /dev/null +++ b/douyin_ecpm_calculation_service/douyin_ecpm_calculation_service/douyin_ecpm_calculation_service.pb.go @@ -0,0 +1,299 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.4 +// protoc v3.19.4 +// source: douyin_ecpm_calculation_service.proto + +package douyin_ecpm_calculation_service + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type Request struct { + state protoimpl.MessageState `protogen:"open.v1"` + Ping string `protobuf:"bytes,1,opt,name=ping,proto3" json:"ping,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Request) Reset() { + *x = Request{} + mi := &file_douyin_ecpm_calculation_service_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Request) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Request) ProtoMessage() {} + +func (x *Request) ProtoReflect() protoreflect.Message { + mi := &file_douyin_ecpm_calculation_service_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Request.ProtoReflect.Descriptor instead. +func (*Request) Descriptor() ([]byte, []int) { + return file_douyin_ecpm_calculation_service_proto_rawDescGZIP(), []int{0} +} + +func (x *Request) GetPing() string { + if x != nil { + return x.Ping + } + return "" +} + +type Response struct { + state protoimpl.MessageState `protogen:"open.v1"` + Pong string `protobuf:"bytes,1,opt,name=pong,proto3" json:"pong,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Response) Reset() { + *x = Response{} + mi := &file_douyin_ecpm_calculation_service_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Response) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Response) ProtoMessage() {} + +func (x *Response) ProtoReflect() protoreflect.Message { + mi := &file_douyin_ecpm_calculation_service_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Response.ProtoReflect.Descriptor instead. +func (*Response) Descriptor() ([]byte, []int) { + return file_douyin_ecpm_calculation_service_proto_rawDescGZIP(), []int{1} +} + +func (x *Response) GetPong() string { + if x != nil { + return x.Pong + } + return "" +} + +type GetEcpmRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + AppId string `protobuf:"bytes,1,opt,name=appId,proto3" json:"appId,omitempty"` + OpenId string `protobuf:"bytes,2,opt,name=openId,proto3" json:"openId,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetEcpmRequest) Reset() { + *x = GetEcpmRequest{} + mi := &file_douyin_ecpm_calculation_service_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetEcpmRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetEcpmRequest) ProtoMessage() {} + +func (x *GetEcpmRequest) ProtoReflect() protoreflect.Message { + mi := &file_douyin_ecpm_calculation_service_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetEcpmRequest.ProtoReflect.Descriptor instead. +func (*GetEcpmRequest) Descriptor() ([]byte, []int) { + return file_douyin_ecpm_calculation_service_proto_rawDescGZIP(), []int{2} +} + +func (x *GetEcpmRequest) GetAppId() string { + if x != nil { + return x.AppId + } + return "" +} + +func (x *GetEcpmRequest) GetOpenId() string { + if x != nil { + return x.OpenId + } + return "" +} + +type GetEcpmResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Ok bool `protobuf:"varint,1,opt,name=ok,proto3" json:"ok,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetEcpmResponse) Reset() { + *x = GetEcpmResponse{} + mi := &file_douyin_ecpm_calculation_service_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetEcpmResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetEcpmResponse) ProtoMessage() {} + +func (x *GetEcpmResponse) ProtoReflect() protoreflect.Message { + mi := &file_douyin_ecpm_calculation_service_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetEcpmResponse.ProtoReflect.Descriptor instead. +func (*GetEcpmResponse) Descriptor() ([]byte, []int) { + return file_douyin_ecpm_calculation_service_proto_rawDescGZIP(), []int{3} +} + +func (x *GetEcpmResponse) GetOk() bool { + if x != nil { + return x.Ok + } + return false +} + +var File_douyin_ecpm_calculation_service_proto protoreflect.FileDescriptor + +var file_douyin_ecpm_calculation_service_proto_rawDesc = string([]byte{ + 0x0a, 0x25, 0x64, 0x6f, 0x75, 0x79, 0x69, 0x6e, 0x5f, 0x65, 0x63, 0x70, 0x6d, 0x5f, 0x63, 0x61, + 0x6c, 0x63, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1f, 0x64, 0x6f, 0x75, 0x79, 0x69, 0x6e, 0x5f, + 0x65, 0x63, 0x70, 0x6d, 0x5f, 0x63, 0x61, 0x6c, 0x63, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x22, 0x1d, 0x0a, 0x07, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x70, 0x69, 0x6e, 0x67, 0x22, 0x1e, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x6f, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x70, 0x6f, 0x6e, 0x67, 0x22, 0x3e, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x45, 0x63, + 0x70, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x70, 0x70, + 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x61, 0x70, 0x70, 0x49, 0x64, 0x12, + 0x16, 0x0a, 0x06, 0x6f, 0x70, 0x65, 0x6e, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x06, 0x6f, 0x70, 0x65, 0x6e, 0x49, 0x64, 0x22, 0x21, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x45, 0x63, + 0x70, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x6f, 0x6b, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x02, 0x6f, 0x6b, 0x32, 0xec, 0x01, 0x0a, 0x1f, 0x64, + 0x6f, 0x75, 0x79, 0x69, 0x6e, 0x5f, 0x65, 0x63, 0x70, 0x6d, 0x5f, 0x63, 0x61, 0x6c, 0x63, 0x75, + 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x5b, + 0x0a, 0x04, 0x50, 0x69, 0x6e, 0x67, 0x12, 0x28, 0x2e, 0x64, 0x6f, 0x75, 0x79, 0x69, 0x6e, 0x5f, + 0x65, 0x63, 0x70, 0x6d, 0x5f, 0x63, 0x61, 0x6c, 0x63, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x29, 0x2e, 0x64, 0x6f, 0x75, 0x79, 0x69, 0x6e, 0x5f, 0x65, 0x63, 0x70, 0x6d, 0x5f, 0x63, + 0x61, 0x6c, 0x63, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x6c, 0x0a, 0x07, 0x47, + 0x65, 0x74, 0x45, 0x63, 0x70, 0x6d, 0x12, 0x2f, 0x2e, 0x64, 0x6f, 0x75, 0x79, 0x69, 0x6e, 0x5f, + 0x65, 0x63, 0x70, 0x6d, 0x5f, 0x63, 0x61, 0x6c, 0x63, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x45, 0x63, 0x70, 0x6d, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 0x2e, 0x64, 0x6f, 0x75, 0x79, 0x69, 0x6e, + 0x5f, 0x65, 0x63, 0x70, 0x6d, 0x5f, 0x63, 0x61, 0x6c, 0x63, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x45, 0x63, 0x70, + 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x23, 0x5a, 0x21, 0x2e, 0x2f, 0x64, + 0x6f, 0x75, 0x79, 0x69, 0x6e, 0x5f, 0x65, 0x63, 0x70, 0x6d, 0x5f, 0x63, 0x61, 0x6c, 0x63, 0x75, + 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +}) + +var ( + file_douyin_ecpm_calculation_service_proto_rawDescOnce sync.Once + file_douyin_ecpm_calculation_service_proto_rawDescData []byte +) + +func file_douyin_ecpm_calculation_service_proto_rawDescGZIP() []byte { + file_douyin_ecpm_calculation_service_proto_rawDescOnce.Do(func() { + file_douyin_ecpm_calculation_service_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_douyin_ecpm_calculation_service_proto_rawDesc), len(file_douyin_ecpm_calculation_service_proto_rawDesc))) + }) + return file_douyin_ecpm_calculation_service_proto_rawDescData +} + +var file_douyin_ecpm_calculation_service_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_douyin_ecpm_calculation_service_proto_goTypes = []any{ + (*Request)(nil), // 0: douyin_ecpm_calculation_service.Request + (*Response)(nil), // 1: douyin_ecpm_calculation_service.Response + (*GetEcpmRequest)(nil), // 2: douyin_ecpm_calculation_service.GetEcpmRequest + (*GetEcpmResponse)(nil), // 3: douyin_ecpm_calculation_service.GetEcpmResponse +} +var file_douyin_ecpm_calculation_service_proto_depIdxs = []int32{ + 0, // 0: douyin_ecpm_calculation_service.douyin_ecpm_calculation_service.Ping:input_type -> douyin_ecpm_calculation_service.Request + 2, // 1: douyin_ecpm_calculation_service.douyin_ecpm_calculation_service.GetEcpm:input_type -> douyin_ecpm_calculation_service.GetEcpmRequest + 1, // 2: douyin_ecpm_calculation_service.douyin_ecpm_calculation_service.Ping:output_type -> douyin_ecpm_calculation_service.Response + 3, // 3: douyin_ecpm_calculation_service.douyin_ecpm_calculation_service.GetEcpm:output_type -> douyin_ecpm_calculation_service.GetEcpmResponse + 2, // [2:4] is the sub-list for method output_type + 0, // [0:2] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_douyin_ecpm_calculation_service_proto_init() } +func file_douyin_ecpm_calculation_service_proto_init() { + if File_douyin_ecpm_calculation_service_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_douyin_ecpm_calculation_service_proto_rawDesc), len(file_douyin_ecpm_calculation_service_proto_rawDesc)), + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_douyin_ecpm_calculation_service_proto_goTypes, + DependencyIndexes: file_douyin_ecpm_calculation_service_proto_depIdxs, + MessageInfos: file_douyin_ecpm_calculation_service_proto_msgTypes, + }.Build() + File_douyin_ecpm_calculation_service_proto = out.File + file_douyin_ecpm_calculation_service_proto_goTypes = nil + file_douyin_ecpm_calculation_service_proto_depIdxs = nil +} diff --git a/douyin_ecpm_calculation_service/douyin_ecpm_calculation_service/douyin_ecpm_calculation_service_grpc.pb.go b/douyin_ecpm_calculation_service/douyin_ecpm_calculation_service/douyin_ecpm_calculation_service_grpc.pb.go new file mode 100644 index 0000000..4cd363b --- /dev/null +++ b/douyin_ecpm_calculation_service/douyin_ecpm_calculation_service/douyin_ecpm_calculation_service_grpc.pb.go @@ -0,0 +1,160 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.5.1 +// - protoc v3.19.4 +// source: douyin_ecpm_calculation_service.proto + +package douyin_ecpm_calculation_service + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 + +const ( + DouyinEcpmCalculationService_Ping_FullMethodName = "/douyin_ecpm_calculation_service.douyin_ecpm_calculation_service/Ping" + DouyinEcpmCalculationService_GetEcpm_FullMethodName = "/douyin_ecpm_calculation_service.douyin_ecpm_calculation_service/GetEcpm" +) + +// DouyinEcpmCalculationServiceClient is the client API for DouyinEcpmCalculationService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type DouyinEcpmCalculationServiceClient interface { + Ping(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) + GetEcpm(ctx context.Context, in *GetEcpmRequest, opts ...grpc.CallOption) (*GetEcpmResponse, error) +} + +type douyinEcpmCalculationServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewDouyinEcpmCalculationServiceClient(cc grpc.ClientConnInterface) DouyinEcpmCalculationServiceClient { + return &douyinEcpmCalculationServiceClient{cc} +} + +func (c *douyinEcpmCalculationServiceClient) Ping(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(Response) + err := c.cc.Invoke(ctx, DouyinEcpmCalculationService_Ping_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *douyinEcpmCalculationServiceClient) GetEcpm(ctx context.Context, in *GetEcpmRequest, opts ...grpc.CallOption) (*GetEcpmResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetEcpmResponse) + err := c.cc.Invoke(ctx, DouyinEcpmCalculationService_GetEcpm_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// DouyinEcpmCalculationServiceServer is the server API for DouyinEcpmCalculationService service. +// All implementations must embed UnimplementedDouyinEcpmCalculationServiceServer +// for forward compatibility. +type DouyinEcpmCalculationServiceServer interface { + Ping(context.Context, *Request) (*Response, error) + GetEcpm(context.Context, *GetEcpmRequest) (*GetEcpmResponse, error) + mustEmbedUnimplementedDouyinEcpmCalculationServiceServer() +} + +// UnimplementedDouyinEcpmCalculationServiceServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedDouyinEcpmCalculationServiceServer struct{} + +func (UnimplementedDouyinEcpmCalculationServiceServer) Ping(context.Context, *Request) (*Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method Ping not implemented") +} +func (UnimplementedDouyinEcpmCalculationServiceServer) GetEcpm(context.Context, *GetEcpmRequest) (*GetEcpmResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetEcpm not implemented") +} +func (UnimplementedDouyinEcpmCalculationServiceServer) mustEmbedUnimplementedDouyinEcpmCalculationServiceServer() { +} +func (UnimplementedDouyinEcpmCalculationServiceServer) testEmbeddedByValue() {} + +// UnsafeDouyinEcpmCalculationServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to DouyinEcpmCalculationServiceServer will +// result in compilation errors. +type UnsafeDouyinEcpmCalculationServiceServer interface { + mustEmbedUnimplementedDouyinEcpmCalculationServiceServer() +} + +func RegisterDouyinEcpmCalculationServiceServer(s grpc.ServiceRegistrar, srv DouyinEcpmCalculationServiceServer) { + // If the following call pancis, it indicates UnimplementedDouyinEcpmCalculationServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&DouyinEcpmCalculationService_ServiceDesc, srv) +} + +func _DouyinEcpmCalculationService_Ping_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DouyinEcpmCalculationServiceServer).Ping(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: DouyinEcpmCalculationService_Ping_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DouyinEcpmCalculationServiceServer).Ping(ctx, req.(*Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _DouyinEcpmCalculationService_GetEcpm_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetEcpmRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DouyinEcpmCalculationServiceServer).GetEcpm(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: DouyinEcpmCalculationService_GetEcpm_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DouyinEcpmCalculationServiceServer).GetEcpm(ctx, req.(*GetEcpmRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// DouyinEcpmCalculationService_ServiceDesc is the grpc.ServiceDesc for DouyinEcpmCalculationService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var DouyinEcpmCalculationService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "douyin_ecpm_calculation_service.douyin_ecpm_calculation_service", + HandlerType: (*DouyinEcpmCalculationServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Ping", + Handler: _DouyinEcpmCalculationService_Ping_Handler, + }, + { + MethodName: "GetEcpm", + Handler: _DouyinEcpmCalculationService_GetEcpm_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "douyin_ecpm_calculation_service.proto", +} diff --git a/douyin_ecpm_calculation_service/douyin_ecpm_calculation_service_client/douyin_ecpm_calculation_service.go b/douyin_ecpm_calculation_service/douyin_ecpm_calculation_service_client/douyin_ecpm_calculation_service.go new file mode 100644 index 0000000..fe04068 --- /dev/null +++ b/douyin_ecpm_calculation_service/douyin_ecpm_calculation_service_client/douyin_ecpm_calculation_service.go @@ -0,0 +1,46 @@ +// Code generated by goctl. DO NOT EDIT. +// goctl 1.7.6 +// Source: douyin_ecpm_calculation_service.proto + +package douyin_ecpm_calculation_service_client + +import ( + "context" + + "gitea.youtukeji.com.cn/xiabin/youtu_grpc/douyin_ecpm_calculation_service/douyin_ecpm_calculation_service" + + "github.com/zeromicro/go-zero/zrpc" + "google.golang.org/grpc" +) + +type ( + GetEcpmRequest = douyin_ecpm_calculation_service.GetEcpmRequest + GetEcpmResponse = douyin_ecpm_calculation_service.GetEcpmResponse + Request = douyin_ecpm_calculation_service.Request + Response = douyin_ecpm_calculation_service.Response + + DouyinEcpmCalculationService interface { + Ping(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) + GetEcpm(ctx context.Context, in *GetEcpmRequest, opts ...grpc.CallOption) (*GetEcpmResponse, error) + } + + defaultDouyinEcpmCalculationService struct { + cli zrpc.Client + } +) + +func NewDouyinEcpmCalculationService(cli zrpc.Client) DouyinEcpmCalculationService { + return &defaultDouyinEcpmCalculationService{ + cli: cli, + } +} + +func (m *defaultDouyinEcpmCalculationService) Ping(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) { + client := douyin_ecpm_calculation_service.NewDouyinEcpmCalculationServiceClient(m.cli.Conn()) + return client.Ping(ctx, in, opts...) +} + +func (m *defaultDouyinEcpmCalculationService) GetEcpm(ctx context.Context, in *GetEcpmRequest, opts ...grpc.CallOption) (*GetEcpmResponse, error) { + client := douyin_ecpm_calculation_service.NewDouyinEcpmCalculationServiceClient(m.cli.Conn()) + return client.GetEcpm(ctx, in, opts...) +} diff --git a/douyin_ecpm_calculation_service/etc/douyin_ecpm_calculation_service.yaml b/douyin_ecpm_calculation_service/etc/douyin_ecpm_calculation_service.yaml new file mode 100644 index 0000000..e4b5aaa --- /dev/null +++ b/douyin_ecpm_calculation_service/etc/douyin_ecpm_calculation_service.yaml @@ -0,0 +1,6 @@ +Name: douyinecpmcalculationservice.rpc +ListenOn: 0.0.0.0:8080 +Etcd: + Hosts: + - 127.0.0.1:2379 + Key: douyinecpmcalculationservice.rpc diff --git a/douyin_ecpm_calculation_service/internal/config/config.go b/douyin_ecpm_calculation_service/internal/config/config.go new file mode 100644 index 0000000..c1f85b9 --- /dev/null +++ b/douyin_ecpm_calculation_service/internal/config/config.go @@ -0,0 +1,7 @@ +package config + +import "github.com/zeromicro/go-zero/zrpc" + +type Config struct { + zrpc.RpcServerConf +} diff --git a/douyin_ecpm_calculation_service/internal/logic/get_ecpm_logic.go b/douyin_ecpm_calculation_service/internal/logic/get_ecpm_logic.go new file mode 100644 index 0000000..204f82d --- /dev/null +++ b/douyin_ecpm_calculation_service/internal/logic/get_ecpm_logic.go @@ -0,0 +1,30 @@ +package logic + +import ( + "context" + + "gitea.youtukeji.com.cn/xiabin/youtu_grpc/douyin_ecpm_calculation_service/douyin_ecpm_calculation_service" + "gitea.youtukeji.com.cn/xiabin/youtu_grpc/douyin_ecpm_calculation_service/internal/svc" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GetEcpmLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewGetEcpmLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetEcpmLogic { + return &GetEcpmLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *GetEcpmLogic) GetEcpm(in *douyin_ecpm_calculation_service.GetEcpmRequest) (*douyin_ecpm_calculation_service.GetEcpmResponse, error) { + // todo: add your logic here and delete this line + + return &douyin_ecpm_calculation_service.GetEcpmResponse{}, nil +} diff --git a/douyin_ecpm_calculation_service/internal/logic/ping_logic.go b/douyin_ecpm_calculation_service/internal/logic/ping_logic.go new file mode 100644 index 0000000..57d2c32 --- /dev/null +++ b/douyin_ecpm_calculation_service/internal/logic/ping_logic.go @@ -0,0 +1,30 @@ +package logic + +import ( + "context" + + "gitea.youtukeji.com.cn/xiabin/youtu_grpc/douyin_ecpm_calculation_service/douyin_ecpm_calculation_service" + "gitea.youtukeji.com.cn/xiabin/youtu_grpc/douyin_ecpm_calculation_service/internal/svc" + + "github.com/zeromicro/go-zero/core/logx" +) + +type PingLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewPingLogic(ctx context.Context, svcCtx *svc.ServiceContext) *PingLogic { + return &PingLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *PingLogic) Ping(in *douyin_ecpm_calculation_service.Request) (*douyin_ecpm_calculation_service.Response, error) { + // todo: add your logic here and delete this line + + return &douyin_ecpm_calculation_service.Response{}, nil +} diff --git a/douyin_ecpm_calculation_service/internal/server/douyin_ecpm_calculation_service_server.go b/douyin_ecpm_calculation_service/internal/server/douyin_ecpm_calculation_service_server.go new file mode 100644 index 0000000..074731f --- /dev/null +++ b/douyin_ecpm_calculation_service/internal/server/douyin_ecpm_calculation_service_server.go @@ -0,0 +1,34 @@ +// Code generated by goctl. DO NOT EDIT. +// goctl 1.7.6 +// Source: douyin_ecpm_calculation_service.proto + +package server + +import ( + "context" + + "gitea.youtukeji.com.cn/xiabin/youtu_grpc/douyin_ecpm_calculation_service/douyin_ecpm_calculation_service" + "gitea.youtukeji.com.cn/xiabin/youtu_grpc/douyin_ecpm_calculation_service/internal/logic" + "gitea.youtukeji.com.cn/xiabin/youtu_grpc/douyin_ecpm_calculation_service/internal/svc" +) + +type DouyinEcpmCalculationServiceServer struct { + svcCtx *svc.ServiceContext + douyin_ecpm_calculation_service.UnimplementedDouyinEcpmCalculationServiceServer +} + +func NewDouyinEcpmCalculationServiceServer(svcCtx *svc.ServiceContext) *DouyinEcpmCalculationServiceServer { + return &DouyinEcpmCalculationServiceServer{ + svcCtx: svcCtx, + } +} + +func (s *DouyinEcpmCalculationServiceServer) Ping(ctx context.Context, in *douyin_ecpm_calculation_service.Request) (*douyin_ecpm_calculation_service.Response, error) { + l := logic.NewPingLogic(ctx, s.svcCtx) + return l.Ping(in) +} + +func (s *DouyinEcpmCalculationServiceServer) GetEcpm(ctx context.Context, in *douyin_ecpm_calculation_service.GetEcpmRequest) (*douyin_ecpm_calculation_service.GetEcpmResponse, error) { + l := logic.NewGetEcpmLogic(ctx, s.svcCtx) + return l.GetEcpm(in) +} diff --git a/douyin_ecpm_calculation_service/internal/svc/service_context.go b/douyin_ecpm_calculation_service/internal/svc/service_context.go new file mode 100644 index 0000000..4768d0c --- /dev/null +++ b/douyin_ecpm_calculation_service/internal/svc/service_context.go @@ -0,0 +1,13 @@ +package svc + +import "gitea.youtukeji.com.cn/xiabin/youtu_grpc/douyin_ecpm_calculation_service/internal/config" + +type ServiceContext struct { + Config config.Config +} + +func NewServiceContext(c config.Config) *ServiceContext { + return &ServiceContext{ + Config: c, + } +} diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..fd32437 --- /dev/null +++ b/go.mod @@ -0,0 +1,89 @@ +module gitea.youtukeji.com.cn/xiabin/youtu_grpc + +go 1.23 + +require ( + github.com/zeromicro/go-zero v1.8.0 + google.golang.org/grpc v1.70.0 + google.golang.org/protobuf v1.36.4 +) + +require ( + github.com/beorn7/perks v1.0.1 // indirect + github.com/cenkalti/backoff/v4 v4.3.0 // indirect + github.com/cespare/xxhash/v2 v2.3.0 // indirect + github.com/coreos/go-semver v0.3.1 // indirect + github.com/coreos/go-systemd/v22 v22.5.0 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect + github.com/emicklei/go-restful/v3 v3.11.0 // indirect + github.com/fatih/color v1.18.0 // indirect + github.com/go-logr/logr v1.4.2 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/go-openapi/jsonpointer v0.19.6 // indirect + github.com/go-openapi/jsonreference v0.20.2 // indirect + github.com/go-openapi/swag v0.22.4 // indirect + github.com/gogo/protobuf v1.3.2 // indirect + github.com/golang/mock v1.6.0 // indirect + github.com/golang/protobuf v1.5.4 // indirect + github.com/google/gnostic-models v0.6.8 // indirect + github.com/google/go-cmp v0.6.0 // indirect + github.com/google/gofuzz v1.2.0 // indirect + github.com/google/uuid v1.6.0 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect + github.com/josharian/intern v1.0.0 // indirect + github.com/json-iterator/go v1.1.12 // indirect + github.com/klauspost/compress v1.17.9 // indirect + github.com/mailru/easyjson v0.7.7 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect + github.com/openzipkin/zipkin-go v0.4.3 // indirect + github.com/pelletier/go-toml/v2 v2.2.2 // indirect + github.com/prometheus/client_golang v1.20.5 // indirect + github.com/prometheus/client_model v0.6.1 // indirect + github.com/prometheus/common v0.55.0 // indirect + github.com/prometheus/procfs v0.15.1 // indirect + github.com/redis/go-redis/v9 v9.7.0 // indirect + github.com/spaolacci/murmur3 v1.1.0 // indirect + go.etcd.io/etcd/api/v3 v3.5.15 // indirect + go.etcd.io/etcd/client/pkg/v3 v3.5.15 // indirect + go.etcd.io/etcd/client/v3 v3.5.15 // indirect + go.opentelemetry.io/otel v1.32.0 // indirect + go.opentelemetry.io/otel/exporters/jaeger v1.17.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.24.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.24.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.24.0 // indirect + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.24.0 // indirect + go.opentelemetry.io/otel/exporters/zipkin v1.24.0 // indirect + go.opentelemetry.io/otel/metric v1.32.0 // indirect + go.opentelemetry.io/otel/sdk v1.32.0 // indirect + go.opentelemetry.io/otel/trace v1.32.0 // indirect + go.opentelemetry.io/proto/otlp v1.3.1 // indirect + go.uber.org/atomic v1.10.0 // indirect + go.uber.org/automaxprocs v1.6.0 // indirect + go.uber.org/multierr v1.9.0 // indirect + go.uber.org/zap v1.24.0 // indirect + golang.org/x/net v0.34.0 // indirect + golang.org/x/oauth2 v0.24.0 // indirect + golang.org/x/sys v0.29.0 // indirect + golang.org/x/term v0.28.0 // indirect + golang.org/x/text v0.21.0 // indirect + golang.org/x/time v0.9.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20241202173237-19429a94021a // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20241202173237-19429a94021a // indirect + gopkg.in/inf.v0 v0.9.1 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect + k8s.io/api v0.29.3 // indirect + k8s.io/apimachinery v0.29.4 // indirect + k8s.io/client-go v0.29.3 // indirect + k8s.io/klog/v2 v2.110.1 // indirect + k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 // indirect + k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 // indirect + sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect + sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect + sigs.k8s.io/yaml v1.3.0 // indirect +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..08451c0 --- /dev/null +++ b/go.sum @@ -0,0 +1,277 @@ +github.com/alicebob/gopher-json v0.0.0-20230218143504-906a9b012302 h1:uvdUDbHQHO85qeSydJtItA4T55Pw6BtAejd0APRJOCE= +github.com/alicebob/gopher-json v0.0.0-20230218143504-906a9b012302/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc= +github.com/alicebob/miniredis/v2 v2.34.0 h1:mBFWMaJSNL9RwdGRyEDoAAv8OQc5UlEhLDQggTglU/0= +github.com/alicebob/miniredis/v2 v2.34.0/go.mod h1:kWShP4b58T1CW0Y5dViCd5ztzrDqRWqM3nksiyXk5s8= +github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= +github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= +github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= +github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs= +github.com/bsm/ginkgo/v2 v2.12.0/go.mod h1:SwYbGRRDovPVboqFv0tPTcG1sN61LM1Z4ARdbAV9g4c= +github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA= +github.com/bsm/gomega v1.27.10/go.mod h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0H+O0= +github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8= +github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= +github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= +github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/coreos/go-semver v0.3.1 h1:yi21YpKnrx1gt5R+la8n5WgS0kCrsPp33dmEyHReZr4= +github.com/coreos/go-semver v0.3.1/go.mod h1:irMmmIw/7yzSRPWryHsK7EYSg09caPQL03VsM8rvUec= +github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs= +github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= +github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= +github.com/emicklei/go-restful/v3 v3.11.0 h1:rAQeMHw1c7zTmncogyy8VvRZwtkmkZ4FxERmMY4rD+g= +github.com/emicklei/go-restful/v3 v3.11.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= +github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM= +github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= +github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/go-openapi/jsonpointer v0.19.6 h1:eCs3fxoIi3Wh6vtgmLTOjdhSpiqphQ+DaPn38N2ZdrE= +github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs= +github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE= +github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k= +github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= +github.com/go-openapi/swag v0.22.4 h1:QLMzNJnMGPRNDCbySlcj1x01tzU8/9LTTL9hZZZogBU= +github.com/go-openapi/swag v0.22.4/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= +github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= +github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= +github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= +github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= +github.com/google/gnostic-models v0.6.8 h1:yo/ABAfM5IMRsS1VnXjTBvUb61tFIHozhlYvRgGre9I= +github.com/google/gnostic-models v0.6.8/go.mod h1:5n7qKqH0f5wFt+aWF8CW6pZLLNOfYuF5OpfBSENuI8U= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= +github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 h1:K6RDEckDVWvDI9JAJYCmNdQXq6neHJOYx3V6jnqNEec= +github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 h1:bkypFPDjIYGfCYD5mRBvpqxfYX1YCS1PXdKYWi8FsN0= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0/go.mod h1:P+Lt/0by1T8bfcF3z737NnSbmxQAppXMRziHUxPOC8k= +github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542 h1:2VTzZjLZBgl62/EtslCrtky5vbi9dd7HrQPQIx6wqiw= +github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542/go.mod h1:Ow0tF8D4Kplbc8s8sSb3V2oUCygFHVp8gC3Dn6U4MNI= +github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= +github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= +github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= +github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= +github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= +github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= +github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= +github.com/onsi/ginkgo/v2 v2.13.0 h1:0jY9lJquiL8fcf3M4LAXN5aMlS/b2BV86HFFPCPMgE4= +github.com/onsi/ginkgo/v2 v2.13.0/go.mod h1:TE309ZR8s5FsKKpuB1YAQYBzCaAfUgatB/xlT/ETL/o= +github.com/onsi/gomega v1.29.0 h1:KIA/t2t5UBzoirT4H9tsML45GEbo3ouUnBHsCfD2tVg= +github.com/onsi/gomega v1.29.0/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ= +github.com/openzipkin/zipkin-go v0.4.3 h1:9EGwpqkgnwdEIJ+Od7QVSEIH+ocmm5nPat0G7sjsSdg= +github.com/openzipkin/zipkin-go v0.4.3/go.mod h1:M9wCJZFWCo2RiY+o1eBCEMe0Dp2S5LDHcMZmk3RmK7c= +github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= +github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prashantv/gostub v1.1.0 h1:BTyx3RfQjRHnUWaGF9oQos79AlQ5k8WNktv7VGvVH4g= +github.com/prashantv/gostub v1.1.0/go.mod h1:A5zLQHz7ieHGG7is6LLXLz7I8+3LZzsrV0P1IAHhP5U= +github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y= +github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= +github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= +github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= +github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc= +github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8= +github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= +github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= +github.com/redis/go-redis/v9 v9.7.0 h1:HhLSs+B6O021gwzl+locl0zEDnyNkxMtf/Z3NNBMa9E= +github.com/redis/go-redis/v9 v9.7.0/go.mod h1:f6zhXITC7JUJIlPEiBOTXxJgPLdZcA93GewI7inzyWw= +github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= +github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= +github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= +github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= +github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +github.com/yuin/gopher-lua v1.1.1 h1:kYKnWBjvbNP4XLT3+bPEwAXJx262OhaHDWDVOPjL46M= +github.com/yuin/gopher-lua v1.1.1/go.mod h1:GBR0iDaNXjAgGg9zfCvksxSRnQx76gclCIb7kdAd1Pw= +github.com/zeromicro/go-zero v1.8.0 h1:4g/8VW+fOyM51HZYPeI3mXIZdEX+Fl6SsdYX2H5PYw4= +github.com/zeromicro/go-zero v1.8.0/go.mod h1:xDBF+/iDzj30zPvu6HNUIbpz1J6+/g3Sx9D/DytJfss= +go.etcd.io/etcd/api/v3 v3.5.15 h1:3KpLJir1ZEBrYuV2v+Twaa/e2MdDCEZ/70H+lzEiwsk= +go.etcd.io/etcd/api/v3 v3.5.15/go.mod h1:N9EhGzXq58WuMllgH9ZvnEr7SI9pS0k0+DHZezGp7jM= +go.etcd.io/etcd/client/pkg/v3 v3.5.15 h1:fo0HpWz/KlHGMCC+YejpiCmyWDEuIpnTDzpJLB5fWlA= +go.etcd.io/etcd/client/pkg/v3 v3.5.15/go.mod h1:mXDI4NAOwEiszrHCb0aqfAYNCrZP4e9hRca3d1YK8EU= +go.etcd.io/etcd/client/v3 v3.5.15 h1:23M0eY4Fd/inNv1ZfU3AxrbbOdW79r9V9Rl62Nm6ip4= +go.etcd.io/etcd/client/v3 v3.5.15/go.mod h1:CLSJxrYjvLtHsrPKsy7LmZEE+DK2ktfd2bN4RhBMwlU= +go.opentelemetry.io/otel v1.32.0 h1:WnBN+Xjcteh0zdk01SVqV55d/m62NJLJdIyb4y/WO5U= +go.opentelemetry.io/otel v1.32.0/go.mod h1:00DCVSB0RQcnzlwyTfqtxSm+DRr9hpYrHjNGiBHVQIg= +go.opentelemetry.io/otel/exporters/jaeger v1.17.0 h1:D7UpUy2Xc2wsi1Ras6V40q806WM07rqoCWzXu7Sqy+4= +go.opentelemetry.io/otel/exporters/jaeger v1.17.0/go.mod h1:nPCqOnEH9rNLKqH/+rrUjiMzHJdV1BlpKcTwRTyKkKI= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.24.0 h1:t6wl9SPayj+c7lEIFgm4ooDBZVb01IhLB4InpomhRw8= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.24.0/go.mod h1:iSDOcsnSA5INXzZtwaBPrKp/lWu/V14Dd+llD0oI2EA= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.24.0 h1:Mw5xcxMwlqoJd97vwPxA8isEaIoxsta9/Q51+TTJLGE= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.24.0/go.mod h1:CQNu9bj7o7mC6U7+CA/schKEYakYXWr79ucDHTMGhCM= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.24.0 h1:Xw8U6u2f8DK2XAkGRFV7BBLENgnTGX9i4rQRxJf+/vs= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.24.0/go.mod h1:6KW1Fm6R/s6Z3PGXwSJN2K4eT6wQB3vXX6CVnYX9NmM= +go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.24.0 h1:s0PHtIkN+3xrbDOpt2M8OTG92cWqUESvzh2MxiR5xY8= +go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.24.0/go.mod h1:hZlFbDbRt++MMPCCfSJfmhkGIWnX1h3XjkfxZUjLrIA= +go.opentelemetry.io/otel/exporters/zipkin v1.24.0 h1:3evrL5poBuh1KF51D9gO/S+N/1msnm4DaBqs/rpXUqY= +go.opentelemetry.io/otel/exporters/zipkin v1.24.0/go.mod h1:0EHgD8R0+8yRhUYJOGR8Hfg2dpiJQxDOszd5smVO9wM= +go.opentelemetry.io/otel/metric v1.32.0 h1:xV2umtmNcThh2/a/aCP+h64Xx5wsj8qqnkYZktzNa0M= +go.opentelemetry.io/otel/metric v1.32.0/go.mod h1:jH7CIbbK6SH2V2wE16W05BHCtIDzauciCRLoc/SyMv8= +go.opentelemetry.io/otel/sdk v1.32.0 h1:RNxepc9vK59A8XsgZQouW8ue8Gkb4jpWtJm9ge5lEG4= +go.opentelemetry.io/otel/sdk v1.32.0/go.mod h1:LqgegDBjKMmb2GC6/PrTnteJG39I8/vJCAP9LlJXEjU= +go.opentelemetry.io/otel/sdk/metric v1.32.0 h1:rZvFnvmvawYb0alrYkjraqJq0Z4ZUJAiyYCU9snn1CU= +go.opentelemetry.io/otel/sdk/metric v1.32.0/go.mod h1:PWeZlq0zt9YkYAp3gjKZ0eicRYvOh1Gd+X99x6GHpCQ= +go.opentelemetry.io/otel/trace v1.32.0 h1:WIC9mYrXf8TmY/EXuULKc8hR17vE+Hjv2cssQDe03fM= +go.opentelemetry.io/otel/trace v1.32.0/go.mod h1:+i4rkvCraA+tG6AzwloGaCtkx53Fa+L+V8e9a7YvhT8= +go.opentelemetry.io/proto/otlp v1.3.1 h1:TrMUixzpM0yuc/znrFTP9MMRh8trP93mkCiDVeXrui0= +go.opentelemetry.io/proto/otlp v1.3.1/go.mod h1:0X1WI4de4ZsLrrJNLAQbFeLCm3T7yBkR0XqQ7niQU+8= +go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ= +go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= +go.uber.org/automaxprocs v1.6.0 h1:O3y2/QNTOdbF+e/dpXNNW7Rx2hZ4sTIPyybbxyNqTUs= +go.uber.org/automaxprocs v1.6.0/go.mod h1:ifeIMSnPZuznNm6jmdzmU3/bfk01Fe2fotchwEFJ8r8= +go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= +go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= +go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI= +go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ= +go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60= +go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/net v0.34.0 h1:Mb7Mrk043xzHgnRM88suvJFwzVrRfHEHJEl5/71CKw0= +golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k= +golang.org/x/oauth2 v0.24.0 h1:KTBBxWqUa0ykRPLtV69rRto9TLXcqYkeswu48x/gvNE= +golang.org/x/oauth2 v0.24.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU= +golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.28.0 h1:/Ts8HFuMR2E6IP/jlo7QVLZHggjKQbhu/7H0LJFr3Gg= +golang.org/x/term v0.28.0/go.mod h1:Sw/lC2IAUZ92udQNf3WodGtn4k/XoLyZoh8v/8uiwek= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= +golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= +golang.org/x/time v0.9.0 h1:EsRrnYcQiGH+5FfbgvV4AP7qEZstoyrHB0DzarOQ4ZY= +golang.org/x/time v0.9.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= +golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/genproto/googleapis/api v0.0.0-20241202173237-19429a94021a h1:OAiGFfOiA0v9MRYsSidp3ubZaBnteRUyn3xB2ZQ5G/E= +google.golang.org/genproto/googleapis/api v0.0.0-20241202173237-19429a94021a/go.mod h1:jehYqy3+AhJU9ve55aNOaSml7wUXjF9x6z2LcCfpAhY= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241202173237-19429a94021a h1:hgh8P4EuoxpsuKMXX/To36nOFD7vixReXgn8lPGnt+o= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241202173237-19429a94021a/go.mod h1:5uTbfoYQed2U9p3KIj2/Zzm02PYhndfdmML0qC3q3FU= +google.golang.org/grpc v1.70.0 h1:pWFv03aZoHzlRKHWicjsZytKAiYCtNS0dHbXnIdq7jQ= +google.golang.org/grpc v1.70.0/go.mod h1:ofIJqVKDXx/JiXrwr2IG4/zwdH9txy3IlF40RmcJSQw= +google.golang.org/protobuf v1.36.4 h1:6A3ZDJHn/eNqc1i+IdefRzy/9PokBTPvcqMySR7NNIM= +google.golang.org/protobuf v1.36.4/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/h2non/gock.v1 v1.1.2 h1:jBbHXgGBK/AoPVfJh5x4r/WxIrElvbLel8TCZkkZJoY= +gopkg.in/h2non/gock.v1 v1.1.2/go.mod h1:n7UGz/ckNChHiK05rDoiC4MYSunEC/lyaUm2WWaDva0= +gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= +gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +k8s.io/api v0.29.3 h1:2ORfZ7+bGC3YJqGpV0KSDDEVf8hdGQ6A03/50vj8pmw= +k8s.io/api v0.29.3/go.mod h1:y2yg2NTyHUUkIoTC+phinTnEa3KFM6RZ3szxt014a80= +k8s.io/apimachinery v0.29.4 h1:RaFdJiDmuKs/8cm1M6Dh1Kvyh59YQFDcFuFTSmXes6Q= +k8s.io/apimachinery v0.29.4/go.mod h1:i3FJVwhvSp/6n8Fl4K97PJEP8C+MM+aoDq4+ZJBf70Y= +k8s.io/client-go v0.29.3 h1:R/zaZbEAxqComZ9FHeQwOh3Y1ZUs7FaHKZdQtIc2WZg= +k8s.io/client-go v0.29.3/go.mod h1:tkDisCvgPfiRpxGnOORfkljmS+UrW+WtXAy2fTvXJB0= +k8s.io/klog/v2 v2.110.1 h1:U/Af64HJf7FcwMcXyKm2RPM22WZzyR7OSpYj5tg3cL0= +k8s.io/klog/v2 v2.110.1/go.mod h1:YGtd1984u+GgbuZ7e08/yBuAfKLSO0+uR1Fhi6ExXjo= +k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 h1:aVUu9fTY98ivBPKR9Y5w/AuzbMm96cd3YHRTU83I780= +k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00/go.mod h1:AsvuZPBlUDVuCdzJ87iajxtXuR9oktsTctW/R9wwouA= +k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 h1:pUdcCO1Lk/tbT5ztQWOBi5HBgbBP1J8+AsQnQCKsi8A= +k8s.io/utils v0.0.0-20240711033017-18e509b52bc8/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= +sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= +sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4= +sigs.k8s.io/structured-merge-diff/v4 v4.4.1/go.mod h1:N8hJocpFajUSSeSJ9bOZ77VzejKZaXsTtZo4/u7Io08= +sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo= +sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8= diff --git a/main.go b/main.go new file mode 100644 index 0000000..5dfd93f --- /dev/null +++ b/main.go @@ -0,0 +1,14 @@ +package main + +import ( + "fmt" +) + +func main() { + + for i := 1; i <= 5; i++ { + //TIP

To start your debugging session, right-click your code in the editor and select the Debug option.

We have set one breakpoint + // for you, but you can always add more by pressing .

+ fmt.Println("i =", 100/i) + } +} diff --git a/ranking_management/etc/ranking_management.yaml b/ranking_management/etc/ranking_management.yaml new file mode 100644 index 0000000..d8674be --- /dev/null +++ b/ranking_management/etc/ranking_management.yaml @@ -0,0 +1,6 @@ +Name: rankingmanagement.rpc +ListenOn: 0.0.0.0:8080 +Etcd: + Hosts: + - 127.0.0.1:2379 + Key: rankingmanagement.rpc diff --git a/ranking_management/internal/config/config.go b/ranking_management/internal/config/config.go new file mode 100644 index 0000000..c1f85b9 --- /dev/null +++ b/ranking_management/internal/config/config.go @@ -0,0 +1,7 @@ +package config + +import "github.com/zeromicro/go-zero/zrpc" + +type Config struct { + zrpc.RpcServerConf +} diff --git a/ranking_management/internal/logic/get_ranking_list_logic.go b/ranking_management/internal/logic/get_ranking_list_logic.go new file mode 100644 index 0000000..6d26379 --- /dev/null +++ b/ranking_management/internal/logic/get_ranking_list_logic.go @@ -0,0 +1,30 @@ +package logic + +import ( + "context" + + "gitea.youtukeji.com.cn/xiabin/youtu_grpc/ranking_management/internal/svc" + "gitea.youtukeji.com.cn/xiabin/youtu_grpc/ranking_management/ranking_management" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GetRankingListLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewGetRankingListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetRankingListLogic { + return &GetRankingListLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *GetRankingListLogic) GetRankingList(in *ranking_management.PageRequest, stream ranking_management.RankingManagement_GetRankingListServer) error { + // todo: add your logic here and delete this line + + return nil +} diff --git a/ranking_management/internal/logic/ping_logic.go b/ranking_management/internal/logic/ping_logic.go new file mode 100644 index 0000000..92bbc1a --- /dev/null +++ b/ranking_management/internal/logic/ping_logic.go @@ -0,0 +1,30 @@ +package logic + +import ( + "context" + + "gitea.youtukeji.com.cn/xiabin/youtu_grpc/ranking_management/internal/svc" + "gitea.youtukeji.com.cn/xiabin/youtu_grpc/ranking_management/ranking_management" + + "github.com/zeromicro/go-zero/core/logx" +) + +type PingLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewPingLogic(ctx context.Context, svcCtx *svc.ServiceContext) *PingLogic { + return &PingLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *PingLogic) Ping(in *ranking_management.Request) (*ranking_management.Response, error) { + // todo: add your logic here and delete this line + + return &ranking_management.Response{}, nil +} diff --git a/ranking_management/internal/logic/set_user_game_score_logic.go b/ranking_management/internal/logic/set_user_game_score_logic.go new file mode 100644 index 0000000..e1cd4be --- /dev/null +++ b/ranking_management/internal/logic/set_user_game_score_logic.go @@ -0,0 +1,30 @@ +package logic + +import ( + "context" + + "gitea.youtukeji.com.cn/xiabin/youtu_grpc/ranking_management/internal/svc" + "gitea.youtukeji.com.cn/xiabin/youtu_grpc/ranking_management/ranking_management" + + "github.com/zeromicro/go-zero/core/logx" +) + +type SetUserGameScoreLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewSetUserGameScoreLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SetUserGameScoreLogic { + return &SetUserGameScoreLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *SetUserGameScoreLogic) SetUserGameScore(in *ranking_management.SetUserGameScoreRequest) (*ranking_management.BaseResult, error) { + // todo: add your logic here and delete this line + + return &ranking_management.BaseResult{}, nil +} diff --git a/ranking_management/internal/server/ranking_management_server.go b/ranking_management/internal/server/ranking_management_server.go new file mode 100644 index 0000000..3e60d06 --- /dev/null +++ b/ranking_management/internal/server/ranking_management_server.go @@ -0,0 +1,39 @@ +// Code generated by goctl. DO NOT EDIT. +// goctl 1.7.6 +// Source: ranking_management.proto + +package server + +import ( + "context" + + "gitea.youtukeji.com.cn/xiabin/youtu_grpc/ranking_management/internal/logic" + "gitea.youtukeji.com.cn/xiabin/youtu_grpc/ranking_management/internal/svc" + "gitea.youtukeji.com.cn/xiabin/youtu_grpc/ranking_management/ranking_management" +) + +type RankingManagementServer struct { + svcCtx *svc.ServiceContext + ranking_management.UnimplementedRankingManagementServer +} + +func NewRankingManagementServer(svcCtx *svc.ServiceContext) *RankingManagementServer { + return &RankingManagementServer{ + svcCtx: svcCtx, + } +} + +func (s *RankingManagementServer) Ping(ctx context.Context, in *ranking_management.Request) (*ranking_management.Response, error) { + l := logic.NewPingLogic(ctx, s.svcCtx) + return l.Ping(in) +} + +func (s *RankingManagementServer) SetUserGameScore(ctx context.Context, in *ranking_management.SetUserGameScoreRequest) (*ranking_management.BaseResult, error) { + l := logic.NewSetUserGameScoreLogic(ctx, s.svcCtx) + return l.SetUserGameScore(in) +} + +func (s *RankingManagementServer) GetRankingList(in *ranking_management.PageRequest, stream ranking_management.RankingManagement_GetRankingListServer) error { + l := logic.NewGetRankingListLogic(stream.Context(), s.svcCtx) + return l.GetRankingList(in, stream) +} diff --git a/ranking_management/internal/svc/service_context.go b/ranking_management/internal/svc/service_context.go new file mode 100644 index 0000000..16e0417 --- /dev/null +++ b/ranking_management/internal/svc/service_context.go @@ -0,0 +1,13 @@ +package svc + +import "gitea.youtukeji.com.cn/xiabin/youtu_grpc/ranking_management/internal/config" + +type ServiceContext struct { + Config config.Config +} + +func NewServiceContext(c config.Config) *ServiceContext { + return &ServiceContext{ + Config: c, + } +} diff --git a/ranking_management/ranking_management.go b/ranking_management/ranking_management.go new file mode 100644 index 0000000..57a1403 --- /dev/null +++ b/ranking_management/ranking_management.go @@ -0,0 +1,39 @@ +package main + +import ( + "flag" + "fmt" + + "gitea.youtukeji.com.cn/xiabin/youtu_grpc/ranking_management/internal/config" + "gitea.youtukeji.com.cn/xiabin/youtu_grpc/ranking_management/internal/server" + "gitea.youtukeji.com.cn/xiabin/youtu_grpc/ranking_management/internal/svc" + "gitea.youtukeji.com.cn/xiabin/youtu_grpc/ranking_management/ranking_management" + + "github.com/zeromicro/go-zero/core/conf" + "github.com/zeromicro/go-zero/core/service" + "github.com/zeromicro/go-zero/zrpc" + "google.golang.org/grpc" + "google.golang.org/grpc/reflection" +) + +var configFile = flag.String("f", "etc/ranking_management.yaml", "the config file") + +func main() { + flag.Parse() + + var c config.Config + conf.MustLoad(*configFile, &c) + ctx := svc.NewServiceContext(c) + + s := zrpc.MustNewServer(c.RpcServerConf, func(grpcServer *grpc.Server) { + ranking_management.RegisterRankingManagementServer(grpcServer, server.NewRankingManagementServer(ctx)) + + if c.Mode == service.DevMode || c.Mode == service.TestMode { + reflection.Register(grpcServer) + } + }) + defer s.Stop() + + fmt.Printf("Starting rpc server at %s...\n", c.ListenOn) + s.Start() +} diff --git a/ranking_management/ranking_management.proto b/ranking_management/ranking_management.proto new file mode 100644 index 0000000..9dfaf4b --- /dev/null +++ b/ranking_management/ranking_management.proto @@ -0,0 +1,49 @@ +syntax = "proto3"; + +package ranking_management; +option go_package = "./ranking_management"; + +message Request { + string ping = 1; +} + +message Response { + string pong = 1; +} + +// 定义SetUserGameScoreRequest消息类型 +message SetUserGameScoreRequest { + uint32 score = 1; // 对应json的"score" + uint32 type = 2; // 对应json的"type", 带默认值0 + uint32 userId = 3; +} + +// 定义RankingData消息类型 +message RankingData { + string nickname = 1; // 昵称,对应db:"nickname" + string avatar = 2; // 头像,对应db:"avatar" + uint32 score = 3; // 得分,对应db:"score" + uint64 user_id = 4; // 用户ID,对应db:"app_user_id" + uint32 rank = 5; // 排名,对应db:"rank" + bool self = 6; // 是否自我判断 +} + +// 定义分页请求参数(如果有的话) +message PageRequest { + int32 page = 1; + int32 limit = 2; +} + +// 定义Base响应结构 +message BaseResult { + int32 error_code = 1; // 错误码 + string error_msg = 2; // 错误信息 +} + +service Ranking_management { + rpc Ping(Request) returns(Response); + + rpc SetUserGameScore (SetUserGameScoreRequest) returns (BaseResult); + + rpc GetRankingList (PageRequest) returns (stream RankingData); +} diff --git a/ranking_management/ranking_management/ranking_management.pb.go b/ranking_management/ranking_management/ranking_management.pb.go new file mode 100644 index 0000000..72019fa --- /dev/null +++ b/ranking_management/ranking_management/ranking_management.pb.go @@ -0,0 +1,476 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.4 +// protoc v3.19.4 +// source: ranking_management.proto + +package ranking_management + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type Request struct { + state protoimpl.MessageState `protogen:"open.v1"` + Ping string `protobuf:"bytes,1,opt,name=ping,proto3" json:"ping,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Request) Reset() { + *x = Request{} + mi := &file_ranking_management_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Request) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Request) ProtoMessage() {} + +func (x *Request) ProtoReflect() protoreflect.Message { + mi := &file_ranking_management_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Request.ProtoReflect.Descriptor instead. +func (*Request) Descriptor() ([]byte, []int) { + return file_ranking_management_proto_rawDescGZIP(), []int{0} +} + +func (x *Request) GetPing() string { + if x != nil { + return x.Ping + } + return "" +} + +type Response struct { + state protoimpl.MessageState `protogen:"open.v1"` + Pong string `protobuf:"bytes,1,opt,name=pong,proto3" json:"pong,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Response) Reset() { + *x = Response{} + mi := &file_ranking_management_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Response) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Response) ProtoMessage() {} + +func (x *Response) ProtoReflect() protoreflect.Message { + mi := &file_ranking_management_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Response.ProtoReflect.Descriptor instead. +func (*Response) Descriptor() ([]byte, []int) { + return file_ranking_management_proto_rawDescGZIP(), []int{1} +} + +func (x *Response) GetPong() string { + if x != nil { + return x.Pong + } + return "" +} + +// 定义SetUserGameScoreRequest消息类型 +type SetUserGameScoreRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Score uint32 `protobuf:"varint,1,opt,name=score,proto3" json:"score,omitempty"` // 对应json的"score" + Type uint32 `protobuf:"varint,2,opt,name=type,proto3" json:"type,omitempty"` // 对应json的"type", 带默认值0 + UserId uint32 `protobuf:"varint,3,opt,name=userId,proto3" json:"userId,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SetUserGameScoreRequest) Reset() { + *x = SetUserGameScoreRequest{} + mi := &file_ranking_management_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SetUserGameScoreRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SetUserGameScoreRequest) ProtoMessage() {} + +func (x *SetUserGameScoreRequest) ProtoReflect() protoreflect.Message { + mi := &file_ranking_management_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SetUserGameScoreRequest.ProtoReflect.Descriptor instead. +func (*SetUserGameScoreRequest) Descriptor() ([]byte, []int) { + return file_ranking_management_proto_rawDescGZIP(), []int{2} +} + +func (x *SetUserGameScoreRequest) GetScore() uint32 { + if x != nil { + return x.Score + } + return 0 +} + +func (x *SetUserGameScoreRequest) GetType() uint32 { + if x != nil { + return x.Type + } + return 0 +} + +func (x *SetUserGameScoreRequest) GetUserId() uint32 { + if x != nil { + return x.UserId + } + return 0 +} + +// 定义RankingData消息类型 +type RankingData struct { + state protoimpl.MessageState `protogen:"open.v1"` + Nickname string `protobuf:"bytes,1,opt,name=nickname,proto3" json:"nickname,omitempty"` // 昵称,对应db:"nickname" + Avatar string `protobuf:"bytes,2,opt,name=avatar,proto3" json:"avatar,omitempty"` // 头像,对应db:"avatar" + Score uint32 `protobuf:"varint,3,opt,name=score,proto3" json:"score,omitempty"` // 得分,对应db:"score" + UserId uint64 `protobuf:"varint,4,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` // 用户ID,对应db:"app_user_id" + Rank uint32 `protobuf:"varint,5,opt,name=rank,proto3" json:"rank,omitempty"` // 排名,对应db:"rank" + Self bool `protobuf:"varint,6,opt,name=self,proto3" json:"self,omitempty"` // 是否自我判断 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RankingData) Reset() { + *x = RankingData{} + mi := &file_ranking_management_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RankingData) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RankingData) ProtoMessage() {} + +func (x *RankingData) ProtoReflect() protoreflect.Message { + mi := &file_ranking_management_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RankingData.ProtoReflect.Descriptor instead. +func (*RankingData) Descriptor() ([]byte, []int) { + return file_ranking_management_proto_rawDescGZIP(), []int{3} +} + +func (x *RankingData) GetNickname() string { + if x != nil { + return x.Nickname + } + return "" +} + +func (x *RankingData) GetAvatar() string { + if x != nil { + return x.Avatar + } + return "" +} + +func (x *RankingData) GetScore() uint32 { + if x != nil { + return x.Score + } + return 0 +} + +func (x *RankingData) GetUserId() uint64 { + if x != nil { + return x.UserId + } + return 0 +} + +func (x *RankingData) GetRank() uint32 { + if x != nil { + return x.Rank + } + return 0 +} + +func (x *RankingData) GetSelf() bool { + if x != nil { + return x.Self + } + return false +} + +// 定义分页请求参数(如果有的话) +type PageRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Page int32 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"` + Limit int32 `protobuf:"varint,2,opt,name=limit,proto3" json:"limit,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PageRequest) Reset() { + *x = PageRequest{} + mi := &file_ranking_management_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PageRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PageRequest) ProtoMessage() {} + +func (x *PageRequest) ProtoReflect() protoreflect.Message { + mi := &file_ranking_management_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PageRequest.ProtoReflect.Descriptor instead. +func (*PageRequest) Descriptor() ([]byte, []int) { + return file_ranking_management_proto_rawDescGZIP(), []int{4} +} + +func (x *PageRequest) GetPage() int32 { + if x != nil { + return x.Page + } + return 0 +} + +func (x *PageRequest) GetLimit() int32 { + if x != nil { + return x.Limit + } + return 0 +} + +// 定义Base响应结构 +type BaseResult struct { + state protoimpl.MessageState `protogen:"open.v1"` + ErrorCode int32 `protobuf:"varint,1,opt,name=error_code,json=errorCode,proto3" json:"error_code,omitempty"` // 错误码 + ErrorMsg string `protobuf:"bytes,2,opt,name=error_msg,json=errorMsg,proto3" json:"error_msg,omitempty"` // 错误信息 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BaseResult) Reset() { + *x = BaseResult{} + mi := &file_ranking_management_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BaseResult) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BaseResult) ProtoMessage() {} + +func (x *BaseResult) ProtoReflect() protoreflect.Message { + mi := &file_ranking_management_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BaseResult.ProtoReflect.Descriptor instead. +func (*BaseResult) Descriptor() ([]byte, []int) { + return file_ranking_management_proto_rawDescGZIP(), []int{5} +} + +func (x *BaseResult) GetErrorCode() int32 { + if x != nil { + return x.ErrorCode + } + return 0 +} + +func (x *BaseResult) GetErrorMsg() string { + if x != nil { + return x.ErrorMsg + } + return "" +} + +var File_ranking_management_proto protoreflect.FileDescriptor + +var file_ranking_management_proto_rawDesc = string([]byte{ + 0x0a, 0x18, 0x72, 0x61, 0x6e, 0x6b, 0x69, 0x6e, 0x67, 0x5f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x72, 0x61, 0x6e, 0x6b, + 0x69, 0x6e, 0x67, 0x5f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x1d, + 0x0a, 0x07, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x69, 0x6e, + 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x69, 0x6e, 0x67, 0x22, 0x1e, 0x0a, + 0x08, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x6f, 0x6e, + 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x6f, 0x6e, 0x67, 0x22, 0x5b, 0x0a, + 0x17, 0x53, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x47, 0x61, 0x6d, 0x65, 0x53, 0x63, 0x6f, 0x72, + 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x72, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x12, 0x12, + 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x04, 0x74, 0x79, + 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0d, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x22, 0x98, 0x01, 0x0a, 0x0b, 0x52, + 0x61, 0x6e, 0x6b, 0x69, 0x6e, 0x67, 0x44, 0x61, 0x74, 0x61, 0x12, 0x1a, 0x0a, 0x08, 0x6e, 0x69, + 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6e, 0x69, + 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x12, 0x14, + 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x73, + 0x63, 0x6f, 0x72, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x12, 0x0a, + 0x04, 0x72, 0x61, 0x6e, 0x6b, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x04, 0x72, 0x61, 0x6e, + 0x6b, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x65, 0x6c, 0x66, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x04, 0x73, 0x65, 0x6c, 0x66, 0x22, 0x37, 0x0a, 0x0b, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x04, 0x70, 0x61, 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, + 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x22, 0x48, + 0x0a, 0x0a, 0x42, 0x61, 0x73, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x1d, 0x0a, 0x0a, + 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x09, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x65, + 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x6d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, + 0x65, 0x72, 0x72, 0x6f, 0x72, 0x4d, 0x73, 0x67, 0x32, 0x8e, 0x02, 0x0a, 0x12, 0x52, 0x61, 0x6e, + 0x6b, 0x69, 0x6e, 0x67, 0x5f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, + 0x41, 0x0a, 0x04, 0x50, 0x69, 0x6e, 0x67, 0x12, 0x1b, 0x2e, 0x72, 0x61, 0x6e, 0x6b, 0x69, 0x6e, + 0x67, 0x5f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x72, 0x61, 0x6e, 0x6b, 0x69, 0x6e, 0x67, 0x5f, 0x6d, + 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x5f, 0x0a, 0x10, 0x53, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x47, 0x61, 0x6d, + 0x65, 0x53, 0x63, 0x6f, 0x72, 0x65, 0x12, 0x2b, 0x2e, 0x72, 0x61, 0x6e, 0x6b, 0x69, 0x6e, 0x67, + 0x5f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x53, 0x65, 0x74, 0x55, + 0x73, 0x65, 0x72, 0x47, 0x61, 0x6d, 0x65, 0x53, 0x63, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x72, 0x61, 0x6e, 0x6b, 0x69, 0x6e, 0x67, 0x5f, 0x6d, 0x61, + 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x52, 0x65, 0x73, + 0x75, 0x6c, 0x74, 0x12, 0x54, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x6b, 0x69, 0x6e, + 0x67, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x1f, 0x2e, 0x72, 0x61, 0x6e, 0x6b, 0x69, 0x6e, 0x67, 0x5f, + 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x72, 0x61, 0x6e, 0x6b, 0x69, 0x6e, 0x67, + 0x5f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x52, 0x61, 0x6e, 0x6b, + 0x69, 0x6e, 0x67, 0x44, 0x61, 0x74, 0x61, 0x30, 0x01, 0x42, 0x16, 0x5a, 0x14, 0x2e, 0x2f, 0x72, + 0x61, 0x6e, 0x6b, 0x69, 0x6e, 0x67, 0x5f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +}) + +var ( + file_ranking_management_proto_rawDescOnce sync.Once + file_ranking_management_proto_rawDescData []byte +) + +func file_ranking_management_proto_rawDescGZIP() []byte { + file_ranking_management_proto_rawDescOnce.Do(func() { + file_ranking_management_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_ranking_management_proto_rawDesc), len(file_ranking_management_proto_rawDesc))) + }) + return file_ranking_management_proto_rawDescData +} + +var file_ranking_management_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_ranking_management_proto_goTypes = []any{ + (*Request)(nil), // 0: ranking_management.Request + (*Response)(nil), // 1: ranking_management.Response + (*SetUserGameScoreRequest)(nil), // 2: ranking_management.SetUserGameScoreRequest + (*RankingData)(nil), // 3: ranking_management.RankingData + (*PageRequest)(nil), // 4: ranking_management.PageRequest + (*BaseResult)(nil), // 5: ranking_management.BaseResult +} +var file_ranking_management_proto_depIdxs = []int32{ + 0, // 0: ranking_management.Ranking_management.Ping:input_type -> ranking_management.Request + 2, // 1: ranking_management.Ranking_management.SetUserGameScore:input_type -> ranking_management.SetUserGameScoreRequest + 4, // 2: ranking_management.Ranking_management.GetRankingList:input_type -> ranking_management.PageRequest + 1, // 3: ranking_management.Ranking_management.Ping:output_type -> ranking_management.Response + 5, // 4: ranking_management.Ranking_management.SetUserGameScore:output_type -> ranking_management.BaseResult + 3, // 5: ranking_management.Ranking_management.GetRankingList:output_type -> ranking_management.RankingData + 3, // [3:6] is the sub-list for method output_type + 0, // [0:3] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_ranking_management_proto_init() } +func file_ranking_management_proto_init() { + if File_ranking_management_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_ranking_management_proto_rawDesc), len(file_ranking_management_proto_rawDesc)), + NumEnums: 0, + NumMessages: 6, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_ranking_management_proto_goTypes, + DependencyIndexes: file_ranking_management_proto_depIdxs, + MessageInfos: file_ranking_management_proto_msgTypes, + }.Build() + File_ranking_management_proto = out.File + file_ranking_management_proto_goTypes = nil + file_ranking_management_proto_depIdxs = nil +} diff --git a/ranking_management/ranking_management/ranking_management_grpc.pb.go b/ranking_management/ranking_management/ranking_management_grpc.pb.go new file mode 100644 index 0000000..18abcf3 --- /dev/null +++ b/ranking_management/ranking_management/ranking_management_grpc.pb.go @@ -0,0 +1,201 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.5.1 +// - protoc v3.19.4 +// source: ranking_management.proto + +package ranking_management + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 + +const ( + RankingManagement_Ping_FullMethodName = "/ranking_management.Ranking_management/Ping" + RankingManagement_SetUserGameScore_FullMethodName = "/ranking_management.Ranking_management/SetUserGameScore" + RankingManagement_GetRankingList_FullMethodName = "/ranking_management.Ranking_management/GetRankingList" +) + +// RankingManagementClient is the client API for RankingManagement service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type RankingManagementClient interface { + Ping(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) + SetUserGameScore(ctx context.Context, in *SetUserGameScoreRequest, opts ...grpc.CallOption) (*BaseResult, error) + GetRankingList(ctx context.Context, in *PageRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[RankingData], error) +} + +type rankingManagementClient struct { + cc grpc.ClientConnInterface +} + +func NewRankingManagementClient(cc grpc.ClientConnInterface) RankingManagementClient { + return &rankingManagementClient{cc} +} + +func (c *rankingManagementClient) Ping(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(Response) + err := c.cc.Invoke(ctx, RankingManagement_Ping_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *rankingManagementClient) SetUserGameScore(ctx context.Context, in *SetUserGameScoreRequest, opts ...grpc.CallOption) (*BaseResult, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(BaseResult) + err := c.cc.Invoke(ctx, RankingManagement_SetUserGameScore_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *rankingManagementClient) GetRankingList(ctx context.Context, in *PageRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[RankingData], error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + stream, err := c.cc.NewStream(ctx, &RankingManagement_ServiceDesc.Streams[0], RankingManagement_GetRankingList_FullMethodName, cOpts...) + if err != nil { + return nil, err + } + x := &grpc.GenericClientStream[PageRequest, RankingData]{ClientStream: stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type RankingManagement_GetRankingListClient = grpc.ServerStreamingClient[RankingData] + +// RankingManagementServer is the server API for RankingManagement service. +// All implementations must embed UnimplementedRankingManagementServer +// for forward compatibility. +type RankingManagementServer interface { + Ping(context.Context, *Request) (*Response, error) + SetUserGameScore(context.Context, *SetUserGameScoreRequest) (*BaseResult, error) + GetRankingList(*PageRequest, grpc.ServerStreamingServer[RankingData]) error + mustEmbedUnimplementedRankingManagementServer() +} + +// UnimplementedRankingManagementServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedRankingManagementServer struct{} + +func (UnimplementedRankingManagementServer) Ping(context.Context, *Request) (*Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method Ping not implemented") +} +func (UnimplementedRankingManagementServer) SetUserGameScore(context.Context, *SetUserGameScoreRequest) (*BaseResult, error) { + return nil, status.Errorf(codes.Unimplemented, "method SetUserGameScore not implemented") +} +func (UnimplementedRankingManagementServer) GetRankingList(*PageRequest, grpc.ServerStreamingServer[RankingData]) error { + return status.Errorf(codes.Unimplemented, "method GetRankingList not implemented") +} +func (UnimplementedRankingManagementServer) mustEmbedUnimplementedRankingManagementServer() {} +func (UnimplementedRankingManagementServer) testEmbeddedByValue() {} + +// UnsafeRankingManagementServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to RankingManagementServer will +// result in compilation errors. +type UnsafeRankingManagementServer interface { + mustEmbedUnimplementedRankingManagementServer() +} + +func RegisterRankingManagementServer(s grpc.ServiceRegistrar, srv RankingManagementServer) { + // If the following call pancis, it indicates UnimplementedRankingManagementServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&RankingManagement_ServiceDesc, srv) +} + +func _RankingManagement_Ping_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RankingManagementServer).Ping(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RankingManagement_Ping_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RankingManagementServer).Ping(ctx, req.(*Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _RankingManagement_SetUserGameScore_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SetUserGameScoreRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RankingManagementServer).SetUserGameScore(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RankingManagement_SetUserGameScore_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RankingManagementServer).SetUserGameScore(ctx, req.(*SetUserGameScoreRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _RankingManagement_GetRankingList_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(PageRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(RankingManagementServer).GetRankingList(m, &grpc.GenericServerStream[PageRequest, RankingData]{ServerStream: stream}) +} + +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type RankingManagement_GetRankingListServer = grpc.ServerStreamingServer[RankingData] + +// RankingManagement_ServiceDesc is the grpc.ServiceDesc for RankingManagement service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var RankingManagement_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "ranking_management.Ranking_management", + HandlerType: (*RankingManagementServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Ping", + Handler: _RankingManagement_Ping_Handler, + }, + { + MethodName: "SetUserGameScore", + Handler: _RankingManagement_SetUserGameScore_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "GetRankingList", + Handler: _RankingManagement_GetRankingList_Handler, + ServerStreams: true, + }, + }, + Metadata: "ranking_management.proto", +} diff --git a/ranking_management/ranking_management_client/ranking_management.go b/ranking_management/ranking_management_client/ranking_management.go new file mode 100644 index 0000000..48c5684 --- /dev/null +++ b/ranking_management/ranking_management_client/ranking_management.go @@ -0,0 +1,54 @@ +// Code generated by goctl. DO NOT EDIT. +// goctl 1.7.6 +// Source: ranking_management.proto + +package ranking_management_client + +import ( + "context" + + "gitea.youtukeji.com.cn/xiabin/youtu_grpc/ranking_management/ranking_management" + + "github.com/zeromicro/go-zero/zrpc" + "google.golang.org/grpc" +) + +type ( + BaseResult = ranking_management.BaseResult + PageRequest = ranking_management.PageRequest + RankingData = ranking_management.RankingData + Request = ranking_management.Request + Response = ranking_management.Response + SetUserGameScoreRequest = ranking_management.SetUserGameScoreRequest + + RankingManagement interface { + Ping(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) + SetUserGameScore(ctx context.Context, in *SetUserGameScoreRequest, opts ...grpc.CallOption) (*BaseResult, error) + GetRankingList(ctx context.Context, in *PageRequest, opts ...grpc.CallOption) (ranking_management.RankingManagement_GetRankingListClient, error) + } + + defaultRankingManagement struct { + cli zrpc.Client + } +) + +func NewRankingManagement(cli zrpc.Client) RankingManagement { + return &defaultRankingManagement{ + cli: cli, + } +} + +func (m *defaultRankingManagement) Ping(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) { + client := ranking_management.NewRankingManagementClient(m.cli.Conn()) + return client.Ping(ctx, in, opts...) +} + +func (m *defaultRankingManagement) SetUserGameScore(ctx context.Context, in *SetUserGameScoreRequest, opts ...grpc.CallOption) (*BaseResult, error) { + client := ranking_management.NewRankingManagementClient(m.cli.Conn()) + return client.SetUserGameScore(ctx, in, opts...) +} + +func (m *defaultRankingManagement) GetRankingList(ctx context.Context, in *PageRequest, opts ...grpc.CallOption) (ranking_management.RankingManagement_GetRankingListClient, error) { + client := ranking_management.NewRankingManagementClient(m.cli.Conn()) + return client.GetRankingList(ctx, in, opts...) +} diff --git a/user_management/etc/user_management.yaml b/user_management/etc/user_management.yaml new file mode 100644 index 0000000..ead7bb7 --- /dev/null +++ b/user_management/etc/user_management.yaml @@ -0,0 +1,6 @@ +Name: usermanagement.rpc +ListenOn: 0.0.0.0:8080 +Etcd: + Hosts: + - 127.0.0.1:2379 + Key: usermanagement.rpc diff --git a/user_management/internal/config/config.go b/user_management/internal/config/config.go new file mode 100644 index 0000000..c1f85b9 --- /dev/null +++ b/user_management/internal/config/config.go @@ -0,0 +1,7 @@ +package config + +import "github.com/zeromicro/go-zero/zrpc" + +type Config struct { + zrpc.RpcServerConf +} diff --git a/user_management/internal/logic/ping_logic.go b/user_management/internal/logic/ping_logic.go new file mode 100644 index 0000000..1233db8 --- /dev/null +++ b/user_management/internal/logic/ping_logic.go @@ -0,0 +1,30 @@ +package logic + +import ( + "context" + + "gitea.youtukeji.com.cn/xiabin/youtu_grpc/user_management/internal/svc" + "gitea.youtukeji.com.cn/xiabin/youtu_grpc/user_management/user_management" + + "github.com/zeromicro/go-zero/core/logx" +) + +type PingLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewPingLogic(ctx context.Context, svcCtx *svc.ServiceContext) *PingLogic { + return &PingLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *PingLogic) Ping(in *user_management.Request) (*user_management.Response, error) { + // todo: add your logic here and delete this line + + return &user_management.Response{}, nil +} diff --git a/user_management/internal/logic/set_app_account_logic.go b/user_management/internal/logic/set_app_account_logic.go new file mode 100644 index 0000000..a93684d --- /dev/null +++ b/user_management/internal/logic/set_app_account_logic.go @@ -0,0 +1,30 @@ +package logic + +import ( + "context" + + "gitea.youtukeji.com.cn/xiabin/youtu_grpc/user_management/internal/svc" + "gitea.youtukeji.com.cn/xiabin/youtu_grpc/user_management/user_management" + + "github.com/zeromicro/go-zero/core/logx" +) + +type SetAppAccountLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewSetAppAccountLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SetAppAccountLogic { + return &SetAppAccountLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *SetAppAccountLogic) SetAppAccount(in *user_management.SetAppUserRequest) (*user_management.Response, error) { + // todo: add your logic here and delete this line + + return &user_management.Response{}, nil +} diff --git a/user_management/internal/server/user_management_server.go b/user_management/internal/server/user_management_server.go new file mode 100644 index 0000000..0ae13df --- /dev/null +++ b/user_management/internal/server/user_management_server.go @@ -0,0 +1,34 @@ +// Code generated by goctl. DO NOT EDIT. +// goctl 1.7.6 +// Source: user_management.proto + +package server + +import ( + "context" + + "gitea.youtukeji.com.cn/xiabin/youtu_grpc/user_management/internal/logic" + "gitea.youtukeji.com.cn/xiabin/youtu_grpc/user_management/internal/svc" + "gitea.youtukeji.com.cn/xiabin/youtu_grpc/user_management/user_management" +) + +type UserManagementServer struct { + svcCtx *svc.ServiceContext + user_management.UnimplementedUserManagementServer +} + +func NewUserManagementServer(svcCtx *svc.ServiceContext) *UserManagementServer { + return &UserManagementServer{ + svcCtx: svcCtx, + } +} + +func (s *UserManagementServer) Ping(ctx context.Context, in *user_management.Request) (*user_management.Response, error) { + l := logic.NewPingLogic(ctx, s.svcCtx) + return l.Ping(in) +} + +func (s *UserManagementServer) SetAppAccount(ctx context.Context, in *user_management.SetAppUserRequest) (*user_management.Response, error) { + l := logic.NewSetAppAccountLogic(ctx, s.svcCtx) + return l.SetAppAccount(in) +} diff --git a/user_management/internal/svc/service_context.go b/user_management/internal/svc/service_context.go new file mode 100644 index 0000000..761e2f9 --- /dev/null +++ b/user_management/internal/svc/service_context.go @@ -0,0 +1,13 @@ +package svc + +import "gitea.youtukeji.com.cn/xiabin/youtu_grpc/user_management/internal/config" + +type ServiceContext struct { + Config config.Config +} + +func NewServiceContext(c config.Config) *ServiceContext { + return &ServiceContext{ + Config: c, + } +} diff --git a/user_management/user_management.go b/user_management/user_management.go new file mode 100644 index 0000000..9f6ac0e --- /dev/null +++ b/user_management/user_management.go @@ -0,0 +1,39 @@ +package main + +import ( + "flag" + "fmt" + + "gitea.youtukeji.com.cn/xiabin/youtu_grpc/user_management/internal/config" + "gitea.youtukeji.com.cn/xiabin/youtu_grpc/user_management/internal/server" + "gitea.youtukeji.com.cn/xiabin/youtu_grpc/user_management/internal/svc" + "gitea.youtukeji.com.cn/xiabin/youtu_grpc/user_management/user_management" + + "github.com/zeromicro/go-zero/core/conf" + "github.com/zeromicro/go-zero/core/service" + "github.com/zeromicro/go-zero/zrpc" + "google.golang.org/grpc" + "google.golang.org/grpc/reflection" +) + +var configFile = flag.String("f", "etc/user_management.yaml", "the config file") + +func main() { + flag.Parse() + + var c config.Config + conf.MustLoad(*configFile, &c) + ctx := svc.NewServiceContext(c) + + s := zrpc.MustNewServer(c.RpcServerConf, func(grpcServer *grpc.Server) { + user_management.RegisterUserManagementServer(grpcServer, server.NewUserManagementServer(ctx)) + + if c.Mode == service.DevMode || c.Mode == service.TestMode { + reflection.Register(grpcServer) + } + }) + defer s.Stop() + + fmt.Printf("Starting rpc server at %s...\n", c.ListenOn) + s.Start() +} diff --git a/user_management/user_management.proto b/user_management/user_management.proto new file mode 100644 index 0000000..3637d6e --- /dev/null +++ b/user_management/user_management.proto @@ -0,0 +1,23 @@ +syntax = "proto3"; + +package user_management; +option go_package="./user_management"; + +message Request { + string ping = 1; +} + +message Response { + string pong = 1; +} + +message SetAppUserRequest{ + string Nickname=1; + string Avatar=2; +} + +service User_management { + rpc Ping(Request) returns(Response); + + rpc SetAppAccount (SetAppUserRequest) returns(Response); +} diff --git a/user_management/user_management/user_management.pb.go b/user_management/user_management/user_management.pb.go new file mode 100644 index 0000000..0dac820 --- /dev/null +++ b/user_management/user_management/user_management.pb.go @@ -0,0 +1,244 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.4 +// protoc v3.19.4 +// source: user_management.proto + +package user_management + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type Request struct { + state protoimpl.MessageState `protogen:"open.v1"` + Ping string `protobuf:"bytes,1,opt,name=ping,proto3" json:"ping,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Request) Reset() { + *x = Request{} + mi := &file_user_management_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Request) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Request) ProtoMessage() {} + +func (x *Request) ProtoReflect() protoreflect.Message { + mi := &file_user_management_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Request.ProtoReflect.Descriptor instead. +func (*Request) Descriptor() ([]byte, []int) { + return file_user_management_proto_rawDescGZIP(), []int{0} +} + +func (x *Request) GetPing() string { + if x != nil { + return x.Ping + } + return "" +} + +type Response struct { + state protoimpl.MessageState `protogen:"open.v1"` + Pong string `protobuf:"bytes,1,opt,name=pong,proto3" json:"pong,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Response) Reset() { + *x = Response{} + mi := &file_user_management_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Response) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Response) ProtoMessage() {} + +func (x *Response) ProtoReflect() protoreflect.Message { + mi := &file_user_management_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Response.ProtoReflect.Descriptor instead. +func (*Response) Descriptor() ([]byte, []int) { + return file_user_management_proto_rawDescGZIP(), []int{1} +} + +func (x *Response) GetPong() string { + if x != nil { + return x.Pong + } + return "" +} + +type SetAppUserRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Nickname string `protobuf:"bytes,1,opt,name=Nickname,proto3" json:"Nickname,omitempty"` + Avatar string `protobuf:"bytes,2,opt,name=Avatar,proto3" json:"Avatar,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SetAppUserRequest) Reset() { + *x = SetAppUserRequest{} + mi := &file_user_management_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SetAppUserRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SetAppUserRequest) ProtoMessage() {} + +func (x *SetAppUserRequest) ProtoReflect() protoreflect.Message { + mi := &file_user_management_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SetAppUserRequest.ProtoReflect.Descriptor instead. +func (*SetAppUserRequest) Descriptor() ([]byte, []int) { + return file_user_management_proto_rawDescGZIP(), []int{2} +} + +func (x *SetAppUserRequest) GetNickname() string { + if x != nil { + return x.Nickname + } + return "" +} + +func (x *SetAppUserRequest) GetAvatar() string { + if x != nil { + return x.Avatar + } + return "" +} + +var File_user_management_proto protoreflect.FileDescriptor + +var file_user_management_proto_rawDesc = string([]byte{ + 0x0a, 0x15, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x6d, 0x61, + 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x1d, 0x0a, 0x07, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x70, 0x69, 0x6e, 0x67, 0x22, 0x1e, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x6f, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x70, 0x6f, 0x6e, 0x67, 0x22, 0x47, 0x0a, 0x11, 0x53, 0x65, 0x74, 0x41, 0x70, + 0x70, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, + 0x4e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, + 0x4e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x41, 0x76, 0x61, 0x74, + 0x61, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x41, 0x76, 0x61, 0x74, 0x61, 0x72, + 0x32, 0x9e, 0x01, 0x0a, 0x0f, 0x55, 0x73, 0x65, 0x72, 0x5f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x3b, 0x0a, 0x04, 0x50, 0x69, 0x6e, 0x67, 0x12, 0x18, 0x2e, 0x75, + 0x73, 0x65, 0x72, 0x5f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x6d, 0x61, + 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x4e, 0x0a, 0x0d, 0x53, 0x65, 0x74, 0x41, 0x70, 0x70, 0x41, 0x63, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x12, 0x22, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x53, 0x65, 0x74, 0x41, 0x70, 0x70, 0x55, 0x73, 0x65, 0x72, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x6d, 0x61, + 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x42, 0x13, 0x5a, 0x11, 0x2e, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x6d, 0x61, 0x6e, 0x61, + 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +}) + +var ( + file_user_management_proto_rawDescOnce sync.Once + file_user_management_proto_rawDescData []byte +) + +func file_user_management_proto_rawDescGZIP() []byte { + file_user_management_proto_rawDescOnce.Do(func() { + file_user_management_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_user_management_proto_rawDesc), len(file_user_management_proto_rawDesc))) + }) + return file_user_management_proto_rawDescData +} + +var file_user_management_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_user_management_proto_goTypes = []any{ + (*Request)(nil), // 0: user_management.Request + (*Response)(nil), // 1: user_management.Response + (*SetAppUserRequest)(nil), // 2: user_management.SetAppUserRequest +} +var file_user_management_proto_depIdxs = []int32{ + 0, // 0: user_management.User_management.Ping:input_type -> user_management.Request + 2, // 1: user_management.User_management.SetAppAccount:input_type -> user_management.SetAppUserRequest + 1, // 2: user_management.User_management.Ping:output_type -> user_management.Response + 1, // 3: user_management.User_management.SetAppAccount:output_type -> user_management.Response + 2, // [2:4] is the sub-list for method output_type + 0, // [0:2] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_user_management_proto_init() } +func file_user_management_proto_init() { + if File_user_management_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_user_management_proto_rawDesc), len(file_user_management_proto_rawDesc)), + NumEnums: 0, + NumMessages: 3, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_user_management_proto_goTypes, + DependencyIndexes: file_user_management_proto_depIdxs, + MessageInfos: file_user_management_proto_msgTypes, + }.Build() + File_user_management_proto = out.File + file_user_management_proto_goTypes = nil + file_user_management_proto_depIdxs = nil +} diff --git a/user_management/user_management/user_management_grpc.pb.go b/user_management/user_management/user_management_grpc.pb.go new file mode 100644 index 0000000..fd779ef --- /dev/null +++ b/user_management/user_management/user_management_grpc.pb.go @@ -0,0 +1,159 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.5.1 +// - protoc v3.19.4 +// source: user_management.proto + +package user_management + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 + +const ( + UserManagement_Ping_FullMethodName = "/user_management.User_management/Ping" + UserManagement_SetAppAccount_FullMethodName = "/user_management.User_management/SetAppAccount" +) + +// UserManagementClient is the client API for UserManagement service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type UserManagementClient interface { + Ping(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) + SetAppAccount(ctx context.Context, in *SetAppUserRequest, opts ...grpc.CallOption) (*Response, error) +} + +type userManagementClient struct { + cc grpc.ClientConnInterface +} + +func NewUserManagementClient(cc grpc.ClientConnInterface) UserManagementClient { + return &userManagementClient{cc} +} + +func (c *userManagementClient) Ping(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(Response) + err := c.cc.Invoke(ctx, UserManagement_Ping_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *userManagementClient) SetAppAccount(ctx context.Context, in *SetAppUserRequest, opts ...grpc.CallOption) (*Response, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(Response) + err := c.cc.Invoke(ctx, UserManagement_SetAppAccount_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// UserManagementServer is the server API for UserManagement service. +// All implementations must embed UnimplementedUserManagementServer +// for forward compatibility. +type UserManagementServer interface { + Ping(context.Context, *Request) (*Response, error) + SetAppAccount(context.Context, *SetAppUserRequest) (*Response, error) + mustEmbedUnimplementedUserManagementServer() +} + +// UnimplementedUserManagementServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedUserManagementServer struct{} + +func (UnimplementedUserManagementServer) Ping(context.Context, *Request) (*Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method Ping not implemented") +} +func (UnimplementedUserManagementServer) SetAppAccount(context.Context, *SetAppUserRequest) (*Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method SetAppAccount not implemented") +} +func (UnimplementedUserManagementServer) mustEmbedUnimplementedUserManagementServer() {} +func (UnimplementedUserManagementServer) testEmbeddedByValue() {} + +// UnsafeUserManagementServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to UserManagementServer will +// result in compilation errors. +type UnsafeUserManagementServer interface { + mustEmbedUnimplementedUserManagementServer() +} + +func RegisterUserManagementServer(s grpc.ServiceRegistrar, srv UserManagementServer) { + // If the following call pancis, it indicates UnimplementedUserManagementServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&UserManagement_ServiceDesc, srv) +} + +func _UserManagement_Ping_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserManagementServer).Ping(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: UserManagement_Ping_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserManagementServer).Ping(ctx, req.(*Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _UserManagement_SetAppAccount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SetAppUserRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserManagementServer).SetAppAccount(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: UserManagement_SetAppAccount_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserManagementServer).SetAppAccount(ctx, req.(*SetAppUserRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// UserManagement_ServiceDesc is the grpc.ServiceDesc for UserManagement service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var UserManagement_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "user_management.User_management", + HandlerType: (*UserManagementServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Ping", + Handler: _UserManagement_Ping_Handler, + }, + { + MethodName: "SetAppAccount", + Handler: _UserManagement_SetAppAccount_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "user_management.proto", +} diff --git a/user_management/user_management_client/user_management.go b/user_management/user_management_client/user_management.go new file mode 100644 index 0000000..871c6b4 --- /dev/null +++ b/user_management/user_management_client/user_management.go @@ -0,0 +1,45 @@ +// Code generated by goctl. DO NOT EDIT. +// goctl 1.7.6 +// Source: user_management.proto + +package user_management_client + +import ( + "context" + + "gitea.youtukeji.com.cn/xiabin/youtu_grpc/user_management/user_management" + + "github.com/zeromicro/go-zero/zrpc" + "google.golang.org/grpc" +) + +type ( + Request = user_management.Request + Response = user_management.Response + SetAppUserRequest = user_management.SetAppUserRequest + + UserManagement interface { + Ping(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) + SetAppAccount(ctx context.Context, in *SetAppUserRequest, opts ...grpc.CallOption) (*Response, error) + } + + defaultUserManagement struct { + cli zrpc.Client + } +) + +func NewUserManagement(cli zrpc.Client) UserManagement { + return &defaultUserManagement{ + cli: cli, + } +} + +func (m *defaultUserManagement) Ping(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) { + client := user_management.NewUserManagementClient(m.cli.Conn()) + return client.Ping(ctx, in, opts...) +} + +func (m *defaultUserManagement) SetAppAccount(ctx context.Context, in *SetAppUserRequest, opts ...grpc.CallOption) (*Response, error) { + client := user_management.NewUserManagementClient(m.cli.Conn()) + return client.SetAppAccount(ctx, in, opts...) +}