diff --git a/backend/customer/api/customer/customer.pb.go b/backend/customer/api/customer/customer.pb.go index 11e9de9..66df1f6 100644 --- a/backend/customer/api/customer/customer.pb.go +++ b/backend/customer/api/customer/customer.pb.go @@ -21,6 +21,135 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +// 登录的消息 +type LoginReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + Telephone string `protobuf:"bytes,1,opt,name=telephone,proto3" json:"telephone,omitempty"` + VerifyCode string `protobuf:"bytes,2,opt,name=verify_code,json=verifyCode,proto3" json:"verify_code,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LoginReq) Reset() { + *x = LoginReq{} + mi := &file_api_customer_customer_proto_msgTypes[0] + 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[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LoginReq.ProtoReflect.Descriptor instead. +func (*LoginReq) Descriptor() ([]byte, []int) { + return file_api_customer_customer_proto_rawDescGZIP(), []int{0} +} + +func (x *LoginReq) GetTelephone() string { + if x != nil { + return x.Telephone + } + return "" +} + +func (x *LoginReq) GetVerifyCode() string { + if x != nil { + return x.VerifyCode + } + return "" +} + +type LoginResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + Code int64 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"` + Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` + Token string `protobuf:"bytes,3,opt,name=token,proto3" json:"token,omitempty"` + TokenCreateAt int64 `protobuf:"varint,4,opt,name=token_create_at,json=tokenCreateAt,proto3" json:"token_create_at,omitempty"` + TokenLife int64 `protobuf:"varint,5,opt,name=token_life,json=tokenLife,proto3" json:"token_life,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LoginResp) Reset() { + *x = LoginResp{} + mi := &file_api_customer_customer_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LoginResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LoginResp) ProtoMessage() {} + +func (x *LoginResp) ProtoReflect() protoreflect.Message { + mi := &file_api_customer_customer_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LoginResp.ProtoReflect.Descriptor instead. +func (*LoginResp) Descriptor() ([]byte, []int) { + return file_api_customer_customer_proto_rawDescGZIP(), []int{1} +} + +func (x *LoginResp) GetCode() int64 { + if x != nil { + return x.Code + } + return 0 +} + +func (x *LoginResp) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *LoginResp) GetToken() string { + if x != nil { + return x.Token + } + return "" +} + +func (x *LoginResp) GetTokenCreateAt() int64 { + if x != nil { + return x.TokenCreateAt + } + return 0 +} + +func (x *LoginResp) GetTokenLife() int64 { + if x != nil { + return x.TokenLife + } + return 0 +} + type GetVerifyCodeReq struct { state protoimpl.MessageState `protogen:"open.v1"` Telephone string `protobuf:"bytes,1,opt,name=telephone,proto3" json:"telephone,omitempty"` @@ -30,7 +159,7 @@ type GetVerifyCodeReq struct { func (x *GetVerifyCodeReq) Reset() { *x = GetVerifyCodeReq{} - mi := &file_api_customer_customer_proto_msgTypes[0] + mi := &file_api_customer_customer_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -42,7 +171,7 @@ func (x *GetVerifyCodeReq) String() string { func (*GetVerifyCodeReq) ProtoMessage() {} func (x *GetVerifyCodeReq) ProtoReflect() protoreflect.Message { - mi := &file_api_customer_customer_proto_msgTypes[0] + mi := &file_api_customer_customer_proto_msgTypes[2] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -55,7 +184,7 @@ func (x *GetVerifyCodeReq) ProtoReflect() protoreflect.Message { // Deprecated: Use GetVerifyCodeReq.ProtoReflect.Descriptor instead. func (*GetVerifyCodeReq) Descriptor() ([]byte, []int) { - return file_api_customer_customer_proto_rawDescGZIP(), []int{0} + return file_api_customer_customer_proto_rawDescGZIP(), []int{2} } func (x *GetVerifyCodeReq) GetTelephone() string { @@ -78,7 +207,7 @@ type GetVerifyCodeResp struct { func (x *GetVerifyCodeResp) Reset() { *x = GetVerifyCodeResp{} - mi := &file_api_customer_customer_proto_msgTypes[1] + mi := &file_api_customer_customer_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -90,7 +219,7 @@ func (x *GetVerifyCodeResp) String() string { func (*GetVerifyCodeResp) ProtoMessage() {} func (x *GetVerifyCodeResp) ProtoReflect() protoreflect.Message { - mi := &file_api_customer_customer_proto_msgTypes[1] + mi := &file_api_customer_customer_proto_msgTypes[3] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -103,7 +232,7 @@ func (x *GetVerifyCodeResp) ProtoReflect() protoreflect.Message { // Deprecated: Use GetVerifyCodeResp.ProtoReflect.Descriptor instead. func (*GetVerifyCodeResp) Descriptor() ([]byte, []int) { - return file_api_customer_customer_proto_rawDescGZIP(), []int{1} + return file_api_customer_customer_proto_rawDescGZIP(), []int{3} } func (x *GetVerifyCodeResp) GetCode() int64 { @@ -148,34 +277,53 @@ var file_api_customer_customer_proto_rawDesc = []byte{ 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, 0x30, 0x0a, 0x10, 0x47, 0x65, 0x74, - 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x71, 0x12, 0x1c, 0x0a, - 0x09, 0x74, 0x65, 0x6c, 0x65, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x09, 0x74, 0x65, 0x6c, 0x65, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x22, 0xbe, 0x01, 0x0a, 0x11, - 0x47, 0x65, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x73, - 0x70, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x04, 0x63, 0x6f, 0x64, 0x65, 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, - 0x1f, 0x0a, 0x0b, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x43, 0x6f, 0x64, 0x65, - 0x12, 0x30, 0x0a, 0x14, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, - 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x12, - 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x54, 0x69, - 0x6d, 0x65, 0x12, 0x28, 0x0a, 0x10, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x63, 0x6f, 0x64, - 0x65, 0x5f, 0x6c, 0x69, 0x66, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x76, 0x65, - 0x72, 0x69, 0x66, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x4c, 0x69, 0x66, 0x65, 0x32, 0x8b, 0x01, 0x0a, - 0x08, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x12, 0x7f, 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, 0x1f, 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, 0x73, 0x70, 0x22, 0x2d, 0x82, 0xd3, 0xe4, - 0x93, 0x02, 0x27, 0x12, 0x25, 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, - 0x74, 0x65, 0x6c, 0x65, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x7d, 0x42, 0x20, 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, + 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x49, 0x0a, 0x08, 0x4c, 0x6f, 0x67, + 0x69, 0x6e, 0x52, 0x65, 0x71, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x65, 0x6c, 0x65, 0x70, 0x68, 0x6f, + 0x6e, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x74, 0x65, 0x6c, 0x65, 0x70, 0x68, + 0x6f, 0x6e, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x63, 0x6f, + 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, + 0x43, 0x6f, 0x64, 0x65, 0x22, 0x96, 0x01, 0x0a, 0x09, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, + 0x73, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 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, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x26, 0x0a, 0x0f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, + 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x61, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x0d, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x41, 0x74, 0x12, 0x1d, + 0x0a, 0x0a, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x6c, 0x69, 0x66, 0x65, 0x18, 0x05, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x09, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x4c, 0x69, 0x66, 0x65, 0x22, 0x30, 0x0a, + 0x10, 0x47, 0x65, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x65, + 0x71, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x65, 0x6c, 0x65, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x74, 0x65, 0x6c, 0x65, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x22, + 0xbe, 0x01, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x43, 0x6f, 0x64, + 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 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, 0x1f, 0x0a, 0x0b, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x63, 0x6f, + 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, + 0x43, 0x6f, 0x64, 0x65, 0x12, 0x30, 0x0a, 0x14, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x67, + 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x12, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, + 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x28, 0x0a, 0x10, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, + 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x5f, 0x6c, 0x69, 0x66, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x0e, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x4c, 0x69, 0x66, 0x65, + 0x32, 0xe1, 0x01, 0x0a, 0x08, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x12, 0x7f, 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, 0x1f, + 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, 0x73, 0x70, 0x22, + 0x2d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x27, 0x12, 0x25, 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, 0x74, 0x65, 0x6c, 0x65, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x7d, 0x12, 0x54, + 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, + 0x17, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x2e, 0x4c, + 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x22, 0x1a, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, + 0x3a, 0x01, 0x2a, 0x22, 0x0f, 0x2f, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x2f, 0x6c, + 0x6f, 0x67, 0x69, 0x6e, 0x42, 0x20, 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 ( @@ -190,16 +338,20 @@ func file_api_customer_customer_proto_rawDescGZIP() []byte { return file_api_customer_customer_proto_rawDescData } -var file_api_customer_customer_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_api_customer_customer_proto_msgTypes = make([]protoimpl.MessageInfo, 4) var file_api_customer_customer_proto_goTypes = []any{ - (*GetVerifyCodeReq)(nil), // 0: api.customer.GetVerifyCodeReq - (*GetVerifyCodeResp)(nil), // 1: api.customer.GetVerifyCodeResp + (*LoginReq)(nil), // 0: api.customer.LoginReq + (*LoginResp)(nil), // 1: api.customer.LoginResp + (*GetVerifyCodeReq)(nil), // 2: api.customer.GetVerifyCodeReq + (*GetVerifyCodeResp)(nil), // 3: api.customer.GetVerifyCodeResp } var file_api_customer_customer_proto_depIdxs = []int32{ - 0, // 0: api.customer.Customer.GetVerifyCode:input_type -> api.customer.GetVerifyCodeReq - 1, // 1: api.customer.Customer.GetVerifyCode:output_type -> api.customer.GetVerifyCodeResp - 1, // [1:2] is the sub-list for method output_type - 0, // [0:1] is the sub-list for method input_type + 2, // 0: api.customer.Customer.GetVerifyCode:input_type -> api.customer.GetVerifyCodeReq + 0, // 1: api.customer.Customer.Login:input_type -> api.customer.LoginReq + 3, // 2: api.customer.Customer.GetVerifyCode:output_type -> api.customer.GetVerifyCodeResp + 1, // 3: api.customer.Customer.Login:output_type -> api.customer.LoginResp + 2, // [2:4] is the sub-list for method output_type + 0, // [0:2] is the sub-list for method input_type 0, // [0:0] is the sub-list for extension type_name 0, // [0:0] is the sub-list for extension extendee 0, // [0:0] is the sub-list for field type_name @@ -216,7 +368,7 @@ func file_api_customer_customer_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_api_customer_customer_proto_rawDesc, NumEnums: 0, - NumMessages: 2, + NumMessages: 4, NumExtensions: 0, NumServices: 1, }, diff --git a/backend/customer/api/customer/customer.proto b/backend/customer/api/customer/customer.proto index 2d64651..c2a03c7 100644 --- a/backend/customer/api/customer/customer.proto +++ b/backend/customer/api/customer/customer.proto @@ -4,13 +4,34 @@ package api.customer; import "google/api/annotations.proto"; option go_package = "customer/api/customer;customer"; - +//验证码 service Customer { + //验证码 rpc GetVerifyCode(GetVerifyCodeReq) returns (GetVerifyCodeResp){ option (google.api.http)={//{telephone} get:"/customer/get-verify-code/{telephone}" }; } + //登录 + rpc Login (LoginReq) returns (LoginResp){ + option (google.api.http)={ + post:"/customer/login", + body:"*", + }; + } +} +//登录的消息 +message LoginReq{ + string telephone =1; + string verify_code =2; +}; +message LoginResp{ + int64 code =1; + string message =2; + string token = 3; + int64 token_create_at=4; + int64 token_life=5; + } message GetVerifyCodeReq{ diff --git a/backend/customer/api/customer/customer_grpc.pb.go b/backend/customer/api/customer/customer_grpc.pb.go index 8719006..eeca2a9 100644 --- a/backend/customer/api/customer/customer_grpc.pb.go +++ b/backend/customer/api/customer/customer_grpc.pb.go @@ -20,13 +20,19 @@ const _ = grpc.SupportPackageIsVersion9 const ( Customer_GetVerifyCode_FullMethodName = "/api.customer.Customer/GetVerifyCode" + Customer_Login_FullMethodName = "/api.customer.Customer/Login" ) // 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) (*GetVerifyCodeResp, error) + // 登录 + Login(ctx context.Context, in *LoginReq, opts ...grpc.CallOption) (*LoginResp, error) } type customerClient struct { @@ -47,11 +53,26 @@ func (c *customerClient) GetVerifyCode(ctx context.Context, in *GetVerifyCodeReq return out, nil } +func (c *customerClient) Login(ctx context.Context, in *LoginReq, opts ...grpc.CallOption) (*LoginResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(LoginResp) + err := c.cc.Invoke(ctx, Customer_Login_FullMethodName, in, out, cOpts...) + 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) (*GetVerifyCodeResp, error) + // 登录 + Login(context.Context, *LoginReq) (*LoginResp, error) mustEmbedUnimplementedCustomerServer() } @@ -65,6 +86,9 @@ type UnimplementedCustomerServer struct{} func (UnimplementedCustomerServer) GetVerifyCode(context.Context, *GetVerifyCodeReq) (*GetVerifyCodeResp, error) { return nil, status.Errorf(codes.Unimplemented, "method GetVerifyCode not implemented") } +func (UnimplementedCustomerServer) Login(context.Context, *LoginReq) (*LoginResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method Login not implemented") +} func (UnimplementedCustomerServer) mustEmbedUnimplementedCustomerServer() {} func (UnimplementedCustomerServer) testEmbeddedByValue() {} @@ -104,6 +128,24 @@ func _Customer_GetVerifyCode_Handler(srv interface{}, ctx context.Context, dec f 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: Customer_Login_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CustomerServer).Login(ctx, req.(*LoginReq)) + } + 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) @@ -115,6 +157,10 @@ var Customer_ServiceDesc = grpc.ServiceDesc{ MethodName: "GetVerifyCode", Handler: _Customer_GetVerifyCode_Handler, }, + { + MethodName: "Login", + Handler: _Customer_Login_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 index 3e925d8..ca9ee0f 100644 --- a/backend/customer/api/customer/customer_http.pb.go +++ b/backend/customer/api/customer/customer_http.pb.go @@ -20,14 +20,19 @@ var _ = binding.EncodeURL const _ = http.SupportPackageIsVersion1 const OperationCustomerGetVerifyCode = "/api.customer.Customer/GetVerifyCode" +const OperationCustomerLogin = "/api.customer.Customer/Login" type CustomerHTTPServer interface { + // GetVerifyCode验证码 GetVerifyCode(context.Context, *GetVerifyCodeReq) (*GetVerifyCodeResp, error) + // Login登录 + Login(context.Context, *LoginReq) (*LoginResp, error) } func RegisterCustomerHTTPServer(s *http.Server, srv CustomerHTTPServer) { r := s.Route("/") r.GET("/customer/get-verify-code/{telephone}", _Customer_GetVerifyCode0_HTTP_Handler(srv)) + r.POST("/customer/login", _Customer_Login0_HTTP_Handler(srv)) } func _Customer_GetVerifyCode0_HTTP_Handler(srv CustomerHTTPServer) func(ctx http.Context) error { @@ -52,8 +57,31 @@ func _Customer_GetVerifyCode0_HTTP_Handler(srv CustomerHTTPServer) func(ctx http } } +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 + } + if err := ctx.BindQuery(&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.(*LoginResp) + return ctx.Result(200, reply) + } +} + type CustomerHTTPClient interface { GetVerifyCode(ctx context.Context, req *GetVerifyCodeReq, opts ...http.CallOption) (rsp *GetVerifyCodeResp, err error) + Login(ctx context.Context, req *LoginReq, opts ...http.CallOption) (rsp *LoginResp, err error) } type CustomerHTTPClientImpl struct { @@ -76,3 +104,16 @@ func (c *CustomerHTTPClientImpl) GetVerifyCode(ctx context.Context, in *GetVerif } return &out, nil } + +func (c *CustomerHTTPClientImpl) Login(ctx context.Context, in *LoginReq, opts ...http.CallOption) (*LoginResp, error) { + var out LoginResp + 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, nil +} diff --git a/backend/customer/configs/config.yaml b/backend/customer/configs/config.yaml index 2e7b926..d7f1eb5 100644 --- a/backend/customer/configs/config.yaml +++ b/backend/customer/configs/config.yaml @@ -8,7 +8,7 @@ server: data: database: driver: mysql - source: "root:123456@tcp(localhost:3306)/laomadj_customer?charset=utf8mb4&parseTime=True&loc=Local&maxConnLifetime=60s&maxIdleConns=10&maxOpenConns=100" + source: root:123456@tcp(localhost:3306)/laomadj_customer?charset=utf8mb4&parseTime=True&loc=Local redis: addr: 127.0.0.1:6379 read_timeout: 0.2s diff --git a/backend/customer/internal/biz/customer.go b/backend/customer/internal/biz/customer.go index 2c87036..91ef47a 100644 --- a/backend/customer/internal/biz/customer.go +++ b/backend/customer/internal/biz/customer.go @@ -21,6 +21,7 @@ type CustomerWork struct { Name string `gorm:"type:varchar(255);uniqueIndex;" json:"name"` Email string `gorm:"type:varchar(255);uniqueIndex;" json:"email"` Wechat string `gorm:"type:varchar(255);uniqueIndex;" json:"wechat"` + CityId uint `gorm:"index;" json:"city_id"` } // token简介 diff --git a/backend/customer/internal/service/customer.go b/backend/customer/internal/service/customer.go index dcba484..0efd6bf 100644 --- a/backend/customer/internal/service/customer.go +++ b/backend/customer/internal/service/customer.go @@ -80,3 +80,8 @@ func (s *CustomerService) GetVerifyCode(ctx context.Context, req *pb.GetVerifyCo }, nil } + +// 登录 +func (s *CustomerService) Login(ctx context.Context, req *pb.LoginReq) (*pb.LoginResp, error) { + return &pb.LoginResp{}, nil +} diff --git a/backend/customer/openapi.yaml b/backend/customer/openapi.yaml index 600b9d4..023023c 100644 --- a/backend/customer/openapi.yaml +++ b/backend/customer/openapi.yaml @@ -4,12 +4,14 @@ openapi: 3.0.3 info: title: Customer API + description: 验证码 version: 0.0.1 paths: /customer/get-verify-code/{telephone}: get: tags: - Customer + description: 验证码 operationId: Customer_GetVerifyCode parameters: - name: telephone @@ -30,6 +32,31 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' + /customer/login: + post: + tags: + - Customer + description: 登录 + operationId: Customer_Login + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/LoginReq' + required: true + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/LoginResp' + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' components: schemas: GetVerifyCodeResp: @@ -53,6 +80,27 @@ components: description: The type of the serialized message. additionalProperties: true description: Contains an arbitrary serialized message along with a @type that describes the type of the serialized message. + LoginReq: + type: object + properties: + telephone: + type: string + verifyCode: + type: string + description: 登录的消息 + LoginResp: + type: object + properties: + code: + type: string + message: + type: string + token: + type: string + tokenCreateAt: + type: string + tokenLife: + type: string Status: type: object properties: