diff --git a/backend/driver/api/driver/driver.pb.go b/backend/driver/api/driver/driver.pb.go index 994d60c..e5cb841 100644 --- a/backend/driver/api/driver/driver.pb.go +++ b/backend/driver/api/driver/driver.pb.go @@ -21,6 +21,119 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +// 提交电话号码请求消息 +type IDNoCheckReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Idno string `protobuf:"bytes,2,opt,name=idno,proto3" json:"idno,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *IDNoCheckReq) Reset() { + *x = IDNoCheckReq{} + mi := &file_api_driver_driver_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *IDNoCheckReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IDNoCheckReq) ProtoMessage() {} + +func (x *IDNoCheckReq) ProtoReflect() protoreflect.Message { + mi := &file_api_driver_driver_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 IDNoCheckReq.ProtoReflect.Descriptor instead. +func (*IDNoCheckReq) Descriptor() ([]byte, []int) { + return file_api_driver_driver_proto_rawDescGZIP(), []int{0} +} + +func (x *IDNoCheckReq) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *IDNoCheckReq) GetIdno() string { + if x != nil { + return x.Idno + } + return "" +} + +type IDNoCheckResp 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"` + Status string `protobuf:"bytes,3,opt,name=status,proto3" json:"status,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *IDNoCheckResp) Reset() { + *x = IDNoCheckResp{} + mi := &file_api_driver_driver_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *IDNoCheckResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IDNoCheckResp) ProtoMessage() {} + +func (x *IDNoCheckResp) ProtoReflect() protoreflect.Message { + mi := &file_api_driver_driver_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 IDNoCheckResp.ProtoReflect.Descriptor instead. +func (*IDNoCheckResp) Descriptor() ([]byte, []int) { + return file_api_driver_driver_proto_rawDescGZIP(), []int{1} +} + +func (x *IDNoCheckResp) GetCode() int64 { + if x != nil { + return x.Code + } + return 0 +} + +func (x *IDNoCheckResp) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *IDNoCheckResp) GetStatus() string { + if x != nil { + return x.Status + } + return "" +} + // 提交电话号码请求消息 type SubmitPhoneReq struct { state protoimpl.MessageState `protogen:"open.v1"` @@ -32,7 +145,7 @@ type SubmitPhoneReq struct { func (x *SubmitPhoneReq) Reset() { *x = SubmitPhoneReq{} - mi := &file_api_driver_driver_proto_msgTypes[0] + mi := &file_api_driver_driver_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -44,7 +157,7 @@ func (x *SubmitPhoneReq) String() string { func (*SubmitPhoneReq) ProtoMessage() {} func (x *SubmitPhoneReq) ProtoReflect() protoreflect.Message { - mi := &file_api_driver_driver_proto_msgTypes[0] + mi := &file_api_driver_driver_proto_msgTypes[2] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -57,7 +170,7 @@ func (x *SubmitPhoneReq) ProtoReflect() protoreflect.Message { // Deprecated: Use SubmitPhoneReq.ProtoReflect.Descriptor instead. func (*SubmitPhoneReq) Descriptor() ([]byte, []int) { - return file_api_driver_driver_proto_rawDescGZIP(), []int{0} + return file_api_driver_driver_proto_rawDescGZIP(), []int{2} } func (x *SubmitPhoneReq) GetTelephone() string { @@ -85,7 +198,7 @@ type SubmitPhoneResp struct { func (x *SubmitPhoneResp) Reset() { *x = SubmitPhoneResp{} - mi := &file_api_driver_driver_proto_msgTypes[1] + mi := &file_api_driver_driver_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -97,7 +210,7 @@ func (x *SubmitPhoneResp) String() string { func (*SubmitPhoneResp) ProtoMessage() {} func (x *SubmitPhoneResp) ProtoReflect() protoreflect.Message { - mi := &file_api_driver_driver_proto_msgTypes[1] + mi := &file_api_driver_driver_proto_msgTypes[3] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -110,7 +223,7 @@ func (x *SubmitPhoneResp) ProtoReflect() protoreflect.Message { // Deprecated: Use SubmitPhoneResp.ProtoReflect.Descriptor instead. func (*SubmitPhoneResp) Descriptor() ([]byte, []int) { - return file_api_driver_driver_proto_rawDescGZIP(), []int{1} + return file_api_driver_driver_proto_rawDescGZIP(), []int{3} } func (x *SubmitPhoneResp) GetCode() int64 { @@ -143,7 +256,7 @@ type GetVerifyCodeReq struct { func (x *GetVerifyCodeReq) Reset() { *x = GetVerifyCodeReq{} - mi := &file_api_driver_driver_proto_msgTypes[2] + mi := &file_api_driver_driver_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -155,7 +268,7 @@ func (x *GetVerifyCodeReq) String() string { func (*GetVerifyCodeReq) ProtoMessage() {} func (x *GetVerifyCodeReq) ProtoReflect() protoreflect.Message { - mi := &file_api_driver_driver_proto_msgTypes[2] + mi := &file_api_driver_driver_proto_msgTypes[4] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -168,7 +281,7 @@ func (x *GetVerifyCodeReq) ProtoReflect() protoreflect.Message { // Deprecated: Use GetVerifyCodeReq.ProtoReflect.Descriptor instead. func (*GetVerifyCodeReq) Descriptor() ([]byte, []int) { - return file_api_driver_driver_proto_rawDescGZIP(), []int{2} + return file_api_driver_driver_proto_rawDescGZIP(), []int{4} } func (x *GetVerifyCodeReq) GetTelephone() string { @@ -191,7 +304,7 @@ type GetVerifyCodeResp struct { func (x *GetVerifyCodeResp) Reset() { *x = GetVerifyCodeResp{} - mi := &file_api_driver_driver_proto_msgTypes[3] + mi := &file_api_driver_driver_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -203,7 +316,7 @@ func (x *GetVerifyCodeResp) String() string { func (*GetVerifyCodeResp) ProtoMessage() {} func (x *GetVerifyCodeResp) ProtoReflect() protoreflect.Message { - mi := &file_api_driver_driver_proto_msgTypes[3] + mi := &file_api_driver_driver_proto_msgTypes[5] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -216,7 +329,7 @@ func (x *GetVerifyCodeResp) ProtoReflect() protoreflect.Message { // Deprecated: Use GetVerifyCodeResp.ProtoReflect.Descriptor instead. func (*GetVerifyCodeResp) Descriptor() ([]byte, []int) { - return file_api_driver_driver_proto_rawDescGZIP(), []int{3} + return file_api_driver_driver_proto_rawDescGZIP(), []int{5} } func (x *GetVerifyCodeResp) GetCode() int64 { @@ -263,7 +376,7 @@ type LogoutReq struct { func (x *LogoutReq) Reset() { *x = LogoutReq{} - mi := &file_api_driver_driver_proto_msgTypes[4] + mi := &file_api_driver_driver_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -275,7 +388,7 @@ func (x *LogoutReq) String() string { func (*LogoutReq) ProtoMessage() {} func (x *LogoutReq) ProtoReflect() protoreflect.Message { - mi := &file_api_driver_driver_proto_msgTypes[4] + mi := &file_api_driver_driver_proto_msgTypes[6] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -288,7 +401,7 @@ func (x *LogoutReq) ProtoReflect() protoreflect.Message { // Deprecated: Use LogoutReq.ProtoReflect.Descriptor instead. func (*LogoutReq) Descriptor() ([]byte, []int) { - return file_api_driver_driver_proto_rawDescGZIP(), []int{4} + return file_api_driver_driver_proto_rawDescGZIP(), []int{6} } type LogoutResp struct { @@ -301,7 +414,7 @@ type LogoutResp struct { func (x *LogoutResp) Reset() { *x = LogoutResp{} - mi := &file_api_driver_driver_proto_msgTypes[5] + mi := &file_api_driver_driver_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -313,7 +426,7 @@ func (x *LogoutResp) String() string { func (*LogoutResp) ProtoMessage() {} func (x *LogoutResp) ProtoReflect() protoreflect.Message { - mi := &file_api_driver_driver_proto_msgTypes[5] + mi := &file_api_driver_driver_proto_msgTypes[7] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -326,7 +439,7 @@ func (x *LogoutResp) ProtoReflect() protoreflect.Message { // Deprecated: Use LogoutResp.ProtoReflect.Descriptor instead. func (*LogoutResp) Descriptor() ([]byte, []int) { - return file_api_driver_driver_proto_rawDescGZIP(), []int{5} + return file_api_driver_driver_proto_rawDescGZIP(), []int{7} } func (x *LogoutResp) GetCode() int64 { @@ -354,7 +467,7 @@ type LoginReq struct { func (x *LoginReq) Reset() { *x = LoginReq{} - mi := &file_api_driver_driver_proto_msgTypes[6] + mi := &file_api_driver_driver_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -366,7 +479,7 @@ func (x *LoginReq) String() string { func (*LoginReq) ProtoMessage() {} func (x *LoginReq) ProtoReflect() protoreflect.Message { - mi := &file_api_driver_driver_proto_msgTypes[6] + mi := &file_api_driver_driver_proto_msgTypes[8] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -379,7 +492,7 @@ func (x *LoginReq) ProtoReflect() protoreflect.Message { // Deprecated: Use LoginReq.ProtoReflect.Descriptor instead. func (*LoginReq) Descriptor() ([]byte, []int) { - return file_api_driver_driver_proto_rawDescGZIP(), []int{6} + return file_api_driver_driver_proto_rawDescGZIP(), []int{8} } func (x *LoginReq) GetTelephone() string { @@ -409,7 +522,7 @@ type LoginResp struct { func (x *LoginResp) Reset() { *x = LoginResp{} - mi := &file_api_driver_driver_proto_msgTypes[7] + mi := &file_api_driver_driver_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -421,7 +534,7 @@ func (x *LoginResp) String() string { func (*LoginResp) ProtoMessage() {} func (x *LoginResp) ProtoReflect() protoreflect.Message { - mi := &file_api_driver_driver_proto_msgTypes[7] + mi := &file_api_driver_driver_proto_msgTypes[9] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -434,7 +547,7 @@ func (x *LoginResp) ProtoReflect() protoreflect.Message { // Deprecated: Use LoginResp.ProtoReflect.Descriptor instead. func (*LoginResp) Descriptor() ([]byte, []int) { - return file_api_driver_driver_proto_rawDescGZIP(), []int{7} + return file_api_driver_driver_proto_rawDescGZIP(), []int{9} } func (x *LoginResp) GetCode() int64 { @@ -479,52 +592,67 @@ var file_api_driver_driver_proto_rawDesc = []byte{ 0x76, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0a, 0x61, 0x70, 0x69, 0x2e, 0x64, 0x72, 0x69, 0x76, 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, 0x4f, 0x0a, 0x0e, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x50, 0x68, 0x6f, - 0x6e, 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, 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, 0x57, 0x0a, 0x0f, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x50, 0x68, - 0x6f, 0x6e, 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, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 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, - 0x22, 0x0b, 0x0a, 0x09, 0x4c, 0x6f, 0x67, 0x6f, 0x75, 0x74, 0x52, 0x65, 0x71, 0x22, 0x3a, 0x0a, - 0x0a, 0x4c, 0x6f, 0x67, 0x6f, 0x75, 0x74, 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, 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, 0x32, 0x8f, 0x03, - 0x0a, 0x06, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x12, 0x79, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x56, + 0x6f, 0x74, 0x6f, 0x22, 0x36, 0x0a, 0x0c, 0x49, 0x44, 0x4e, 0x6f, 0x43, 0x68, 0x65, 0x63, 0x6b, + 0x52, 0x65, 0x71, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x64, 0x6e, 0x6f, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x69, 0x64, 0x6e, 0x6f, 0x22, 0x55, 0x0a, 0x0d, 0x49, + 0x44, 0x4e, 0x6f, 0x43, 0x68, 0x65, 0x63, 0x6b, 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, 0x16, 0x0a, 0x06, 0x73, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x22, 0x4f, 0x0a, 0x0e, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x50, 0x68, 0x6f, 0x6e, + 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, 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, 0x57, 0x0a, 0x0f, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x50, 0x68, 0x6f, + 0x6e, 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, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 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, 0x22, + 0x0b, 0x0a, 0x09, 0x4c, 0x6f, 0x67, 0x6f, 0x75, 0x74, 0x52, 0x65, 0x71, 0x22, 0x3a, 0x0a, 0x0a, + 0x4c, 0x6f, 0x67, 0x6f, 0x75, 0x74, 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, 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, 0x32, 0xf0, 0x03, 0x0a, + 0x06, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x12, 0x5f, 0x0a, 0x09, 0x49, 0x44, 0x4e, 0x6f, 0x43, + 0x68, 0x65, 0x63, 0x6b, 0x12, 0x18, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x64, 0x72, 0x69, 0x76, 0x65, + 0x72, 0x2e, 0x49, 0x44, 0x4e, 0x6f, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x1a, 0x19, + 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x2e, 0x49, 0x44, 0x4e, 0x6f, + 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x22, 0x1d, 0x82, 0xd3, 0xe4, 0x93, 0x02, + 0x17, 0x3a, 0x01, 0x2a, 0x22, 0x12, 0x2f, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x2f, 0x69, 0x64, + 0x6e, 0x6f, 0x2d, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x12, 0x79, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x1c, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x1d, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x64, 0x72, @@ -566,28 +694,32 @@ func file_api_driver_driver_proto_rawDescGZIP() []byte { return file_api_driver_driver_proto_rawDescData } -var file_api_driver_driver_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_api_driver_driver_proto_msgTypes = make([]protoimpl.MessageInfo, 10) var file_api_driver_driver_proto_goTypes = []any{ - (*SubmitPhoneReq)(nil), // 0: api.driver.SubmitPhoneReq - (*SubmitPhoneResp)(nil), // 1: api.driver.SubmitPhoneResp - (*GetVerifyCodeReq)(nil), // 2: api.driver.GetVerifyCodeReq - (*GetVerifyCodeResp)(nil), // 3: api.driver.GetVerifyCodeResp - (*LogoutReq)(nil), // 4: api.driver.LogoutReq - (*LogoutResp)(nil), // 5: api.driver.LogoutResp - (*LoginReq)(nil), // 6: api.driver.LoginReq - (*LoginResp)(nil), // 7: api.driver.LoginResp + (*IDNoCheckReq)(nil), // 0: api.driver.IDNoCheckReq + (*IDNoCheckResp)(nil), // 1: api.driver.IDNoCheckResp + (*SubmitPhoneReq)(nil), // 2: api.driver.SubmitPhoneReq + (*SubmitPhoneResp)(nil), // 3: api.driver.SubmitPhoneResp + (*GetVerifyCodeReq)(nil), // 4: api.driver.GetVerifyCodeReq + (*GetVerifyCodeResp)(nil), // 5: api.driver.GetVerifyCodeResp + (*LogoutReq)(nil), // 6: api.driver.LogoutReq + (*LogoutResp)(nil), // 7: api.driver.LogoutResp + (*LoginReq)(nil), // 8: api.driver.LoginReq + (*LoginResp)(nil), // 9: api.driver.LoginResp } var file_api_driver_driver_proto_depIdxs = []int32{ - 2, // 0: api.driver.Driver.GetVerifyCode:input_type -> api.driver.GetVerifyCodeReq - 6, // 1: api.driver.Driver.Login:input_type -> api.driver.LoginReq - 4, // 2: api.driver.Driver.Loginout:input_type -> api.driver.LogoutReq - 0, // 3: api.driver.Driver.SubmitPhone:input_type -> api.driver.SubmitPhoneReq - 3, // 4: api.driver.Driver.GetVerifyCode:output_type -> api.driver.GetVerifyCodeResp - 7, // 5: api.driver.Driver.Login:output_type -> api.driver.LoginResp - 5, // 6: api.driver.Driver.Loginout:output_type -> api.driver.LogoutResp - 1, // 7: api.driver.Driver.SubmitPhone:output_type -> api.driver.SubmitPhoneResp - 4, // [4:8] is the sub-list for method output_type - 0, // [0:4] is the sub-list for method input_type + 0, // 0: api.driver.Driver.IDNoCheck:input_type -> api.driver.IDNoCheckReq + 4, // 1: api.driver.Driver.GetVerifyCode:input_type -> api.driver.GetVerifyCodeReq + 8, // 2: api.driver.Driver.Login:input_type -> api.driver.LoginReq + 6, // 3: api.driver.Driver.Loginout:input_type -> api.driver.LogoutReq + 2, // 4: api.driver.Driver.SubmitPhone:input_type -> api.driver.SubmitPhoneReq + 1, // 5: api.driver.Driver.IDNoCheck:output_type -> api.driver.IDNoCheckResp + 5, // 6: api.driver.Driver.GetVerifyCode:output_type -> api.driver.GetVerifyCodeResp + 9, // 7: api.driver.Driver.Login:output_type -> api.driver.LoginResp + 7, // 8: api.driver.Driver.Loginout:output_type -> api.driver.LogoutResp + 3, // 9: api.driver.Driver.SubmitPhone:output_type -> api.driver.SubmitPhoneResp + 5, // [5:10] is the sub-list for method output_type + 0, // [0:5] 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 @@ -604,7 +736,7 @@ func file_api_driver_driver_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_api_driver_driver_proto_rawDesc, NumEnums: 0, - NumMessages: 8, + NumMessages: 10, NumExtensions: 0, NumServices: 1, }, diff --git a/backend/driver/api/driver/driver.proto b/backend/driver/api/driver/driver.proto index f749b69..89bb84e 100644 --- a/backend/driver/api/driver/driver.proto +++ b/backend/driver/api/driver/driver.proto @@ -7,6 +7,13 @@ option go_package = "driver/api/driver;driver"; service Driver { + //实名认证的功能 + rpc IDNoCheck (IDNoCheckReq) returns (IDNoCheckResp){ + option (google.api.http)={ + post:"/driver/idno-check", + body:"*", + }; + } //验证码 rpc GetVerifyCode(GetVerifyCodeReq) returns (GetVerifyCodeResp){ option (google.api.http) = {//{telephone} @@ -36,6 +43,16 @@ service Driver { } +// 提交电话号码请求消息 +message IDNoCheckReq { + string name = 1; + string idno = 2; +}; +message IDNoCheckResp { + int64 code = 1; + string message = 2; + string status = 3; +}; // 提交电话号码请求消息 message SubmitPhoneReq { string telephone = 1; diff --git a/backend/driver/api/driver/driver_grpc.pb.go b/backend/driver/api/driver/driver_grpc.pb.go index dac05da..dfddf3f 100644 --- a/backend/driver/api/driver/driver_grpc.pb.go +++ b/backend/driver/api/driver/driver_grpc.pb.go @@ -19,6 +19,7 @@ import ( const _ = grpc.SupportPackageIsVersion9 const ( + Driver_IDNoCheck_FullMethodName = "/api.driver.Driver/IDNoCheck" Driver_GetVerifyCode_FullMethodName = "/api.driver.Driver/GetVerifyCode" Driver_Login_FullMethodName = "/api.driver.Driver/Login" Driver_Loginout_FullMethodName = "/api.driver.Driver/Loginout" @@ -29,6 +30,8 @@ const ( // // 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 DriverClient interface { + // 实名认证的功能 + IDNoCheck(ctx context.Context, in *IDNoCheckReq, opts ...grpc.CallOption) (*IDNoCheckResp, error) // 验证码 GetVerifyCode(ctx context.Context, in *GetVerifyCodeReq, opts ...grpc.CallOption) (*GetVerifyCodeResp, error) // 登录 @@ -46,6 +49,16 @@ func NewDriverClient(cc grpc.ClientConnInterface) DriverClient { return &driverClient{cc} } +func (c *driverClient) IDNoCheck(ctx context.Context, in *IDNoCheckReq, opts ...grpc.CallOption) (*IDNoCheckResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(IDNoCheckResp) + err := c.cc.Invoke(ctx, Driver_IDNoCheck_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *driverClient) GetVerifyCode(ctx context.Context, in *GetVerifyCodeReq, opts ...grpc.CallOption) (*GetVerifyCodeResp, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(GetVerifyCodeResp) @@ -90,6 +103,8 @@ func (c *driverClient) SubmitPhone(ctx context.Context, in *SubmitPhoneReq, opts // All implementations must embed UnimplementedDriverServer // for forward compatibility. type DriverServer interface { + // 实名认证的功能 + IDNoCheck(context.Context, *IDNoCheckReq) (*IDNoCheckResp, error) // 验证码 GetVerifyCode(context.Context, *GetVerifyCodeReq) (*GetVerifyCodeResp, error) // 登录 @@ -107,6 +122,9 @@ type DriverServer interface { // pointer dereference when methods are called. type UnimplementedDriverServer struct{} +func (UnimplementedDriverServer) IDNoCheck(context.Context, *IDNoCheckReq) (*IDNoCheckResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method IDNoCheck not implemented") +} func (UnimplementedDriverServer) GetVerifyCode(context.Context, *GetVerifyCodeReq) (*GetVerifyCodeResp, error) { return nil, status.Errorf(codes.Unimplemented, "method GetVerifyCode not implemented") } @@ -140,6 +158,24 @@ func RegisterDriverServer(s grpc.ServiceRegistrar, srv DriverServer) { s.RegisterService(&Driver_ServiceDesc, srv) } +func _Driver_IDNoCheck_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(IDNoCheckReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DriverServer).IDNoCheck(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Driver_IDNoCheck_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DriverServer).IDNoCheck(ctx, req.(*IDNoCheckReq)) + } + return interceptor(ctx, in, info, handler) +} + func _Driver_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 { @@ -219,6 +255,10 @@ var Driver_ServiceDesc = grpc.ServiceDesc{ ServiceName: "api.driver.Driver", HandlerType: (*DriverServer)(nil), Methods: []grpc.MethodDesc{ + { + MethodName: "IDNoCheck", + Handler: _Driver_IDNoCheck_Handler, + }, { MethodName: "GetVerifyCode", Handler: _Driver_GetVerifyCode_Handler, diff --git a/backend/driver/api/driver/driver_http.pb.go b/backend/driver/api/driver/driver_http.pb.go index ef4994b..e16950f 100644 --- a/backend/driver/api/driver/driver_http.pb.go +++ b/backend/driver/api/driver/driver_http.pb.go @@ -20,6 +20,7 @@ var _ = binding.EncodeURL const _ = http.SupportPackageIsVersion1 const OperationDriverGetVerifyCode = "/api.driver.Driver/GetVerifyCode" +const OperationDriverIDNoCheck = "/api.driver.Driver/IDNoCheck" const OperationDriverLogin = "/api.driver.Driver/Login" const OperationDriverLoginout = "/api.driver.Driver/Loginout" const OperationDriverSubmitPhone = "/api.driver.Driver/SubmitPhone" @@ -27,6 +28,8 @@ const OperationDriverSubmitPhone = "/api.driver.Driver/SubmitPhone" type DriverHTTPServer interface { // GetVerifyCode验证码 GetVerifyCode(context.Context, *GetVerifyCodeReq) (*GetVerifyCodeResp, error) + // IDNoCheck实名认证的功能 + IDNoCheck(context.Context, *IDNoCheckReq) (*IDNoCheckResp, error) // Login登录 Login(context.Context, *LoginReq) (*LoginResp, error) // Loginout退出 @@ -36,12 +39,35 @@ type DriverHTTPServer interface { func RegisterDriverHTTPServer(s *http.Server, srv DriverHTTPServer) { r := s.Route("/") + r.POST("/driver/idno-check", _Driver_IDNoCheck0_HTTP_Handler(srv)) r.GET("/driver/get-verify-code/{telephone}", _Driver_GetVerifyCode0_HTTP_Handler(srv)) r.POST("/driver/login", _Driver_Login0_HTTP_Handler(srv)) r.GET("/driver/logout", _Driver_Loginout0_HTTP_Handler(srv)) r.POST("/driver/submit-phone", _Driver_SubmitPhone0_HTTP_Handler(srv)) } +func _Driver_IDNoCheck0_HTTP_Handler(srv DriverHTTPServer) func(ctx http.Context) error { + return func(ctx http.Context) error { + var in IDNoCheckReq + if err := ctx.Bind(&in); err != nil { + return err + } + if err := ctx.BindQuery(&in); err != nil { + return err + } + http.SetOperation(ctx, OperationDriverIDNoCheck) + h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.IDNoCheck(ctx, req.(*IDNoCheckReq)) + }) + out, err := h(ctx, &in) + if err != nil { + return err + } + reply := out.(*IDNoCheckResp) + return ctx.Result(200, reply) + } +} + func _Driver_GetVerifyCode0_HTTP_Handler(srv DriverHTTPServer) func(ctx http.Context) error { return func(ctx http.Context) error { var in GetVerifyCodeReq @@ -129,6 +155,7 @@ func _Driver_SubmitPhone0_HTTP_Handler(srv DriverHTTPServer) func(ctx http.Conte type DriverHTTPClient interface { GetVerifyCode(ctx context.Context, req *GetVerifyCodeReq, opts ...http.CallOption) (rsp *GetVerifyCodeResp, err error) + IDNoCheck(ctx context.Context, req *IDNoCheckReq, opts ...http.CallOption) (rsp *IDNoCheckResp, err error) Login(ctx context.Context, req *LoginReq, opts ...http.CallOption) (rsp *LoginResp, err error) Loginout(ctx context.Context, req *LogoutReq, opts ...http.CallOption) (rsp *LogoutResp, err error) SubmitPhone(ctx context.Context, req *SubmitPhoneReq, opts ...http.CallOption) (rsp *SubmitPhoneResp, err error) @@ -155,6 +182,19 @@ func (c *DriverHTTPClientImpl) GetVerifyCode(ctx context.Context, in *GetVerifyC return &out, nil } +func (c *DriverHTTPClientImpl) IDNoCheck(ctx context.Context, in *IDNoCheckReq, opts ...http.CallOption) (*IDNoCheckResp, error) { + var out IDNoCheckResp + pattern := "/driver/idno-check" + path := binding.EncodeURL(pattern, in, false) + opts = append(opts, http.Operation(OperationDriverIDNoCheck)) + 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 +} + func (c *DriverHTTPClientImpl) Login(ctx context.Context, in *LoginReq, opts ...http.CallOption) (*LoginResp, error) { var out LoginResp pattern := "/driver/login" diff --git a/backend/driver/go.mod b/backend/driver/go.mod index 2aaf54d..828d147 100644 --- a/backend/driver/go.mod +++ b/backend/driver/go.mod @@ -29,6 +29,7 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/go-playground/form/v4 v4.2.1 // indirect github.com/go-sql-driver/mysql v1.7.0 // indirect + github.com/golang-jwt/jwt/v5 v5.2.1 // indirect github.com/google/subcommands v1.2.0 // indirect github.com/gorilla/mux v1.8.1 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect diff --git a/backend/driver/go.sum b/backend/driver/go.sum index 2e74dda..305a456 100644 --- a/backend/driver/go.sum +++ b/backend/driver/go.sum @@ -66,6 +66,8 @@ github.com/go-sql-driver/mysql v1.7.0 h1:ueSltNNllEqE3qcWBTD0iQd3IpL/6U+mJxLkazJ github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= +github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= diff --git a/backend/driver/internal/biz/driver.go b/backend/driver/internal/biz/driver.go index ecfca7b..49648b7 100644 --- a/backend/driver/internal/biz/driver.go +++ b/backend/driver/internal/biz/driver.go @@ -4,20 +4,86 @@ import ( "context" "database/sql" "errors" + errors1 "github.com/go-kratos/kratos/v2/errors" + "github.com/golang-jwt/jwt/v5" "gorm.io/gorm" "regexp" + "time" ) +const Secret = "driver secret key" + type DriverBiz struct { - di DriverInterface + Di DriverInterface } type DriverInterface interface { GetVerifyCode(context.Context, string) (string, error) + InitDriverInfo(context.Context, string) (*Driver, error) + GetSaveVerifyCode(context.Context, string) (string, error) + SaveToken(context.Context, string, string) error + GetToken(context.Context, string) (string, error) + FetchInfoByTel(context.Context, string) (*Driver, error) +} + +// 对比校验验证码是否一致 +func (db *DriverBiz) CheckLogin(ctx context.Context, tel, verifyCode string) (string, error) { + code, err := db.Di.GetSaveVerifyCode(ctx, tel) + if err != nil { + return "", err + } + if verifyCode != code { + return "", errors1.New(1, "verify code error not match", "") + } + //生成token + token, err := genterateJWT(tel) + if err != nil { + return "", err + } + //把token存储在driver中 + err = db.Di.SaveToken(context.Background(), tel, token) + if err != nil { + return "", err + } + return token, nil } +func genterateJWT(tel string) (string, error) { + cliams := jwt.RegisteredClaims{ + //签发方 + Issuer: "LaoMaDJ", + Subject: "customer authentication", + //前发给谁使用 + Audience: []string{"driver"}, + //有效日期至 + ExpiresAt: jwt.NewNumericDate(time.Now().Add(1 * 30 * 24 * 3600 * time.Second)), + //何时启用 + NotBefore: nil, + //签发时间 + IssuedAt: jwt.NewNumericDate(time.Now()), + //ID用户的ID + ID: tel, + } + //生成token + token := jwt.NewWithClaims(jwt.SigningMethodHS256, cliams) + //签发token + + signedToken, err := token.SignedString([]byte(Secret)) + if err != nil { + return "", nil + } + + return signedToken, nil +} +func (db *DriverBiz) InitDriverInfo(ctx context.Context, tel string) (*Driver, error) { + if tel == "" { + return nil, errors1.New(1, "telephone is empty", "") + } + + return db.Di.InitDriverInfo(ctx, tel) +} func NewDriverBiz(di DriverInterface) *DriverBiz { return &DriverBiz{ - di: di, + Di: di, } } @@ -58,5 +124,5 @@ func (db *DriverBiz) GetVerifyCode(ctx context.Context, tel string) (string, err if !reg.MatchString(tel) { return "", errors.New("格式不匹配") } - return db.di.GetVerifyCode(ctx, tel) + return db.Di.GetVerifyCode(ctx, tel) } diff --git a/backend/driver/internal/data/driver.go b/backend/driver/internal/data/driver.go index ba2fd3d..8675e0e 100644 --- a/backend/driver/internal/data/driver.go +++ b/backend/driver/internal/data/driver.go @@ -2,6 +2,7 @@ package data import ( "context" + "database/sql" "driver/api/verifyCode" "driver/internal/biz" "github.com/go-kratos/kratos/contrib/registry/consul/v2" @@ -23,6 +24,66 @@ func NewDriverInterface(data *Data) biz.DriverInterface { return &DriverData{data: data} } +// 获取redis中的验证码 +func (di *DriverData) GetSaveVerifyCode(ctx context.Context, telephone string) (string, error) { + status := di.data.Rdb.Get(context.Background(), "CVC"+telephone) + return status.Val(), nil + +} + +// 获取司机信息 +func (di *DriverData) FetchInfoByTel(ctx context.Context, tel string) (*biz.Driver, error) { + driver := &biz.Driver{} + if err := di.data.Mdb.Where("telephone=?", tel).First(driver).Error; err != nil { + return driver, nil + } + return driver, nil +} + +// 获取token +func (di *DriverData) GetToken(ctx context.Context, tel string) (string, error) { + //1.数据表查询 + driver := biz.Driver{} + if err := di.data.Mdb.Where("telephone=?", tel).First(&driver).Error; err != nil { + return "", err + } + //返回token + + return driver.Token.String, nil +} + +// 存储token +func (di *DriverData) SaveToken(ctx context.Context, tel, token string) error { + driver := biz.Driver{} + if err := di.data.Mdb.Where("telephone=?", tel).First(&driver).Error; err != nil { + return err + } + //存储其他司机信息 + driver.Token = sql.NullString{ + String: token, + Valid: true, + } + if err := di.data.Mdb.Save(&driver).Error; err != nil { + return err + } + return nil +} +func (dt *DriverData) InitDriverInfo(ctx context.Context, tel string) (*biz.Driver, error) { + driver := biz.Driver{} + driver.Telephone = tel + driver.Status = sql.NullString{ + String: "stop", + Valid: true, + } + + if err := dt.data.Mdb.Create(&driver).Error; err != nil { + return nil, err + } + + // 返回driver的指针和nil错误 + return &driver, nil +} + func (dt *DriverData) GetVerifyCode(ctx context.Context, tel string) (string, error) { //1 获取consul客户端 diff --git a/backend/driver/internal/server/cors.go b/backend/driver/internal/server/cors.go new file mode 100644 index 0000000..b0ff5b4 --- /dev/null +++ b/backend/driver/internal/server/cors.go @@ -0,0 +1,28 @@ +package server + +import ( + "context" + "github.com/go-kratos/kratos/v2/middleware" + "github.com/go-kratos/kratos/v2/transport" + "github.com/go-kratos/kratos/v2/transport/http" +) + +func MWCors() middleware.Middleware { + + return func(handler middleware.Handler) middleware.Handler { + return func(ctx context.Context, req interface{}) (reply interface{}, err error) { + if tr, ok := transport.FromServerContext(ctx); ok { + // Do something on entering + ht := tr.(http.Transporter) + ht.ReplyHeader().Set("Access-Conteol-Allow-Origin", "*") + ht.ReplyHeader().Set("Access-Conteol-Allow-Methods", "GET,PSOT,PUT,DELETE,PATCH,OPTIONS") + ht.ReplyHeader().Set("Access-Conteol-Allow-Credentials", "true") + ht.ReplyHeader().Set("Access-Conteol-Allow-Headers", "Content-Type,X-Requested-With,Access-Control-Allow-Credentials,User-Agent,Content-Length,Authorization") + defer func() { + // Do something on exiting + }() + } + return handler(ctx, req) + } + } +} diff --git a/backend/driver/internal/server/http.go b/backend/driver/internal/server/http.go index f11ded6..e62a831 100644 --- a/backend/driver/internal/server/http.go +++ b/backend/driver/internal/server/http.go @@ -1,13 +1,18 @@ package server import ( - driver2 "driver/api/driver" + driver3 "driver/api/driver" v1 "driver/api/helloworld/v1" + driver2 "driver/internal/biz" "driver/internal/conf" "driver/internal/service" "github.com/go-kratos/kratos/v2/log" + "github.com/go-kratos/kratos/v2/middleware/auth/jwt" "github.com/go-kratos/kratos/v2/middleware/recovery" + "github.com/go-kratos/kratos/v2/middleware/selector" "github.com/go-kratos/kratos/v2/transport/http" + jwtv5 "github.com/golang-jwt/jwt/v5" + "golang.org/x/net/context" ) // NewHTTPServer new an HTTP server. @@ -15,6 +20,25 @@ func NewHTTPServer(c *conf.Server, greeter *service.GreeterService, driverServic var opts = []http.ServerOption{ http.Middleware( recovery.Recovery(), + selector.Server(MWCors()).Match(func(ctx context.Context, operation string) bool { + return true + }).Build(), + + //自己设置的中间件 + selector.Server(jwt.Server(func(token *jwtv5.Token) (interface{}, error) { + return []byte(driver2.Secret), nil + }), DriverToken(driverService)).Match( + func(ctx context.Context, operation string) bool { + //根据自己的需求 完成是否启用中间件的校验 + noJWT := map[string]struct{}{ + "/api.driver.Driver/Login": {}, + "/api.driver.Driver/GetVerifyCode": {}, + } + if _, exists := noJWT[operation]; exists { + return false + } + return true + }).Build(), ), } if c.Http.Network != "" { @@ -28,6 +52,6 @@ func NewHTTPServer(c *conf.Server, greeter *service.GreeterService, driverServic } srv := http.NewServer(opts...) v1.RegisterGreeterHTTPServer(srv, greeter) - driver2.RegisterDriverHTTPServer(srv, driverService) + driver3.RegisterDriverHTTPServer(srv, driverService) return srv } diff --git a/backend/driver/internal/server/token.go b/backend/driver/internal/server/token.go new file mode 100644 index 0000000..04d3f70 --- /dev/null +++ b/backend/driver/internal/server/token.go @@ -0,0 +1,57 @@ +package server + +import ( + "context" + "driver/internal/service" + + "github.com/go-kratos/kratos/v2/errors" + "github.com/go-kratos/kratos/v2/middleware" + "github.com/go-kratos/kratos/v2/middleware/auth/jwt" + "github.com/go-kratos/kratos/v2/transport" + jwtv5 "github.com/golang-jwt/jwt/v5" + "strings" +) + +func DriverToken(driverService *service.DriverService) middleware.Middleware { + return func(handler middleware.Handler) middleware.Handler { + return func(ctx context.Context, req interface{}) (interface{}, error) { + //获取存储在jwt中的顾客的id + claims, ok := jwt.FromContext(ctx) + if !ok { + return nil, errors.Unauthorized("UNAUTHORIZED", + "claims not found") + } + //断言使用 + claimsMap := claims.(jwtv5.MapClaims) + tel := claimsMap["jti"] + + //获取id对应的顾客的token + token, err := driverService.Di.Di.GetToken(context.Background(), tel.(string)) + if err != nil { + return nil, errors.Unauthorized("UNAUTHORIZED", + "customer not found") + } + //对比数据表中的token与请求的token是否一致 + //获取请求头 + header, _ := transport.FromServerContext(ctx) + //从header中获取token + auths := strings.SplitN(header.RequestHeader().Get("Authorization"), " ", 2) + jwtToken := auths[1] + //比较请求中的token是否和表中的token是否一致 + if jwtToken != token { + return nil, errors.Unauthorized("UNAUTHORIZED", + "token was updated") + } + //记录登陆司机信息 + driver, err := driverService.Di.Di.FetchInfoByTel(ctx, tel.(string)) + if err != nil { + return nil, errors.Unauthorized("UNAUTHORIZED", + "driver was not found") + } + ctxWithDriver := context.WithValue(ctx, "driver", driver) + + //校验通过 执行下面的中间件 + return handler(ctxWithDriver, req) + } + } +} diff --git a/backend/driver/internal/service/driver.go b/backend/driver/internal/service/driver.go index 27f0a53..e5ae1d0 100644 --- a/backend/driver/internal/service/driver.go +++ b/backend/driver/internal/service/driver.go @@ -3,6 +3,7 @@ package service import ( "context" "driver/internal/biz" + "log" "time" pb "driver/api/driver" @@ -10,18 +11,18 @@ import ( type DriverService struct { pb.UnimplementedDriverServer - di *biz.DriverBiz + Di *biz.DriverBiz } func NewDriverService(di *biz.DriverBiz) *DriverService { return &DriverService{ - di: di, + Di: di, } } func (s *DriverService) GetVerifyCode(ctx context.Context, req *pb.GetVerifyCodeReq) (*pb.GetVerifyCodeResp, error) { - Code, err := s.di.GetVerifyCode(context.Background(), req.Telephone) + Code, err := s.Di.GetVerifyCode(context.Background(), req.Telephone) if err != nil { return &pb.GetVerifyCodeResp{ Code: 1, @@ -40,11 +41,44 @@ func (s *DriverService) GetVerifyCode(ctx context.Context, req *pb.GetVerifyCode }, nil } func (s *DriverService) Login(ctx context.Context, req *pb.LoginReq) (*pb.LoginResp, error) { - return &pb.LoginResp{}, nil + token, err := s.Di.CheckLogin(ctx, req.Telephone, req.VerifyCode) + if err != nil { + log.Println(err) + return &pb.LoginResp{ + Code: 1, + Message: "司机登陆失败", + }, nil + } + return &pb.LoginResp{ + Code: 0, + Message: "司机登陆成功", + Token: token, + TokenCreateAt: time.Now().Unix(), + TokenLife: 1 * 30 * 24 * 3600, + }, nil + } func (s *DriverService) Loginout(ctx context.Context, req *pb.LogoutReq) (*pb.LogoutResp, error) { return &pb.LogoutResp{}, nil } func (s *DriverService) SubmitPhone(ctx context.Context, req *pb.SubmitPhoneReq) (*pb.SubmitPhoneResp, error) { - return &pb.SubmitPhoneResp{}, nil + //司机信息入库 并设置状态为stop暂停使用 + driver, err := s.Di.InitDriverInfo(ctx, req.Telephone) + if err != nil { + return &pb.SubmitPhoneResp{ + Code: 1, + Message: "司机号码提交失败", + }, nil + + } + return &pb.SubmitPhoneResp{ + Code: 0, + Message: "司机号码提交成功", + Status: driver.Status.String, + }, nil + +} + +func (s *DriverService) IDNoCheck(ctx context.Context, req *pb.IDNoCheckReq) (*pb.IDNoCheckResp, error) { + return &pb.IDNoCheckResp{}, nil } diff --git a/backend/driver/openapi.yaml b/backend/driver/openapi.yaml index 434e443..aa2e519 100644 --- a/backend/driver/openapi.yaml +++ b/backend/driver/openapi.yaml @@ -31,6 +31,31 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' + /driver/idno-check: + post: + tags: + - Driver + description: 实名认证的功能 + operationId: Driver_IDNoCheck + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/IDNoCheckReq' + required: true + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/IDNoCheckResp' + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' /driver/login: post: tags: @@ -122,6 +147,23 @@ 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. + IDNoCheckReq: + type: object + properties: + name: + type: string + idno: + type: string + description: 提交电话号码请求消息 + IDNoCheckResp: + type: object + properties: + code: + type: string + message: + type: string + status: + type: string LoginReq: type: object properties: