parent
dc3c2f05f3
commit
a3b6c12a40
@ -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"]
|
@ -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
|
||||
}
|
@ -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",
|
||||
}
|
@ -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
|
||||
}
|
@ -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
|
||||
}
|
@ -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;
|
||||
}
|
@ -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",
|
||||
}
|
@ -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
|
||||
)
|
||||
|
@ -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)
|
||||
|
@ -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()
|
||||
}
|
@ -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)
|
||||
}
|
@ -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
|
||||
}
|
@ -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
|
||||
}
|
@ -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,
|
||||
})
|
||||
|
||||
}
|
@ -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
|
||||
}
|
@ -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"]
|
@ -0,0 +1,9 @@
|
||||
services:
|
||||
redis:
|
||||
image: "redis:latest"
|
||||
ports:
|
||||
- "6379:6379"
|
||||
restart: always
|
||||
container_name: dev-redis
|
||||
volumes:
|
||||
- ../volumes/redis:/data
|
Binary file not shown.
Loading…
Reference in new issue