From 12958863b1935f6b31aca1687783b5163c104baa Mon Sep 17 00:00:00 2001 From: maomao <2509665064@qq.com> Date: Sun, 11 Aug 2024 17:17:55 +0800 Subject: [PATCH] init backend/verifyCode --- .../api/verifyCode/verifyCode.pb.go | 290 ++++++++++++++++++ .../api/verifyCode/verifyCode.proto | 26 ++ .../api/verifyCode/verifyCode_grpc.pb.go | 121 ++++++++ backend/verifyCode/cmd/verifyCode/wire_gen.go | 3 +- backend/verifyCode/go.mod | 26 +- backend/verifyCode/go.sum | 77 ++--- backend/verifyCode/internal/server/grpc.go | 11 +- .../verifyCode/internal/service/service.go | 3 +- .../verifyCode/internal/service/verifycode.go | 50 +++ backend/verifyCode/openapi.yaml | 35 +-- 10 files changed, 555 insertions(+), 87 deletions(-) create mode 100644 backend/verifyCode/api/verifyCode/verifyCode.pb.go create mode 100644 backend/verifyCode/api/verifyCode/verifyCode.proto create mode 100644 backend/verifyCode/api/verifyCode/verifyCode_grpc.pb.go create mode 100644 backend/verifyCode/internal/service/verifycode.go diff --git a/backend/verifyCode/api/verifyCode/verifyCode.pb.go b/backend/verifyCode/api/verifyCode/verifyCode.pb.go new file mode 100644 index 0000000..d296143 --- /dev/null +++ b/backend/verifyCode/api/verifyCode/verifyCode.pb.go @@ -0,0 +1,290 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.34.2 +// protoc v3.21.12 +// source: api/verifyCode/verifyCode.proto + +package verifyCode + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +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 TYPE int32 + +const ( + TYPE_DEFAULT TYPE = 0 + TYPE_DIGIT TYPE = 1 + TYPE_LETTRE TYPE = 2 + TYPE_MIXED TYPE = 3 +) + +// Enum value maps for TYPE. +var ( + TYPE_name = map[int32]string{ + 0: "DEFAULT", + 1: "DIGIT", + 2: "LETTRE", + 3: "MIXED", + } + TYPE_value = map[string]int32{ + "DEFAULT": 0, + "DIGIT": 1, + "LETTRE": 2, + "MIXED": 3, + } +) + +func (x TYPE) Enum() *TYPE { + p := new(TYPE) + *p = x + return p +} + +func (x TYPE) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (TYPE) Descriptor() protoreflect.EnumDescriptor { + return file_api_verifyCode_verifyCode_proto_enumTypes[0].Descriptor() +} + +func (TYPE) Type() protoreflect.EnumType { + return &file_api_verifyCode_verifyCode_proto_enumTypes[0] +} + +func (x TYPE) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use TYPE.Descriptor instead. +func (TYPE) EnumDescriptor() ([]byte, []int) { + return file_api_verifyCode_verifyCode_proto_rawDescGZIP(), []int{0} +} + +// 接口请求参数结构 +type GetVerifyCodeRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Length uint32 `protobuf:"varint,1,opt,name=length,proto3" json:"length,omitempty"` + Type TYPE `protobuf:"varint,2,opt,name=type,proto3,enum=api.verifyCode.TYPE" json:"type,omitempty"` +} + +func (x *GetVerifyCodeRequest) Reset() { + *x = GetVerifyCodeRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_api_verifyCode_verifyCode_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetVerifyCodeRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetVerifyCodeRequest) ProtoMessage() {} + +func (x *GetVerifyCodeRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_verifyCode_verifyCode_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetVerifyCodeRequest.ProtoReflect.Descriptor instead. +func (*GetVerifyCodeRequest) Descriptor() ([]byte, []int) { + return file_api_verifyCode_verifyCode_proto_rawDescGZIP(), []int{0} +} + +func (x *GetVerifyCodeRequest) GetLength() uint32 { + if x != nil { + return x.Length + } + return 0 +} + +func (x *GetVerifyCodeRequest) GetType() TYPE { + if x != nil { + return x.Type + } + return TYPE_DEFAULT +} + +// 接口返回值结构 +type GetVerifyCodeReply struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Code string `protobuf:"bytes,1,opt,name=code,proto3" json:"code,omitempty"` +} + +func (x *GetVerifyCodeReply) Reset() { + *x = GetVerifyCodeReply{} + if protoimpl.UnsafeEnabled { + mi := &file_api_verifyCode_verifyCode_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetVerifyCodeReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetVerifyCodeReply) ProtoMessage() {} + +func (x *GetVerifyCodeReply) ProtoReflect() protoreflect.Message { + mi := &file_api_verifyCode_verifyCode_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetVerifyCodeReply.ProtoReflect.Descriptor instead. +func (*GetVerifyCodeReply) Descriptor() ([]byte, []int) { + return file_api_verifyCode_verifyCode_proto_rawDescGZIP(), []int{1} +} + +func (x *GetVerifyCodeReply) GetCode() string { + if x != nil { + return x.Code + } + return "" +} + +var File_api_verifyCode_verifyCode_proto protoreflect.FileDescriptor + +var file_api_verifyCode_verifyCode_proto_rawDesc = []byte{ + 0x0a, 0x1f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x43, 0x6f, 0x64, 0x65, + 0x2f, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x12, 0x0e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x43, 0x6f, 0x64, + 0x65, 0x22, 0x58, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x43, 0x6f, + 0x64, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x65, 0x6e, + 0x67, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, + 0x68, 0x12, 0x28, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, + 0x14, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x43, 0x6f, 0x64, 0x65, + 0x2e, 0x54, 0x59, 0x50, 0x45, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x22, 0x28, 0x0a, 0x12, 0x47, + 0x65, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x70, 0x6c, + 0x79, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x63, 0x6f, 0x64, 0x65, 0x2a, 0x35, 0x0a, 0x04, 0x54, 0x59, 0x50, 0x45, 0x12, 0x0b, 0x0a, + 0x07, 0x44, 0x45, 0x46, 0x41, 0x55, 0x4c, 0x54, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x44, 0x49, + 0x47, 0x49, 0x54, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x4c, 0x45, 0x54, 0x54, 0x52, 0x45, 0x10, + 0x02, 0x12, 0x09, 0x0a, 0x05, 0x4d, 0x49, 0x58, 0x45, 0x44, 0x10, 0x03, 0x32, 0x67, 0x0a, 0x0a, + 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x59, 0x0a, 0x0d, 0x47, 0x65, + 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x24, 0x2e, 0x61, 0x70, + 0x69, 0x2e, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x2e, 0x47, 0x65, 0x74, + 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x22, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x43, 0x6f, + 0x64, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x43, 0x6f, 0x64, 0x65, + 0x52, 0x65, 0x70, 0x6c, 0x79, 0x42, 0x38, 0x0a, 0x0e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x65, 0x72, + 0x69, 0x66, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x50, 0x01, 0x5a, 0x24, 0x76, 0x65, 0x72, 0x69, 0x66, + 0x79, 0x43, 0x6f, 0x64, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, + 0x43, 0x6f, 0x64, 0x65, 0x3b, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_api_verifyCode_verifyCode_proto_rawDescOnce sync.Once + file_api_verifyCode_verifyCode_proto_rawDescData = file_api_verifyCode_verifyCode_proto_rawDesc +) + +func file_api_verifyCode_verifyCode_proto_rawDescGZIP() []byte { + file_api_verifyCode_verifyCode_proto_rawDescOnce.Do(func() { + file_api_verifyCode_verifyCode_proto_rawDescData = protoimpl.X.CompressGZIP(file_api_verifyCode_verifyCode_proto_rawDescData) + }) + return file_api_verifyCode_verifyCode_proto_rawDescData +} + +var file_api_verifyCode_verifyCode_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_api_verifyCode_verifyCode_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_api_verifyCode_verifyCode_proto_goTypes = []any{ + (TYPE)(0), // 0: api.verifyCode.TYPE + (*GetVerifyCodeRequest)(nil), // 1: api.verifyCode.GetVerifyCodeRequest + (*GetVerifyCodeReply)(nil), // 2: api.verifyCode.GetVerifyCodeReply +} +var file_api_verifyCode_verifyCode_proto_depIdxs = []int32{ + 0, // 0: api.verifyCode.GetVerifyCodeRequest.type:type_name -> api.verifyCode.TYPE + 1, // 1: api.verifyCode.VerifyCode.GetVerifyCode:input_type -> api.verifyCode.GetVerifyCodeRequest + 2, // 2: api.verifyCode.VerifyCode.GetVerifyCode:output_type -> api.verifyCode.GetVerifyCodeReply + 2, // [2:3] is the sub-list for method output_type + 1, // [1:2] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_api_verifyCode_verifyCode_proto_init() } +func file_api_verifyCode_verifyCode_proto_init() { + if File_api_verifyCode_verifyCode_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_api_verifyCode_verifyCode_proto_msgTypes[0].Exporter = func(v any, i int) any { + switch v := v.(*GetVerifyCodeRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_verifyCode_verifyCode_proto_msgTypes[1].Exporter = func(v any, i int) any { + switch v := v.(*GetVerifyCodeReply); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_api_verifyCode_verifyCode_proto_rawDesc, + NumEnums: 1, + NumMessages: 2, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_api_verifyCode_verifyCode_proto_goTypes, + DependencyIndexes: file_api_verifyCode_verifyCode_proto_depIdxs, + EnumInfos: file_api_verifyCode_verifyCode_proto_enumTypes, + MessageInfos: file_api_verifyCode_verifyCode_proto_msgTypes, + }.Build() + File_api_verifyCode_verifyCode_proto = out.File + file_api_verifyCode_verifyCode_proto_rawDesc = nil + file_api_verifyCode_verifyCode_proto_goTypes = nil + file_api_verifyCode_verifyCode_proto_depIdxs = nil +} diff --git a/backend/verifyCode/api/verifyCode/verifyCode.proto b/backend/verifyCode/api/verifyCode/verifyCode.proto new file mode 100644 index 0000000..b37d47b --- /dev/null +++ b/backend/verifyCode/api/verifyCode/verifyCode.proto @@ -0,0 +1,26 @@ +syntax = "proto3"; + +package api.verifyCode; + +option go_package = "verifyCode/api/verifyCode;verifyCode"; +option java_multiple_files = true; +option java_package = "api.verifyCode"; + +service VerifyCode { + rpc GetVerifyCode (GetVerifyCodeRequest) returns (GetVerifyCodeReply); +} +enum TYPE{ + DEFAULT = 0; + DIGIT =1; + LETTRE =2; + MIXED =3; +} +//接口请求参数结构 +message GetVerifyCodeRequest { + uint32 length = 1; + TYPE type = 2; +} +//接口返回值结构 +message GetVerifyCodeReply { + string code=1; +} diff --git a/backend/verifyCode/api/verifyCode/verifyCode_grpc.pb.go b/backend/verifyCode/api/verifyCode/verifyCode_grpc.pb.go new file mode 100644 index 0000000..28c168c --- /dev/null +++ b/backend/verifyCode/api/verifyCode/verifyCode_grpc.pb.go @@ -0,0 +1,121 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.5.1 +// - protoc v3.21.12 +// source: api/verifyCode/verifyCode.proto + +package verifyCode + +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 ( + VerifyCode_GetVerifyCode_FullMethodName = "/api.verifyCode.VerifyCode/GetVerifyCode" +) + +// VerifyCodeClient is the client API for VerifyCode 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 VerifyCodeClient interface { + GetVerifyCode(ctx context.Context, in *GetVerifyCodeRequest, opts ...grpc.CallOption) (*GetVerifyCodeReply, error) +} + +type verifyCodeClient struct { + cc grpc.ClientConnInterface +} + +func NewVerifyCodeClient(cc grpc.ClientConnInterface) VerifyCodeClient { + return &verifyCodeClient{cc} +} + +func (c *verifyCodeClient) GetVerifyCode(ctx context.Context, in *GetVerifyCodeRequest, opts ...grpc.CallOption) (*GetVerifyCodeReply, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetVerifyCodeReply) + err := c.cc.Invoke(ctx, VerifyCode_GetVerifyCode_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// VerifyCodeServer is the server API for VerifyCode service. +// All implementations must embed UnimplementedVerifyCodeServer +// for forward compatibility. +type VerifyCodeServer interface { + GetVerifyCode(context.Context, *GetVerifyCodeRequest) (*GetVerifyCodeReply, error) + mustEmbedUnimplementedVerifyCodeServer() +} + +// UnimplementedVerifyCodeServer 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 UnimplementedVerifyCodeServer struct{} + +func (UnimplementedVerifyCodeServer) GetVerifyCode(context.Context, *GetVerifyCodeRequest) (*GetVerifyCodeReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetVerifyCode not implemented") +} +func (UnimplementedVerifyCodeServer) mustEmbedUnimplementedVerifyCodeServer() {} +func (UnimplementedVerifyCodeServer) testEmbeddedByValue() {} + +// UnsafeVerifyCodeServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to VerifyCodeServer will +// result in compilation errors. +type UnsafeVerifyCodeServer interface { + mustEmbedUnimplementedVerifyCodeServer() +} + +func RegisterVerifyCodeServer(s grpc.ServiceRegistrar, srv VerifyCodeServer) { + // If the following call pancis, it indicates UnimplementedVerifyCodeServer 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(&VerifyCode_ServiceDesc, srv) +} + +func _VerifyCode_GetVerifyCode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetVerifyCodeRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(VerifyCodeServer).GetVerifyCode(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: VerifyCode_GetVerifyCode_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(VerifyCodeServer).GetVerifyCode(ctx, req.(*GetVerifyCodeRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// VerifyCode_ServiceDesc is the grpc.ServiceDesc for VerifyCode service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var VerifyCode_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "api.verifyCode.VerifyCode", + HandlerType: (*VerifyCodeServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetVerifyCode", + Handler: _VerifyCode_GetVerifyCode_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "api/verifyCode/verifyCode.proto", +} diff --git a/backend/verifyCode/cmd/verifyCode/wire_gen.go b/backend/verifyCode/cmd/verifyCode/wire_gen.go index a6c75d4..eda4387 100644 --- a/backend/verifyCode/cmd/verifyCode/wire_gen.go +++ b/backend/verifyCode/cmd/verifyCode/wire_gen.go @@ -31,7 +31,8 @@ func wireApp(confServer *conf.Server, confData *conf.Data, logger log.Logger) (* greeterRepo := data.NewGreeterRepo(dataData, logger) greeterUsecase := biz.NewGreeterUsecase(greeterRepo, logger) greeterService := service.NewGreeterService(greeterUsecase) - grpcServer := server.NewGRPCServer(confServer, greeterService, logger) + verifyCodeService := service.NewVerifyCodeService() + grpcServer := server.NewGRPCServer(confServer, greeterService, verifyCodeService, logger) httpServer := server.NewHTTPServer(confServer, greeterService, logger) app := newApp(logger, grpcServer, httpServer) return app, func() { diff --git a/backend/verifyCode/go.mod b/backend/verifyCode/go.mod index 8ac0084..0543fbe 100644 --- a/backend/verifyCode/go.mod +++ b/backend/verifyCode/go.mod @@ -1,14 +1,16 @@ module verifyCode -go 1.19 +go 1.21 + +toolchain go1.22.4 require ( github.com/go-kratos/kratos/v2 v2.7.2 github.com/google/wire v0.6.0 go.uber.org/automaxprocs v1.5.1 - google.golang.org/genproto/googleapis/api v0.0.0-20230629202037-9506855d4529 - google.golang.org/grpc v1.56.3 - google.golang.org/protobuf v1.32.0 + google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 + google.golang.org/grpc v1.65.0 + google.golang.org/protobuf v1.34.2 ) require ( @@ -17,23 +19,17 @@ require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-playground/form/v4 v4.2.1 // indirect - github.com/golang/protobuf v1.5.3 // indirect - github.com/google/subcommands v1.2.0 // indirect github.com/google/uuid v1.6.0 // indirect github.com/gorilla/mux v1.8.0 // indirect github.com/imdario/mergo v0.3.16 // indirect github.com/kr/text v0.2.0 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel v1.16.0 // indirect go.opentelemetry.io/otel/metric v1.16.0 // indirect go.opentelemetry.io/otel/trace v1.16.0 // indirect - golang.org/x/mod v0.14.0 // indirect - golang.org/x/net v0.20.0 // indirect - golang.org/x/sync v0.6.0 // indirect - golang.org/x/sys v0.16.0 // indirect - golang.org/x/text v0.14.0 // indirect - golang.org/x/tools v0.17.0 // indirect - google.golang.org/genproto v0.0.0-20230629202037-9506855d4529 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20230629202037-9506855d4529 // indirect + golang.org/x/net v0.28.0 // indirect + golang.org/x/sync v0.8.0 // indirect + golang.org/x/sys v0.24.0 // indirect + golang.org/x/text v0.17.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/backend/verifyCode/go.sum b/backend/verifyCode/go.sum index d025d55..344ecf6 100644 --- a/backend/verifyCode/go.sum +++ b/backend/verifyCode/go.sum @@ -1,9 +1,16 @@ +cel.dev/expr v0.15.0 h1:O1jzfJCQBfL5BFoYktaxwIhuttaQPsVWerH9/EEKx0w= +cel.dev/expr v0.15.0/go.mod h1:TRSuuV7DlVCE/uwv5QbAiW/v8l5O8C4eEPHeu7gf7Sg= github.com/census-instrumentation/opencensus-proto v0.4.1 h1:iKLQ0xPNFxR/2hzXZMrBo8f1j86j5WHzznCCQxV/b8g= -github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4 h1:/inchEIKaYC1Akx+H+gqO04wryn5h75LSazbRlnya1k= +github.com/census-instrumentation/opencensus-proto v0.4.1/go.mod h1:4T9NM4+4Vw91VeyqjLS6ao50K5bOcLKN6Q42XnYaRYw= +github.com/cncf/xds/go v0.0.0-20240423153145-555b57ec207b h1:ga8SEFjZ60pxLcmhnThWgvH2wg8376yUJmPhEH4H3kw= +github.com/cncf/xds/go v0.0.0-20240423153145-555b57ec207b/go.mod h1:W+zGtBO5Y1IgJhy4+A9GOqVhqLpfZi+vwmdNXUehLA8= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/envoyproxy/go-control-plane v0.11.2-0.20230627204322-7d0032219fcb h1:kxNVXsNro/lpR5WD+P1FI/yUHn2G03Glber3k8cQL2Y= -github.com/envoyproxy/protoc-gen-validate v0.10.1 h1:c0g45+xCJhdgFGw7a5QAfdS4byAbud7miNWJ1WwEVf8= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/envoyproxy/go-control-plane v0.12.0 h1:4X+VP1GHd1Mhj6IB5mMeGbLCleqxjletLK6K0rbxyZI= +github.com/envoyproxy/go-control-plane v0.12.0/go.mod h1:ZBTaoJ23lqITozF0M6G4/IragXCQKCnYbmlmtHvwRG0= +github.com/envoyproxy/protoc-gen-validate v1.0.4 h1:gVPz/FMfvh57HdSJQyvBtF00j8JU4zdyUgIUNhlgg0A= +github.com/envoyproxy/protoc-gen-validate v1.0.4/go.mod h1:qys6tmnRsYrQqIhm2bvKZH4Blx/1gTIZ2UKVY1M+Yew= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= github.com/go-kratos/aegis v0.2.0 h1:dObzCDWn3XVjUkgxyBp6ZeWtx/do0DPZ7LY3yNSJLUQ= @@ -19,19 +26,15 @@ github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBY github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/form/v4 v4.2.1 h1:HjdRDKO0fftVMU5epjPW2SOREcZ6/wLUzEobqUGJuPw= github.com/go-playground/form/v4 v4.2.1/go.mod h1:q1a2BY+AQUUzhl6xA/6hBetay6dEIhMHjgvJiGo6K7U= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/subcommands v1.0.1/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk= +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/subcommands v1.2.0 h1:vWQspBTo2nEqTUFita5/KeEWlUL8kQObDFbub/EN9oE= github.com/google/subcommands v1.2.0/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk= 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/google/wire v0.5.0 h1:I7ELFeVBr3yfPIcc8+MWvrjk+3VjbcSzoXm3JVa+jD8= -github.com/google/wire v0.5.0/go.mod h1:ngWDr9Qvq3yZA10YrxfyGELY/AFWGVpy9c1LTRi1EoU= github.com/google/wire v0.6.0 h1:HBkoIh4BdSxoyo9PveV8giw7ZsaBOvzWKfcg/6MrVwI= github.com/google/wire v0.6.0/go.mod h1:F4QhpQ9EDIdJ1Mbop/NZBRB+5yrR6qg3BnctaoUk6NA= github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= @@ -39,19 +42,24 @@ github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB7 github.com/imdario/mergo v0.3.16 h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4= github.com/imdario/mergo v0.3.16/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= 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/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/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= +github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.opentelemetry.io/otel v1.16.0 h1:Z7GVAX/UkAXPKsy94IU+i6thsQS4nb7LviLpnaNeW8s= go.opentelemetry.io/otel v1.16.0/go.mod h1:vl0h9NUa1D5s1nv3A5vZOYWn8av4K8Ml6JDeHrT/bx4= go.opentelemetry.io/otel/metric v1.16.0 h1:RbrpwVG1Hfv85LgnZ7+txXioPDoh6EdbZHo26Q3hqOo= go.opentelemetry.io/otel/metric v1.16.0/go.mod h1:QE47cpOmkwipPiefDwo2wDzwJrlfxxNYodqc4xnGCo4= go.opentelemetry.io/otel/sdk v1.16.0 h1:Z1Ok1YsijYL0CSJpHt4cS3wDDh7p572grzNrBMiMWgE= +go.opentelemetry.io/otel/sdk v1.16.0/go.mod h1:tMsIuKXuuIWPBAOrH+eHtvhTL+SntFtXF9QD68aP6p4= go.opentelemetry.io/otel/trace v1.16.0 h1:8JRpaObFoW0pxuVPapkgH8UhHQj+bJW8jJsCZEu5MQs= go.opentelemetry.io/otel/trace v1.16.0/go.mod h1:Yt9vYq1SdNz3xdjZZK7wcXv1qv2pwLkqr2QVwea0ef0= go.uber.org/automaxprocs v1.5.1 h1:e1YG66Lrk73dn4qhg8WFSvhF0JuFQF0ERIp4rpuV8Qk= @@ -63,25 +71,25 @@ golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1m golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0= golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= +golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= -golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= -golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= +golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= +golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= -golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= +golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -91,10 +99,9 @@ golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= +golang.org/x/sys v0.24.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.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= @@ -106,33 +113,29 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= +golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190422233926-fe54fb35175b/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= -golang.org/x/tools v0.17.0 h1:FvmRgNOcs3kOa+T20R1uhfP9F6HgG2mfxDv1vrx1Htc= golang.org/x/tools v0.17.0/go.mod h1:xsh6VxdV005rRVaS6SSAf9oiAqljS7UZUacMZ8Bnsps= +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-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto v0.0.0-20230629202037-9506855d4529 h1:9JucMWR7sPvCxUFd6UsOUNmA5kCcWOfORaT3tpAsKQs= -google.golang.org/genproto v0.0.0-20230629202037-9506855d4529/go.mod h1:xZnkP7mREFX5MORlOPEzLMr+90PPZQ2QWzrVTWfAq64= -google.golang.org/genproto/googleapis/api v0.0.0-20230629202037-9506855d4529 h1:s5YSX+ZH5b5vS9rnpGymvIyMpLRJizowqDlOuyjXnTk= -google.golang.org/genproto/googleapis/api v0.0.0-20230629202037-9506855d4529/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230629202037-9506855d4529 h1:DEH99RbiLZhMxrpEJCZ0A+wdTe0EOgou/poSLx9vWf4= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230629202037-9506855d4529/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= -google.golang.org/grpc v1.56.3 h1:8I4C0Yq1EjstUzUJzpcRVbuYA2mODtEmpWiQoN/b2nc= -google.golang.org/grpc v1.56.3/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= -google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 h1:7whR9kGa5LUwFtpLm2ArCEejtnxlGeLbAyjFY8sGNFw= +google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157/go.mod h1:99sLkeliLXfdj2J75X3Ho+rrVCaJze0uwN7zDDkjPVU= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a h1:EKiZZXueP9/T68B8Nl0GAx9cjbQnCId0yP3qPMgaaHs= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= +google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= +google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= +google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= +google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= 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/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/backend/verifyCode/internal/server/grpc.go b/backend/verifyCode/internal/server/grpc.go index 5849968..57d5d92 100644 --- a/backend/verifyCode/internal/server/grpc.go +++ b/backend/verifyCode/internal/server/grpc.go @@ -2,6 +2,7 @@ package server import ( v1 "verifyCode/api/helloworld/v1" + "verifyCode/api/verifyCode" "verifyCode/internal/conf" "verifyCode/internal/service" @@ -11,7 +12,11 @@ import ( ) // NewGRPCServer new a gRPC server. -func NewGRPCServer(c *conf.Server, greeter *service.GreeterService, logger log.Logger) *grpc.Server { +func NewGRPCServer(c *conf.Server, + greeter *service.GreeterService, + //增加需要使用的服务作为参数 + verifyCoderService *service.VerifyCodeService, + logger log.Logger) *grpc.Server { var opts = []grpc.ServerOption{ grpc.Middleware( recovery.Recovery(), @@ -28,5 +33,9 @@ func NewGRPCServer(c *conf.Server, greeter *service.GreeterService, logger log.L } srv := grpc.NewServer(opts...) v1.RegisterGreeterServer(srv, greeter) + + //完成当前服务的注册,verifyCode + verifyCode.RegisterVerifyCodeServer(srv, verifyCoderService) + return srv } diff --git a/backend/verifyCode/internal/service/service.go b/backend/verifyCode/internal/service/service.go index 5e32840..78f8625 100644 --- a/backend/verifyCode/internal/service/service.go +++ b/backend/verifyCode/internal/service/service.go @@ -3,4 +3,5 @@ package service import "github.com/google/wire" // ProviderSet is service providers. -var ProviderSet = wire.NewSet(NewGreeterService) +// 将verifyCode.go中的构造器:NewVerifyCodeService,告知给系统。此处代表函数名称,而不是函数调用 +var ProviderSet = wire.NewSet(NewGreeterService, NewVerifyCodeService) diff --git a/backend/verifyCode/internal/service/verifycode.go b/backend/verifyCode/internal/service/verifycode.go new file mode 100644 index 0000000..27e0748 --- /dev/null +++ b/backend/verifyCode/internal/service/verifycode.go @@ -0,0 +1,50 @@ +package service + +import ( + "context" + "math/rand" + + pb "verifyCode/api/verifyCode" +) + +type VerifyCodeService struct { + pb.UnimplementedVerifyCodeServer +} + +// 构造器 +func NewVerifyCodeService() *VerifyCodeService { + return &VerifyCodeService{} +} + +func (s *VerifyCodeService) GetVerifyCode(ctx context.Context, req *pb.GetVerifyCodeRequest) (*pb.GetVerifyCodeReply, error) { + return &pb.GetVerifyCodeReply{ + Code: RandCode(int(req.Length), req.Type), + }, nil +} +func RandCode(l int, r pb.TYPE) string { + switch r { + case pb.TYPE_DEFAULT: + + fallthrough + case pb.TYPE_DIGIT: + return randcode("0123456789", l) + case pb.TYPE_LETTRE: + return randcode("abcdefghigklmnopqrstuvwxyz", l) + case pb.TYPE_MIXED: + return randcode("0123456789abcdefghigklmnopqrstuvwxyz", l) + default: + + } + return "" +} + +// 随机的核心方法 +func randcode(chars string, l int) string { + charsLen := len(chars) + result := make([]byte, l) + for i := 0; i < l; i++ { + randIndex := rand.Intn(charsLen) + result[i] = chars[randIndex] + } + return string(result) +} diff --git a/backend/verifyCode/openapi.yaml b/backend/verifyCode/openapi.yaml index 6867057..f8f3735 100644 --- a/backend/verifyCode/openapi.yaml +++ b/backend/verifyCode/openapi.yaml @@ -3,37 +3,8 @@ openapi: 3.0.3 info: - title: Greeter API - description: The greeting service definition. + title: "" version: 0.0.1 -paths: - /helloworld/{name}: - get: - tags: - - Greeter - - subgroup - description: Sends a greeting - operationId: Greeter_SayHello - parameters: - - name: name - in: path - required: true - schema: - type: string - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/helloworld.v1.HelloReply' +paths: {} components: - schemas: - helloworld.v1.HelloReply: - type: object - properties: - message: - type: string - description: The response message containing the greetings -tags: - - name: Greeter + schemas: {}