From a3b6c12a401ee6fc12d96eed0b114a42a9573217 Mon Sep 17 00:00:00 2001 From: hanJoker Date: Fri, 23 Sep 2022 22:08:35 +0800 Subject: [PATCH] update deply method --- README.md | 12 +- backend/Dockerfile | 13 + backend/customer/.gitignore | 3 + backend/customer/api/customer/customer.pb.go | 467 ------------------ backend/customer/api/customer/customer.proto | 79 --- .../customer/api/customer/customer_grpc.pb.go | 183 ------- .../customer/api/customer/customer_http.pb.go | 150 ------ .../customer/api/verifyCode/verifyCode.pb.go | 293 +++++++++++ .../customer/api/verifyCode/verifyCode.proto | 29 ++ .../api/verifyCode/verifyCode_grpc.pb.go | 105 ++++ backend/customer/cmd/customer/wire.go | 2 +- backend/customer/cmd/customer/wire_gen.go | 10 +- backend/customer/go.mod | 37 +- backend/customer/go.sum | 103 +++- backend/customer/internal/biz/biz.go | 6 +- .../customer/internal/biz/customer_http.go | 45 ++ backend/customer/internal/biz/greeter.go | 46 -- backend/customer/internal/data/data.go | 16 +- backend/customer/internal/data/greeter.go | 42 -- backend/customer/internal/server/grpc.go | 7 +- backend/customer/internal/server/http.go | 11 +- backend/customer/internal/server/server.go | 2 +- backend/customer/internal/service/customer.go | 44 -- .../internal/service/customer_http.go | 70 +++ backend/customer/internal/service/greeter.go | 29 -- backend/customer/internal/service/service.go | 2 +- backend/verifyCode/Makefile | 2 +- backend/verifyCode/cmd/verifyCode/main.go | 6 +- run/Dockerfile | 10 + run/docker-compose.yml | 9 + volumes/redis/dump.rdb | Bin 0 -> 88 bytes 31 files changed, 731 insertions(+), 1102 deletions(-) create mode 100644 backend/Dockerfile delete mode 100644 backend/customer/api/customer/customer.pb.go delete mode 100644 backend/customer/api/customer/customer.proto delete mode 100644 backend/customer/api/customer/customer_grpc.pb.go delete mode 100644 backend/customer/api/customer/customer_http.pb.go create mode 100644 backend/customer/api/verifyCode/verifyCode.pb.go create mode 100644 backend/customer/api/verifyCode/verifyCode.proto create mode 100644 backend/customer/api/verifyCode/verifyCode_grpc.pb.go create mode 100644 backend/customer/internal/biz/customer_http.go delete mode 100644 backend/customer/internal/biz/greeter.go delete mode 100644 backend/customer/internal/data/greeter.go delete mode 100644 backend/customer/internal/service/customer.go create mode 100644 backend/customer/internal/service/customer_http.go delete mode 100644 backend/customer/internal/service/greeter.go create mode 100644 run/Dockerfile create mode 100644 run/docker-compose.yml create mode 100644 volumes/redis/dump.rdb diff --git a/README.md b/README.md index aed68ef..c09b94a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,14 @@ # 老马代驾 -## 运行方法 -安装 docker +## docker compose 测试运行 +依赖 +* docker +* docker-composer + +运行项目: +```shell +$ cd path/to/laoma +$ docker-compose up +``` ## 目录结构 ```shell diff --git a/backend/Dockerfile b/backend/Dockerfile new file mode 100644 index 0000000..2faefa4 --- /dev/null +++ b/backend/Dockerfile @@ -0,0 +1,13 @@ +FROM golang:1.19 + +COPY ../verifyCode /src +WORKDIR /src + +RUN GOPROXY=https://goproxy.cn,direct go install github.com/go-kratos/kratos/cmd/kratos/v2@latest +RUN GOPROXY=https://goproxy.cn,direct go mod tidy + +EXPOSE 8000 +EXPOSE 9000 +VOLUME /data/conf + +CMD ["kratos", "run"] \ No newline at end of file diff --git a/backend/customer/.gitignore b/backend/customer/.gitignore index fe21f01..f2358ce 100644 --- a/backend/customer/.gitignore +++ b/backend/customer/.gitignore @@ -37,3 +37,6 @@ bin/ .vscode/ .idea/ *.swp + +# volumes +volumes/ diff --git a/backend/customer/api/customer/customer.pb.go b/backend/customer/api/customer/customer.pb.go deleted file mode 100644 index 8e54792..0000000 --- a/backend/customer/api/customer/customer.pb.go +++ /dev/null @@ -1,467 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.6 -// source: api/customer/customer.proto - -package customer - -import ( - _ "google.golang.org/genproto/googleapis/api/annotations" - 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 GetVerifyCodeReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - PhoneNumber string `protobuf:"bytes,1,opt,name=phoneNumber,proto3" json:"phoneNumber,omitempty"` -} - -func (x *GetVerifyCodeReq) Reset() { - *x = GetVerifyCodeReq{} - if protoimpl.UnsafeEnabled { - mi := &file_api_customer_customer_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetVerifyCodeReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetVerifyCodeReq) ProtoMessage() {} - -func (x *GetVerifyCodeReq) ProtoReflect() protoreflect.Message { - mi := &file_api_customer_customer_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 GetVerifyCodeReq.ProtoReflect.Descriptor instead. -func (*GetVerifyCodeReq) Descriptor() ([]byte, []int) { - return file_api_customer_customer_proto_rawDescGZIP(), []int{0} -} - -func (x *GetVerifyCodeReq) GetPhoneNumber() string { - if x != nil { - return x.PhoneNumber - } - return "" -} - -type GetVerifyCodeReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // 是否有错误 - Error bool `protobuf:"varint,1,opt,name=error,proto3" json:"error,omitempty"` - Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` - // 验证码有效时长,单位 s - Duration int32 `protobuf:"varint,3,opt,name=duration,proto3" json:"duration,omitempty"` -} - -func (x *GetVerifyCodeReply) Reset() { - *x = GetVerifyCodeReply{} - if protoimpl.UnsafeEnabled { - mi := &file_api_customer_customer_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_customer_customer_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_customer_customer_proto_rawDescGZIP(), []int{1} -} - -func (x *GetVerifyCodeReply) GetError() bool { - if x != nil { - return x.Error - } - return false -} - -func (x *GetVerifyCodeReply) GetMessage() string { - if x != nil { - return x.Message - } - return "" -} - -func (x *GetVerifyCodeReply) GetDuration() int32 { - if x != nil { - return x.Duration - } - return 0 -} - -type LoginReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *LoginReq) Reset() { - *x = LoginReq{} - if protoimpl.UnsafeEnabled { - mi := &file_api_customer_customer_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *LoginReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*LoginReq) ProtoMessage() {} - -func (x *LoginReq) ProtoReflect() protoreflect.Message { - mi := &file_api_customer_customer_proto_msgTypes[2] - 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 LoginReq.ProtoReflect.Descriptor instead. -func (*LoginReq) Descriptor() ([]byte, []int) { - return file_api_customer_customer_proto_rawDescGZIP(), []int{2} -} - -type LoginReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *LoginReply) Reset() { - *x = LoginReply{} - if protoimpl.UnsafeEnabled { - mi := &file_api_customer_customer_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *LoginReply) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*LoginReply) ProtoMessage() {} - -func (x *LoginReply) ProtoReflect() protoreflect.Message { - mi := &file_api_customer_customer_proto_msgTypes[3] - 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 LoginReply.ProtoReflect.Descriptor instead. -func (*LoginReply) Descriptor() ([]byte, []int) { - return file_api_customer_customer_proto_rawDescGZIP(), []int{3} -} - -type LogoutReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *LogoutReq) Reset() { - *x = LogoutReq{} - if protoimpl.UnsafeEnabled { - mi := &file_api_customer_customer_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *LogoutReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*LogoutReq) ProtoMessage() {} - -func (x *LogoutReq) ProtoReflect() protoreflect.Message { - mi := &file_api_customer_customer_proto_msgTypes[4] - 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 LogoutReq.ProtoReflect.Descriptor instead. -func (*LogoutReq) Descriptor() ([]byte, []int) { - return file_api_customer_customer_proto_rawDescGZIP(), []int{4} -} - -type LogoutReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *LogoutReply) Reset() { - *x = LogoutReply{} - if protoimpl.UnsafeEnabled { - mi := &file_api_customer_customer_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *LogoutReply) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*LogoutReply) ProtoMessage() {} - -func (x *LogoutReply) ProtoReflect() protoreflect.Message { - mi := &file_api_customer_customer_proto_msgTypes[5] - 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 LogoutReply.ProtoReflect.Descriptor instead. -func (*LogoutReply) Descriptor() ([]byte, []int) { - return file_api_customer_customer_proto_rawDescGZIP(), []int{5} -} - -var File_api_customer_customer_proto protoreflect.FileDescriptor - -var file_api_customer_customer_proto_rawDesc = []byte{ - 0x0a, 0x1b, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x2f, 0x63, - 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x61, - 0x70, 0x69, 0x2e, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x34, 0x0a, 0x10, 0x47, 0x65, 0x74, - 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x71, 0x12, 0x20, 0x0a, - 0x0b, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0b, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x22, - 0x60, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x43, 0x6f, 0x64, 0x65, - 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x6d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x22, 0x0a, 0x0a, 0x08, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x22, 0x0c, 0x0a, - 0x0a, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x0b, 0x0a, 0x09, 0x4c, - 0x6f, 0x67, 0x6f, 0x75, 0x74, 0x52, 0x65, 0x71, 0x22, 0x0d, 0x0a, 0x0b, 0x4c, 0x6f, 0x67, 0x6f, - 0x75, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x32, 0xbe, 0x02, 0x0a, 0x08, 0x43, 0x75, 0x73, 0x74, - 0x6f, 0x6d, 0x65, 0x72, 0x12, 0x82, 0x01, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x56, 0x65, 0x72, 0x69, - 0x66, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x1e, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x63, 0x75, 0x73, - 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x43, - 0x6f, 0x64, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x20, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x63, 0x75, 0x73, - 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x43, - 0x6f, 0x64, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x2f, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x29, - 0x12, 0x27, 0x2f, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x2f, 0x67, 0x65, 0x74, 0x2d, - 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x2d, 0x63, 0x6f, 0x64, 0x65, 0x2f, 0x7b, 0x70, 0x68, 0x6f, - 0x6e, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x7d, 0x12, 0x55, 0x0a, 0x05, 0x4c, 0x6f, 0x67, - 0x69, 0x6e, 0x12, 0x16, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, - 0x72, 0x2e, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x1a, 0x18, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x2e, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, - 0x65, 0x70, 0x6c, 0x79, 0x22, 0x1a, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, 0x22, 0x0f, 0x2f, 0x63, - 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x2f, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x3a, 0x01, 0x2a, - 0x12, 0x56, 0x0a, 0x06, 0x4c, 0x6f, 0x67, 0x6f, 0x75, 0x74, 0x12, 0x17, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x2e, 0x4c, 0x6f, 0x67, 0x6f, 0x75, 0x74, - 0x52, 0x65, 0x71, 0x1a, 0x19, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, - 0x65, 0x72, 0x2e, 0x4c, 0x6f, 0x67, 0x6f, 0x75, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x18, - 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x12, 0x2a, 0x10, 0x2f, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, - 0x72, 0x2f, 0x6c, 0x6f, 0x67, 0x6f, 0x75, 0x74, 0x42, 0x30, 0x0a, 0x0c, 0x61, 0x70, 0x69, 0x2e, - 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x50, 0x01, 0x5a, 0x1e, 0x63, 0x75, 0x73, 0x74, - 0x6f, 0x6d, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, - 0x72, 0x3b, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, -} - -var ( - file_api_customer_customer_proto_rawDescOnce sync.Once - file_api_customer_customer_proto_rawDescData = file_api_customer_customer_proto_rawDesc -) - -func file_api_customer_customer_proto_rawDescGZIP() []byte { - file_api_customer_customer_proto_rawDescOnce.Do(func() { - file_api_customer_customer_proto_rawDescData = protoimpl.X.CompressGZIP(file_api_customer_customer_proto_rawDescData) - }) - return file_api_customer_customer_proto_rawDescData -} - -var file_api_customer_customer_proto_msgTypes = make([]protoimpl.MessageInfo, 6) -var file_api_customer_customer_proto_goTypes = []interface{}{ - (*GetVerifyCodeReq)(nil), // 0: api.customer.GetVerifyCodeReq - (*GetVerifyCodeReply)(nil), // 1: api.customer.GetVerifyCodeReply - (*LoginReq)(nil), // 2: api.customer.LoginReq - (*LoginReply)(nil), // 3: api.customer.LoginReply - (*LogoutReq)(nil), // 4: api.customer.LogoutReq - (*LogoutReply)(nil), // 5: api.customer.LogoutReply -} -var file_api_customer_customer_proto_depIdxs = []int32{ - 0, // 0: api.customer.Customer.GetVerifyCode:input_type -> api.customer.GetVerifyCodeReq - 2, // 1: api.customer.Customer.Login:input_type -> api.customer.LoginReq - 4, // 2: api.customer.Customer.Logout:input_type -> api.customer.LogoutReq - 1, // 3: api.customer.Customer.GetVerifyCode:output_type -> api.customer.GetVerifyCodeReply - 3, // 4: api.customer.Customer.Login:output_type -> api.customer.LoginReply - 5, // 5: api.customer.Customer.Logout:output_type -> api.customer.LogoutReply - 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_api_customer_customer_proto_init() } -func file_api_customer_customer_proto_init() { - if File_api_customer_customer_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_api_customer_customer_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetVerifyCodeReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_customer_customer_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetVerifyCodeReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_customer_customer_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*LoginReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_customer_customer_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*LoginReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_customer_customer_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*LogoutReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_customer_customer_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*LogoutReply); 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_customer_customer_proto_rawDesc, - NumEnums: 0, - NumMessages: 6, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_api_customer_customer_proto_goTypes, - DependencyIndexes: file_api_customer_customer_proto_depIdxs, - MessageInfos: file_api_customer_customer_proto_msgTypes, - }.Build() - File_api_customer_customer_proto = out.File - file_api_customer_customer_proto_rawDesc = nil - file_api_customer_customer_proto_goTypes = nil - file_api_customer_customer_proto_depIdxs = nil -} diff --git a/backend/customer/api/customer/customer.proto b/backend/customer/api/customer/customer.proto deleted file mode 100644 index b6a3095..0000000 --- a/backend/customer/api/customer/customer.proto +++ /dev/null @@ -1,79 +0,0 @@ -syntax = "proto3"; - -package api.customer; - -import "google/api/annotations.proto"; - -option go_package = "customer/api/customer;customer"; -option java_multiple_files = true; -option java_package = "api.customer"; - -service Customer { - // 获取验证码 - rpc GetVerifyCode (GetVerifyCodeReq) returns (GetVerifyCodeReply) { - option (google.api.http) = { - get: "/customer/get-verify-code/{phoneNumber}" - }; - } - // 登录 - rpc Login (LoginReq) returns (LoginReply) { - option (google.api.http) = { - post: "/customer/login" - body: "*" - }; - } - // 退出 - rpc Logout (LogoutReq) returns (LogoutReply) { - option (google.api.http) = { - delete: "/customer/logout" - }; - } -} - -message GetVerifyCodeReq { - string phoneNumber = 1; -} -message GetVerifyCodeReply { -// 是否有错误 - bool error = 1; - string message = 2; -// 验证码有效时长,单位 s - int32 duration = 3; -} - -message LoginReq { - -} -message LoginReply { - -} -message LogoutReq { - -} -message LogoutReply { - -} - -// 原始代码 -//service Customer { -// rpc CreateCustomer (CreateCustomerRequest) returns (CreateCustomerReply); -// rpc UpdateCustomer (UpdateCustomerRequest) returns (UpdateCustomerReply); -// rpc DeleteCustomer (DeleteCustomerRequest) returns (DeleteCustomerReply); -// rpc GetCustomer (GetCustomerRequest) returns (GetCustomerReply); -// rpc ListCustomer (ListCustomerRequest) returns (ListCustomerReply); -//} - -//message CreateCustomerRequest {} -//message CreateCustomerReply {} -// -//message UpdateCustomerRequest {} -//message UpdateCustomerReply {} -// -//message DeleteCustomerRequest {} -//message DeleteCustomerReply {} -// -//message GetCustomerRequest {} -//message GetCustomerReply {} -// -//message ListCustomerRequest {} -//message ListCustomerReply {} \ No newline at end of file diff --git a/backend/customer/api/customer/customer_grpc.pb.go b/backend/customer/api/customer/customer_grpc.pb.go deleted file mode 100644 index 7dda304..0000000 --- a/backend/customer/api/customer/customer_grpc.pb.go +++ /dev/null @@ -1,183 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.2.0 -// - protoc v3.21.6 -// source: api/customer/customer.proto - -package customer - -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.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 - -// CustomerClient is the client API for Customer 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 CustomerClient interface { - // 获取验证码 - GetVerifyCode(ctx context.Context, in *GetVerifyCodeReq, opts ...grpc.CallOption) (*GetVerifyCodeReply, error) - // 登录 - Login(ctx context.Context, in *LoginReq, opts ...grpc.CallOption) (*LoginReply, error) - // 退出 - Logout(ctx context.Context, in *LogoutReq, opts ...grpc.CallOption) (*LogoutReply, error) -} - -type customerClient struct { - cc grpc.ClientConnInterface -} - -func NewCustomerClient(cc grpc.ClientConnInterface) CustomerClient { - return &customerClient{cc} -} - -func (c *customerClient) GetVerifyCode(ctx context.Context, in *GetVerifyCodeReq, opts ...grpc.CallOption) (*GetVerifyCodeReply, error) { - out := new(GetVerifyCodeReply) - err := c.cc.Invoke(ctx, "/api.customer.Customer/GetVerifyCode", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *customerClient) Login(ctx context.Context, in *LoginReq, opts ...grpc.CallOption) (*LoginReply, error) { - out := new(LoginReply) - err := c.cc.Invoke(ctx, "/api.customer.Customer/Login", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *customerClient) Logout(ctx context.Context, in *LogoutReq, opts ...grpc.CallOption) (*LogoutReply, error) { - out := new(LogoutReply) - err := c.cc.Invoke(ctx, "/api.customer.Customer/Logout", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// CustomerServer is the server API for Customer service. -// All implementations must embed UnimplementedCustomerServer -// for forward compatibility -type CustomerServer interface { - // 获取验证码 - GetVerifyCode(context.Context, *GetVerifyCodeReq) (*GetVerifyCodeReply, error) - // 登录 - Login(context.Context, *LoginReq) (*LoginReply, error) - // 退出 - Logout(context.Context, *LogoutReq) (*LogoutReply, error) - mustEmbedUnimplementedCustomerServer() -} - -// UnimplementedCustomerServer must be embedded to have forward compatible implementations. -type UnimplementedCustomerServer struct { -} - -func (UnimplementedCustomerServer) GetVerifyCode(context.Context, *GetVerifyCodeReq) (*GetVerifyCodeReply, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetVerifyCode not implemented") -} -func (UnimplementedCustomerServer) Login(context.Context, *LoginReq) (*LoginReply, error) { - return nil, status.Errorf(codes.Unimplemented, "method Login not implemented") -} -func (UnimplementedCustomerServer) Logout(context.Context, *LogoutReq) (*LogoutReply, error) { - return nil, status.Errorf(codes.Unimplemented, "method Logout not implemented") -} -func (UnimplementedCustomerServer) mustEmbedUnimplementedCustomerServer() {} - -// UnsafeCustomerServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to CustomerServer will -// result in compilation errors. -type UnsafeCustomerServer interface { - mustEmbedUnimplementedCustomerServer() -} - -func RegisterCustomerServer(s grpc.ServiceRegistrar, srv CustomerServer) { - s.RegisterService(&Customer_ServiceDesc, srv) -} - -func _Customer_GetVerifyCode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetVerifyCodeReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(CustomerServer).GetVerifyCode(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/api.customer.Customer/GetVerifyCode", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(CustomerServer).GetVerifyCode(ctx, req.(*GetVerifyCodeReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _Customer_Login_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(LoginReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(CustomerServer).Login(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/api.customer.Customer/Login", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(CustomerServer).Login(ctx, req.(*LoginReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _Customer_Logout_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(LogoutReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(CustomerServer).Logout(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/api.customer.Customer/Logout", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(CustomerServer).Logout(ctx, req.(*LogoutReq)) - } - return interceptor(ctx, in, info, handler) -} - -// Customer_ServiceDesc is the grpc.ServiceDesc for Customer service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var Customer_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "api.customer.Customer", - HandlerType: (*CustomerServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "GetVerifyCode", - Handler: _Customer_GetVerifyCode_Handler, - }, - { - MethodName: "Login", - Handler: _Customer_Login_Handler, - }, - { - MethodName: "Logout", - Handler: _Customer_Logout_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "api/customer/customer.proto", -} diff --git a/backend/customer/api/customer/customer_http.pb.go b/backend/customer/api/customer/customer_http.pb.go deleted file mode 100644 index f6f0f54..0000000 --- a/backend/customer/api/customer/customer_http.pb.go +++ /dev/null @@ -1,150 +0,0 @@ -// Code generated by protoc-gen-go-http. DO NOT EDIT. -// versions: -// - protoc-gen-go-http v2.5.0 -// - protoc v3.21.6 -// source: api/customer/customer.proto - -package customer - -import ( - context "context" - http "github.com/go-kratos/kratos/v2/transport/http" - binding "github.com/go-kratos/kratos/v2/transport/http/binding" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the kratos package it is being compiled against. -var _ = new(context.Context) -var _ = binding.EncodeURL - -const _ = http.SupportPackageIsVersion1 - -const OperationCustomerGetVerifyCode = "/api.customer.Customer/GetVerifyCode" -const OperationCustomerLogin = "/api.customer.Customer/Login" -const OperationCustomerLogout = "/api.customer.Customer/Logout" - -type CustomerHTTPServer interface { - GetVerifyCode(context.Context, *GetVerifyCodeReq) (*GetVerifyCodeReply, error) - Login(context.Context, *LoginReq) (*LoginReply, error) - Logout(context.Context, *LogoutReq) (*LogoutReply, error) -} - -func RegisterCustomerHTTPServer(s *http.Server, srv CustomerHTTPServer) { - r := s.Route("/") - r.GET("/customer/get-verify-code/{phoneNumber}", _Customer_GetVerifyCode0_HTTP_Handler(srv)) - r.POST("/customer/login", _Customer_Login0_HTTP_Handler(srv)) - r.DELETE("/customer/logout", _Customer_Logout0_HTTP_Handler(srv)) -} - -func _Customer_GetVerifyCode0_HTTP_Handler(srv CustomerHTTPServer) func(ctx http.Context) error { - return func(ctx http.Context) error { - var in GetVerifyCodeReq - if err := ctx.BindQuery(&in); err != nil { - return err - } - if err := ctx.BindVars(&in); err != nil { - return err - } - http.SetOperation(ctx, OperationCustomerGetVerifyCode) - h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.GetVerifyCode(ctx, req.(*GetVerifyCodeReq)) - }) - out, err := h(ctx, &in) - if err != nil { - return err - } - reply := out.(*GetVerifyCodeReply) - return ctx.Result(200, reply) - } -} - -func _Customer_Login0_HTTP_Handler(srv CustomerHTTPServer) func(ctx http.Context) error { - return func(ctx http.Context) error { - var in LoginReq - if err := ctx.Bind(&in); err != nil { - return err - } - http.SetOperation(ctx, OperationCustomerLogin) - h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.Login(ctx, req.(*LoginReq)) - }) - out, err := h(ctx, &in) - if err != nil { - return err - } - reply := out.(*LoginReply) - return ctx.Result(200, reply) - } -} - -func _Customer_Logout0_HTTP_Handler(srv CustomerHTTPServer) func(ctx http.Context) error { - return func(ctx http.Context) error { - var in LogoutReq - if err := ctx.BindQuery(&in); err != nil { - return err - } - http.SetOperation(ctx, OperationCustomerLogout) - h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.Logout(ctx, req.(*LogoutReq)) - }) - out, err := h(ctx, &in) - if err != nil { - return err - } - reply := out.(*LogoutReply) - return ctx.Result(200, reply) - } -} - -type CustomerHTTPClient interface { - GetVerifyCode(ctx context.Context, req *GetVerifyCodeReq, opts ...http.CallOption) (rsp *GetVerifyCodeReply, err error) - Login(ctx context.Context, req *LoginReq, opts ...http.CallOption) (rsp *LoginReply, err error) - Logout(ctx context.Context, req *LogoutReq, opts ...http.CallOption) (rsp *LogoutReply, err error) -} - -type CustomerHTTPClientImpl struct { - cc *http.Client -} - -func NewCustomerHTTPClient(client *http.Client) CustomerHTTPClient { - return &CustomerHTTPClientImpl{client} -} - -func (c *CustomerHTTPClientImpl) GetVerifyCode(ctx context.Context, in *GetVerifyCodeReq, opts ...http.CallOption) (*GetVerifyCodeReply, error) { - var out GetVerifyCodeReply - pattern := "/customer/get-verify-code/{phoneNumber}" - path := binding.EncodeURL(pattern, in, true) - opts = append(opts, http.Operation(OperationCustomerGetVerifyCode)) - opts = append(opts, http.PathTemplate(pattern)) - err := c.cc.Invoke(ctx, "GET", path, nil, &out, opts...) - if err != nil { - return nil, err - } - return &out, err -} - -func (c *CustomerHTTPClientImpl) Login(ctx context.Context, in *LoginReq, opts ...http.CallOption) (*LoginReply, error) { - var out LoginReply - pattern := "/customer/login" - path := binding.EncodeURL(pattern, in, false) - opts = append(opts, http.Operation(OperationCustomerLogin)) - opts = append(opts, http.PathTemplate(pattern)) - err := c.cc.Invoke(ctx, "POST", path, in, &out, opts...) - if err != nil { - return nil, err - } - return &out, err -} - -func (c *CustomerHTTPClientImpl) Logout(ctx context.Context, in *LogoutReq, opts ...http.CallOption) (*LogoutReply, error) { - var out LogoutReply - pattern := "/customer/logout" - path := binding.EncodeURL(pattern, in, true) - opts = append(opts, http.Operation(OperationCustomerLogout)) - opts = append(opts, http.PathTemplate(pattern)) - err := c.cc.Invoke(ctx, "DELETE", path, nil, &out, opts...) - if err != nil { - return nil, err - } - return &out, err -} diff --git a/backend/customer/api/verifyCode/verifyCode.pb.go b/backend/customer/api/verifyCode/verifyCode.pb.go new file mode 100644 index 0000000..811f730 --- /dev/null +++ b/backend/customer/api/verifyCode/verifyCode.pb.go @@ -0,0 +1,293 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 +// 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_LETTER TYPE = 2 + TYPE_MIXED TYPE = 3 +) + +// Enum value maps for TYPE. +var ( + TYPE_name = map[int32]string{ + 0: "DEFAULT", + 1: "DIGIT", + 2: "LETTER", + 3: "MIXED", + } + TYPE_value = map[string]int32{ + "DEFAULT": 0, + "DIGIT": 1, + "LETTER": 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} +} + +// 定义 GetVerifyCodeRequest 消息 +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 +} + +// 定义 GetVerifyCodeReply 消息 +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, 0x45, 0x52, 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, 0x26, 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 = []interface{}{ + (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 interface{}, i int) interface{} { + 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 interface{}, i int) interface{} { + 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/customer/api/verifyCode/verifyCode.proto b/backend/customer/api/verifyCode/verifyCode.proto new file mode 100644 index 0000000..db857f1 --- /dev/null +++ b/backend/customer/api/verifyCode/verifyCode.proto @@ -0,0 +1,29 @@ +syntax = "proto3"; + +package api.verifyCode; +// 生成的go代码所在的包 +option go_package = "verifyCode/api/verifyCode;verifyCode"; +// 定义 VerifyCode 服务 +service VerifyCode { + rpc GetVerifyCode (GetVerifyCodeRequest) returns (GetVerifyCodeReply); +} +// 类型常量 +enum TYPE { + DEFAULT = 0; + DIGIT = 1; + LETTER = 2; + MIXED = 3; +}; +// 定义 GetVerifyCodeRequest 消息 +message GetVerifyCodeRequest { + // 验证码长度 + uint32 length = 1; + // 验证码类型 + TYPE type = 2; + +} +// 定义 GetVerifyCodeReply 消息 +message GetVerifyCodeReply { + // 生成的验证码 + string code = 1; +} diff --git a/backend/customer/api/verifyCode/verifyCode_grpc.pb.go b/backend/customer/api/verifyCode/verifyCode_grpc.pb.go new file mode 100644 index 0000000..6f9338b --- /dev/null +++ b/backend/customer/api/verifyCode/verifyCode_grpc.pb.go @@ -0,0 +1,105 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc v3.21.6 +// 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.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// 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) { + out := new(GetVerifyCodeReply) + err := c.cc.Invoke(ctx, "/api.verifyCode.VerifyCode/GetVerifyCode", in, out, opts...) + 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. +type UnimplementedVerifyCodeServer struct { +} + +func (UnimplementedVerifyCodeServer) GetVerifyCode(context.Context, *GetVerifyCodeRequest) (*GetVerifyCodeReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetVerifyCode not implemented") +} +func (UnimplementedVerifyCodeServer) mustEmbedUnimplementedVerifyCodeServer() {} + +// 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) { + 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: "/api.verifyCode.VerifyCode/GetVerifyCode", + } + 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/customer/cmd/customer/wire.go b/backend/customer/cmd/customer/wire.go index 20511a4..cb279a7 100644 --- a/backend/customer/cmd/customer/wire.go +++ b/backend/customer/cmd/customer/wire.go @@ -19,5 +19,5 @@ import ( // wireApp init kratos application. func wireApp(*conf.Server, *conf.Data, log.Logger) (*kratos.App, func(), error) { - panic(wire.Build(server.ProviderSet, data.ProviderSet, biz.ProviderSet, service.ProviderSet, newApp)) + panic(wire.Build(server.ProviderSetServer, data.ProviderSetData, biz.ProviderSetBiz, service.ProviderSetService, newApp)) } diff --git a/backend/customer/cmd/customer/wire_gen.go b/backend/customer/cmd/customer/wire_gen.go index bf7023a..7ffa550 100644 --- a/backend/customer/cmd/customer/wire_gen.go +++ b/backend/customer/cmd/customer/wire_gen.go @@ -20,16 +20,14 @@ import ( // wireApp init kratos application. func wireApp(confServer *conf.Server, confData *conf.Data, logger log.Logger) (*kratos.App, func(), error) { + grpcServer := server.NewGRPCServer(confServer, logger) dataData, cleanup, err := data.NewData(confData, logger) if err != nil { return nil, nil, err } - greeterRepo := data.NewGreeterRepo(dataData, logger) - greeterUsecase := biz.NewGreeterUsecase(greeterRepo, logger) - greeterService := service.NewGreeterService(greeterUsecase) - grpcServer := server.NewGRPCServer(confServer, greeterService, logger) - customerService := service.NewCustomerService() - httpServer := server.NewHTTPServer(confServer, greeterService, customerService, logger) + customerHttpBiz := biz.NewCustomerHttpBiz(dataData) + customerHttpService := service.NewCustomerHttpService(customerHttpBiz) + httpServer := server.NewHTTPServer(confServer, customerHttpService, logger) app := newApp(logger, grpcServer, httpServer) return app, func() { cleanup() diff --git a/backend/customer/go.mod b/backend/customer/go.mod index 0a8e121..0f217e8 100644 --- a/backend/customer/go.mod +++ b/backend/customer/go.mod @@ -1,32 +1,47 @@ module customer -go 1.17 +go 1.19 require ( - github.com/go-kratos/kratos/v2 v2.4.1 + github.com/gin-gonic/gin v1.8.1 + github.com/go-kratos/kratos/v2 v2.5.0 + github.com/go-redis/redis/v9 v9.0.0-beta.2 github.com/google/wire v0.5.0 - google.golang.org/genproto v0.0.0-20220524023933-508584e28198 - google.golang.org/grpc v1.46.2 - google.golang.org/protobuf v1.28.0 + google.golang.org/genproto v0.0.0-20220921223823-23cae91e6737 + google.golang.org/grpc v1.49.0 + google.golang.org/protobuf v1.28.1 ) require ( + github.com/cespare/xxhash/v2 v2.1.2 // indirect + github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect github.com/fsnotify/fsnotify v1.5.4 // indirect + github.com/gin-contrib/sse v0.1.0 // indirect github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-playground/form/v4 v4.2.0 // indirect + github.com/go-playground/locales v0.14.0 // indirect + github.com/go-playground/universal-translator v0.18.0 // indirect + github.com/go-playground/validator/v10 v10.10.0 // indirect + github.com/goccy/go-json v0.9.7 // indirect github.com/golang/protobuf v1.5.2 // indirect - github.com/google/subcommands v1.0.1 // indirect github.com/google/uuid v1.3.0 // indirect github.com/gorilla/mux v1.8.0 // indirect github.com/imdario/mergo v0.3.12 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/json-iterator/go v1.1.12 // indirect + github.com/leodido/go-urn v1.2.1 // indirect + github.com/mattn/go-isatty v0.0.14 // indirect + github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 // indirect + github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/pelletier/go-toml/v2 v2.0.1 // indirect + github.com/ugorji/go/codec v1.2.7 // indirect go.opentelemetry.io/otel v1.7.0 // indirect go.opentelemetry.io/otel/trace v1.7.0 // indirect - golang.org/x/net v0.0.0-20220520000938-2e3eb7b945c2 // indirect + golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 // indirect + golang.org/x/net v0.0.0-20220909164309-bea034e7d591 // indirect golang.org/x/sync v0.0.0-20220513210516-0976fa681c29 // indirect - golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect + golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 // indirect golang.org/x/text v0.3.7 // indirect - golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135 // indirect - gopkg.in/yaml.v3 v3.0.0 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/backend/customer/go.sum b/backend/customer/go.sum index 24cef9d..c5ea119 100644 --- a/backend/customer/go.sum +++ b/backend/customer/go.sum @@ -5,6 +5,8 @@ github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9 github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE= +github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= @@ -12,8 +14,12 @@ github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XP github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= +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/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= @@ -23,9 +29,13 @@ github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7 github.com/fsnotify/fsnotify v1.5.4 h1:jRbGcIw6P2Meqdwuo0H1p6JVLbL5DHKAKlYndzMwVZI= github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= +github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= +github.com/gin-gonic/gin v1.8.1 h1:4+fr/el88TOO3ewCmQr8cx/CtZ/umlIRIs5M4NTNjf8= +github.com/gin-gonic/gin v1.8.1/go.mod h1:ji8BvRH1azfM+SYow9zQ6SZMvR8qOMZHmsCuWR9tTTk= github.com/go-kratos/aegis v0.1.2/go.mod h1:jYeSQ3Gesba478zEnujOiG5QdsyF3Xk/8owFUeKcHxw= -github.com/go-kratos/kratos/v2 v2.4.1 h1:NFQy8Ha4Xu6T3Q40JlKzspvlMa5IGvIHhJw5+sqyV4c= -github.com/go-kratos/kratos/v2 v2.4.1/go.mod h1:5acyLj4EgY428AJnZl2EwCrMV1OVlttQFBum+SghMiA= +github.com/go-kratos/kratos/v2 v2.5.0 h1:lHpfp/AodxpRM9j8b894EsGTwsL40X8WMjNeJ6ChOqQ= +github.com/go-kratos/kratos/v2 v2.5.0/go.mod h1:5acyLj4EgY428AJnZl2EwCrMV1OVlttQFBum+SghMiA= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= @@ -36,6 +46,16 @@ 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.0 h1:N1wh+Goz61e6w66vo8vJkQt+uwZSoLz50kZPJWR8eic= github.com/go-playground/form/v4 v4.2.0/go.mod h1:q1a2BY+AQUUzhl6xA/6hBetay6dEIhMHjgvJiGo6K7U= +github.com/go-playground/locales v0.14.0 h1:u50s323jtVGugKlcYeyzC0etD1HifMjqmJqb8WugfUU= +github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs= +github.com/go-playground/universal-translator v0.18.0 h1:82dyy6p4OuJq4/CByFNOn/jYrnRPArHwAcmLoJZxyho= +github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA= +github.com/go-playground/validator/v10 v10.10.0 h1:I7mrTYv78z8k8VXa/qJlOlEXn/nBh+BF8dHX5nt/dr0= +github.com/go-playground/validator/v10 v10.10.0/go.mod h1:74x4gJWsvQexRdW8Pn3dXSGrTK4nAUsbPlLADvpJkos= +github.com/go-redis/redis/v9 v9.0.0-beta.2 h1:ZSr84TsnQyKMAg8gnV+oawuQezeJR11/09THcWCQzr4= +github.com/go-redis/redis/v9 v9.0.0-beta.2/go.mod h1:Bldcd/M/bm9HbnNPi/LUtYBSD8ttcZYBMupwMXhdU0o= +github.com/goccy/go-json v0.9.7 h1:IcB+Aqpx/iMHu5Yooh7jEzJk1JZ7Pjtmys2ukPr7EeM= +github.com/goccy/go-json v0.9.7/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/golang-jwt/jwt/v4 v4.4.1/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= @@ -60,9 +80,9 @@ github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= -github.com/google/subcommands v1.0.1 h1:/eqq+otEXm5vhfBrbREPCSVQbvofip6kIz+mX5TUH7k= +github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/subcommands v1.0.1/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= @@ -74,18 +94,50 @@ github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB7 github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU= github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= +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/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= +github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= +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/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w= +github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= +github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y= +github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/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/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= +github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= +github.com/onsi/gomega v1.20.0 h1:8W0cWlwFkflGPLltQvLRB7ZVD5HuP6ng320w2IS245Q= +github.com/pelletier/go-toml/v2 v2.0.1 h1:8e3L2cCQzLFi2CR4g7vGFuFxX7Jl1kKX8gW+iV0GUKU= +github.com/pelletier/go-toml/v2 v2.0.1/go.mod h1:r9LEWfGN8R5k0VXJ+0BkIe7MYkRdwZOjgMj2KwnJFUo= +github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= 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/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= +github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= +github.com/rogpeppe/go-internal v1.8.0 h1:FCbCCtXNOY3UtUuHUYaghJg4y7Fd14rXifAYUAtL9R8= +github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE= github.com/shirou/gopsutil/v3 v3.21.8/go.mod h1:YWp/H8Qs5fVmf17v7JNZzA0mPJ+mS2e9JdiUF9LlKzQ= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/tklauser/go-sysconf v0.3.9/go.mod h1:11DU/5sG7UexIrp/O6g35hrWzu0JxlwQ3LSFUzyeuhs= github.com/tklauser/numcpus v0.3.0/go.mod h1:yFGUr7TUHQRAhyqBcEg0Ge34zDBAsIvJJcyE6boqnA8= +github.com/ugorji/go v1.2.7/go.mod h1:nF9osbDWLy6bDVv/Rtoh6QgnvNDpmCalQV5urGCCS6M= +github.com/ugorji/go/codec v1.2.7 h1:YPXUKf7fYbp/y8xloBqZOw2qaVggbfwMlI8WM3wZUJ0= +github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY= go.opentelemetry.io/otel v1.7.0 h1:Z2lA3Tdch0iDcrhJXDIlC94XE+bxok1F9B+4Lz/lGsM= go.opentelemetry.io/otel v1.7.0/go.mod h1:5BdUoMIz5WEs0vt0CUEMtSSaTSHBBVwrhnz7+nrD5xk= go.opentelemetry.io/otel/sdk v1.7.0 h1:4OmStpcKVOfvDOgCt7UriAPtKolwIhxpnSNI/yK+1B0= @@ -95,6 +147,8 @@ go.opentelemetry.io/otel/trace v1.7.0/go.mod h1:fzLSB9nqR2eXzxPXb2JW9IKE+ScyXA48 go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 h1:/UOmuWzQfxxo9UtlXMwuQU8CMgg1eZXqTRwkSQJWKOI= +golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= @@ -107,9 +161,10 @@ golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.0.0-20220520000938-2e3eb7b945c2 h1:NWy5+hlRbC7HK+PmcXVUmW1IMyFce7to56IUvhUFm7Y= -golang.org/x/net v0.0.0-20220520000938-2e3eb7b945c2/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220909164309-bea034e7d591 h1:D0B/7al0LLrVC8aWF4+oxpv/m8bc7ViFfVS8/gXGdqI= +golang.org/x/net v0.0.0-20220909164309-bea034e7d591/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -130,16 +185,17 @@ golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/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-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210816074244-15123e1e1f71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a h1:dGzPydgVsqGcTRVwiLJ1jVbufYwmzD3LfVPLKsKg+0k= -golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 h1:WIoqL4EROvwiPdUtaip4VcDdpZ4kha7wBWZrbVKCIZg= +golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 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/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.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -147,10 +203,8 @@ golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGm golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190422233926-fe54fb35175b/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135 h1:5Beo0mZN8dRzgrMMkDp0jc8YXQKx9DiJ2k1dkvGsn5A= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -159,8 +213,8 @@ google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98 google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= google.golang.org/genproto v0.0.0-20220519153652-3a47de7e79bd/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= -google.golang.org/genproto v0.0.0-20220524023933-508584e28198 h1:a1g7i05I2vUwq5eYrmxBJy6rPbw/yo7WzzwPJmcC0P4= -google.golang.org/genproto v0.0.0-20220524023933-508584e28198/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= +google.golang.org/genproto v0.0.0-20220921223823-23cae91e6737 h1:K1zaaMdYBXRyX+cwFnxj7M6zwDyumLQMZ5xqwGvjreQ= +google.golang.org/genproto v0.0.0-20220921223823-23cae91e6737/go.mod h1:2r/26NEF3bFmT3eC3aZreahSal0C3Shl8Gi6vyDYqOQ= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= @@ -168,8 +222,9 @@ google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8 google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= -google.golang.org/grpc v1.46.2 h1:u+MLGgVf7vRdjEYZ8wDFhAVNmhkbJ5hmrA1LMWK1CAQ= google.golang.org/grpc v1.46.2/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= +google.golang.org/grpc v1.49.0 h1:WTLtQzmQori5FUH25Pq4WT22oCsv8USpQ+F6rqtsmxw= +google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -182,16 +237,24 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba 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.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw= google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= +google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/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/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= gopkg.in/yaml.v2 v2.3.0/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.0 h1:hjy8E9ON/egN1tAYqKb61G10WtihqetD4sz2H+8nIeA= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0/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= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/backend/customer/internal/biz/biz.go b/backend/customer/internal/biz/biz.go index d0a973b..2f9fa25 100644 --- a/backend/customer/internal/biz/biz.go +++ b/backend/customer/internal/biz/biz.go @@ -1,6 +1,8 @@ package biz -import "github.com/google/wire" +import ( + "github.com/google/wire" +) // ProviderSet is biz providers. -var ProviderSet = wire.NewSet(NewGreeterUsecase) +var ProviderSetBiz = wire.NewSet(NewCustomerHttpBiz) diff --git a/backend/customer/internal/biz/customer_http.go b/backend/customer/internal/biz/customer_http.go new file mode 100644 index 0000000..b52291a --- /dev/null +++ b/backend/customer/internal/biz/customer_http.go @@ -0,0 +1,45 @@ +package biz + +import ( + "context" + "customer/api/verifyCode" + "customer/internal/data" + "github.com/go-kratos/kratos/v2/transport/grpc" + "time" +) + +type CustomerHttpBiz struct { + Data *data.Data +} + +func NewCustomerHttpBiz(data *data.Data) *CustomerHttpBiz { + return &CustomerHttpBiz{ + Data: data, + } +} + +func (b *CustomerHttpBiz) GetVerifyCode(l uint32, t verifyCode.TYPE) (string, error) { + conn, err := grpc.DialInsecure( + context.Background(), + grpc.WithEndpoint("127.0.0.1:9000"), + ) + if err != nil { + return "", err + } + verifyCodeClient := verifyCode.NewVerifyCodeClient(conn) + respCode, err := verifyCodeClient.GetVerifyCode(context.Background(), + &verifyCode.GetVerifyCodeRequest{ + Length: l, + Type: t, + }) + if err != nil { + return "", err + } + + return respCode.Code, nil +} + +func (b *CustomerHttpBiz) SaveVerifyCode(phoneNumber, code string) error { + // vcc verify_code customer + return b.Data.Rdb.Set(context.Background(), "vcc_"+phoneNumber, code, 60*time.Second).Err() +} diff --git a/backend/customer/internal/biz/greeter.go b/backend/customer/internal/biz/greeter.go deleted file mode 100644 index d8c2cbf..0000000 --- a/backend/customer/internal/biz/greeter.go +++ /dev/null @@ -1,46 +0,0 @@ -package biz - -import ( - "context" - - v1 "customer/api/helloworld/v1" - - "github.com/go-kratos/kratos/v2/errors" - "github.com/go-kratos/kratos/v2/log" -) - -var ( - // ErrUserNotFound is user not found. - ErrUserNotFound = errors.NotFound(v1.ErrorReason_USER_NOT_FOUND.String(), "user not found") -) - -// Greeter is a Greeter model. -type Greeter struct { - Hello string -} - -// GreeterRepo is a Greater repo. -type GreeterRepo interface { - Save(context.Context, *Greeter) (*Greeter, error) - Update(context.Context, *Greeter) (*Greeter, error) - FindByID(context.Context, int64) (*Greeter, error) - ListByHello(context.Context, string) ([]*Greeter, error) - ListAll(context.Context) ([]*Greeter, error) -} - -// GreeterUsecase is a Greeter usecase. -type GreeterUsecase struct { - repo GreeterRepo - log *log.Helper -} - -// NewGreeterUsecase new a Greeter usecase. -func NewGreeterUsecase(repo GreeterRepo, logger log.Logger) *GreeterUsecase { - return &GreeterUsecase{repo: repo, log: log.NewHelper(logger)} -} - -// CreateGreeter creates a Greeter, and returns the new Greeter. -func (uc *GreeterUsecase) CreateGreeter(ctx context.Context, g *Greeter) (*Greeter, error) { - uc.log.WithContext(ctx).Infof("CreateGreeter: %v", g.Hello) - return uc.repo.Save(ctx, g) -} diff --git a/backend/customer/internal/data/data.go b/backend/customer/internal/data/data.go index 3015206..e0cfbbd 100644 --- a/backend/customer/internal/data/data.go +++ b/backend/customer/internal/data/data.go @@ -2,17 +2,19 @@ package data import ( "customer/internal/conf" + "github.com/go-redis/redis/v9" "github.com/go-kratos/kratos/v2/log" "github.com/google/wire" ) // ProviderSet is data providers. -var ProviderSet = wire.NewSet(NewData, NewGreeterRepo) +var ProviderSetData = wire.NewSet(NewData) // Data . type Data struct { // TODO wrapped database client + Rdb *redis.Client } // NewData . @@ -20,5 +22,15 @@ func NewData(c *conf.Data, logger log.Logger) (*Data, func(), error) { cleanup := func() { log.NewHelper(logger).Info("closing the data resources") } - return &Data{}, cleanup, nil + + // init rdb + rdb := redis.NewClient(&redis.Options{ + Addr: c.Redis.Addr, + Password: "", // no password set + DB: 0, // use default DB + }) + + return &Data{ + Rdb: rdb, + }, cleanup, nil } diff --git a/backend/customer/internal/data/greeter.go b/backend/customer/internal/data/greeter.go deleted file mode 100644 index e04cda5..0000000 --- a/backend/customer/internal/data/greeter.go +++ /dev/null @@ -1,42 +0,0 @@ -package data - -import ( - "context" - - "customer/internal/biz" - - "github.com/go-kratos/kratos/v2/log" -) - -type greeterRepo struct { - data *Data - log *log.Helper -} - -// NewGreeterRepo . -func NewGreeterRepo(data *Data, logger log.Logger) biz.GreeterRepo { - return &greeterRepo{ - data: data, - log: log.NewHelper(logger), - } -} - -func (r *greeterRepo) Save(ctx context.Context, g *biz.Greeter) (*biz.Greeter, error) { - return g, nil -} - -func (r *greeterRepo) Update(ctx context.Context, g *biz.Greeter) (*biz.Greeter, error) { - return g, nil -} - -func (r *greeterRepo) FindByID(context.Context, int64) (*biz.Greeter, error) { - return nil, nil -} - -func (r *greeterRepo) ListByHello(context.Context, string) ([]*biz.Greeter, error) { - return nil, nil -} - -func (r *greeterRepo) ListAll(context.Context) ([]*biz.Greeter, error) { - return nil, nil -} diff --git a/backend/customer/internal/server/grpc.go b/backend/customer/internal/server/grpc.go index 6ba5b73..8a552cd 100644 --- a/backend/customer/internal/server/grpc.go +++ b/backend/customer/internal/server/grpc.go @@ -1,17 +1,14 @@ package server import ( - v1 "customer/api/helloworld/v1" "customer/internal/conf" - "customer/internal/service" - "github.com/go-kratos/kratos/v2/log" "github.com/go-kratos/kratos/v2/middleware/recovery" "github.com/go-kratos/kratos/v2/transport/grpc" ) // NewGRPCServer new a gRPC server. -func NewGRPCServer(c *conf.Server, greeter *service.GreeterService, logger log.Logger) *grpc.Server { +func NewGRPCServer(c *conf.Server, logger log.Logger) *grpc.Server { var opts = []grpc.ServerOption{ grpc.Middleware( recovery.Recovery(), @@ -27,6 +24,6 @@ func NewGRPCServer(c *conf.Server, greeter *service.GreeterService, logger log.L opts = append(opts, grpc.Timeout(c.Grpc.Timeout.AsDuration())) } srv := grpc.NewServer(opts...) - v1.RegisterGreeterServer(srv, greeter) + //v1.RegisterGreeterServer(srv, greeter) return srv } diff --git a/backend/customer/internal/server/http.go b/backend/customer/internal/server/http.go index cf1cced..043be13 100644 --- a/backend/customer/internal/server/http.go +++ b/backend/customer/internal/server/http.go @@ -1,8 +1,6 @@ package server import ( - "customer/api/customer" - v1 "customer/api/helloworld/v1" "customer/internal/conf" "customer/internal/service" @@ -11,10 +9,9 @@ import ( "github.com/go-kratos/kratos/v2/transport/http" ) -// NewHTTPServer new a HTTP server. +// NewHTTPServer new a HTTP server used gin. func NewHTTPServer(c *conf.Server, - greeter *service.GreeterService, - customerService *service.CustomerService, + chs *service.CustomerHttpService, logger log.Logger) *http.Server { var opts = []http.ServerOption{ http.Middleware( @@ -31,7 +28,7 @@ func NewHTTPServer(c *conf.Server, opts = append(opts, http.Timeout(c.Http.Timeout.AsDuration())) } srv := http.NewServer(opts...) - v1.RegisterGreeterHTTPServer(srv, greeter) - customer.RegisterCustomerHTTPServer(srv, customerService) + //v1.RegisterGreeterHTTPServer(srv, greeter) + service.RegisterCustomerHttpServer(srv, chs) return srv } diff --git a/backend/customer/internal/server/server.go b/backend/customer/internal/server/server.go index f389425..ef3f229 100644 --- a/backend/customer/internal/server/server.go +++ b/backend/customer/internal/server/server.go @@ -5,4 +5,4 @@ import ( ) // ProviderSet is server providers. -var ProviderSet = wire.NewSet(NewGRPCServer, NewHTTPServer) +var ProviderSetServer = wire.NewSet(NewGRPCServer, NewHTTPServer) diff --git a/backend/customer/internal/service/customer.go b/backend/customer/internal/service/customer.go deleted file mode 100644 index 4af7f57..0000000 --- a/backend/customer/internal/service/customer.go +++ /dev/null @@ -1,44 +0,0 @@ -package service - -import ( - "context" - "github.com/go-kratos/kratos/v2/errors" - "net/http" - "regexp" - - pb "customer/api/customer" -) - -type CustomerService struct { - pb.UnimplementedCustomerServer -} - -func NewCustomerService() *CustomerService { - return &CustomerService{} -} - -func (s *CustomerService) GetVerifyCode(ctx context.Context, req *pb.GetVerifyCodeReq) (*pb.GetVerifyCodeReply, error) { - // # 验证电话号码 - pattern := regexp.MustCompile(`^(13\d|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18\d|19[0-35-9])\d{8}$`) - if !pattern.MatchString(req.PhoneNumber) { - // 如果正则匹配失败,则返回错误 - return nil, - errors.New(http.StatusBadRequest, "PHONENUMBER_ERROR", "电话号码格式错误") - } - // # gRPC 调用验证码生成服务获取验证码 - - // # 临时存储 - // # gRPC 调用短信服务发送短信 - // # 成功响应,告知请求端,验证码已发送 - return &pb.GetVerifyCodeReply{ - Error: false, - Message: "验证码已发送", - Duration: 60, - }, nil -} -func (s *CustomerService) Login(ctx context.Context, req *pb.LoginReq) (*pb.LoginReply, error) { - return &pb.LoginReply{}, nil -} -func (s *CustomerService) Logout(ctx context.Context, req *pb.LogoutReq) (*pb.LogoutReply, error) { - return &pb.LogoutReply{}, nil -} diff --git a/backend/customer/internal/service/customer_http.go b/backend/customer/internal/service/customer_http.go new file mode 100644 index 0000000..3893359 --- /dev/null +++ b/backend/customer/internal/service/customer_http.go @@ -0,0 +1,70 @@ +package service + +import ( + "customer/api/verifyCode" + "customer/internal/biz" + "github.com/gin-gonic/gin" + khttp "github.com/go-kratos/kratos/v2/transport/http" + "log" + "net/http" + "regexp" +) + +type CustomerHttpService struct { + Biz *biz.CustomerHttpBiz +} + +func NewCustomerHttpService(biz *biz.CustomerHttpBiz) *CustomerHttpService { + return &CustomerHttpService{ + Biz: biz, + } +} + +func RegisterCustomerHttpServer(s *khttp.Server, srv *CustomerHttpService) { + var router = gin.Default() + router.GET("/customer/get-verify-code", srv.CustomerGetVerifyCode) + s.HandlePrefix("/", router) +} + +func (s *CustomerHttpService) CustomerGetVerifyCode(ctx *gin.Context) { + + //# 验证电话号码 + phoneNumber := ctx.Query("phone_number") + pattern := regexp.MustCompile(`^(13\d|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18\d|19[0-35-9])\d{8}$`) + if !pattern.MatchString(phoneNumber) { + // 如果正则匹配失败,则返回错误 + ctx.JSON(http.StatusBadRequest, gin.H{ + "message": "电话号码格式错误", + }) + return + } + + //# gRPC 调用验证码生成服务获取验证码 + code, err := s.Biz.GetVerifyCode(6, verifyCode.TYPE_DEFAULT) + if err != nil { + ctx.JSON(http.StatusInternalServerError, gin.H{ + "message": "验证码生成失败", + }) + log.Println(err) + return + } + + //# 存储 code + if err := s.Biz.SaveVerifyCode(phoneNumber, code); err != nil { + ctx.JSON(http.StatusInternalServerError, gin.H{ + "message": "验证码生成失败", + }) + log.Println(err) + return + } + + //# gRPC 调用短信服务发送短信(略) + + //# 成功响应,告知请求端,验证码已发送 + ctx.JSON(http.StatusOK, gin.H{ + "message": "验证码已发送", + "duration": 60, + "code": code, + }) + +} diff --git a/backend/customer/internal/service/greeter.go b/backend/customer/internal/service/greeter.go deleted file mode 100644 index 05e18df..0000000 --- a/backend/customer/internal/service/greeter.go +++ /dev/null @@ -1,29 +0,0 @@ -package service - -import ( - "context" - - v1 "customer/api/helloworld/v1" - "customer/internal/biz" -) - -// GreeterService is a greeter service. -type GreeterService struct { - v1.UnimplementedGreeterServer - - uc *biz.GreeterUsecase -} - -// NewGreeterService new a greeter service. -func NewGreeterService(uc *biz.GreeterUsecase) *GreeterService { - return &GreeterService{uc: uc} -} - -// SayHello implements helloworld.GreeterServer. -func (s *GreeterService) SayHello(ctx context.Context, in *v1.HelloRequest) (*v1.HelloReply, error) { - g, err := s.uc.CreateGreeter(ctx, &biz.Greeter{Hello: in.Name}) - if err != nil { - return nil, err - } - return &v1.HelloReply{Message: "Hello " + g.Hello}, nil -} diff --git a/backend/customer/internal/service/service.go b/backend/customer/internal/service/service.go index b9b2f89..085d2c1 100644 --- a/backend/customer/internal/service/service.go +++ b/backend/customer/internal/service/service.go @@ -3,4 +3,4 @@ package service import "github.com/google/wire" // ProviderSet is service providers. -var ProviderSet = wire.NewSet(NewGreeterService, NewCustomerService) +var ProviderSetService = wire.NewSet(NewCustomerHttpService) diff --git a/backend/verifyCode/Makefile b/backend/verifyCode/Makefile index f1a3f21..17c0161 100644 --- a/backend/verifyCode/Makefile +++ b/backend/verifyCode/Makefile @@ -45,7 +45,7 @@ api: .PHONY: build # build build: - mkdir -p bin/ && go build -ldflags "-X main.Version=$(VERSION)" -o ./bin/ ./... + mkdir -p bin/ && go build -ldflags "-X main.Version=$(VERSION)" -o ./bin/server ./cmd/... .PHONY: generate # generate diff --git a/backend/verifyCode/cmd/verifyCode/main.go b/backend/verifyCode/cmd/verifyCode/main.go index acc96ef..bd25032 100644 --- a/backend/verifyCode/cmd/verifyCode/main.go +++ b/backend/verifyCode/cmd/verifyCode/main.go @@ -19,9 +19,9 @@ import ( // go build -ldflags "-X main.Version=x.y.z" var ( // Name is the name of the compiled software. - Name string + Name string = "verifyCode" // Version is the version of the compiled software. - Version string + Version string = "1.0.0" // flagconf is the config flag. flagconf string @@ -81,7 +81,7 @@ func main() { // set rand seed rand.Seed(time.Now().UnixNano()) - + // start and wait for stop signal if err := app.Run(); err != nil { panic(err) diff --git a/run/Dockerfile b/run/Dockerfile new file mode 100644 index 0000000..8fa052e --- /dev/null +++ b/run/Dockerfile @@ -0,0 +1,10 @@ +FROM golang:1.19 + +COPY ../verifyCode /src +WORKDIR /src + +RUN go install github.com/go-kratos/kratos/cmd/kratos/v2@latest + +RUN GOPROXY=https://goproxy.cn,direct go mod tidy + +CMD ["kratos", "run"] \ No newline at end of file diff --git a/run/docker-compose.yml b/run/docker-compose.yml new file mode 100644 index 0000000..a5a3aad --- /dev/null +++ b/run/docker-compose.yml @@ -0,0 +1,9 @@ +services: + redis: + image: "redis:latest" + ports: + - "6379:6379" + restart: always + container_name: dev-redis + volumes: + - ../volumes/redis:/data \ No newline at end of file diff --git a/volumes/redis/dump.rdb b/volumes/redis/dump.rdb new file mode 100644 index 0000000000000000000000000000000000000000..b657e6971ce5d94d7aca03ecae64ce1ee2c62a89 GIT binary patch literal 88 zcmWG?b@2=~FfcUu#aWb^l3A=