diff --git a/api/exhibition/exhibition.pb.go b/api/exhibition/exhibition.pb.go index 0269256..aebef5e 100644 --- a/api/exhibition/exhibition.pb.go +++ b/api/exhibition/exhibition.pb.go @@ -39,6 +39,8 @@ type RegisterInfo struct { ArtistPhoto string `protobuf:"bytes,10,opt,name=artistPhoto,proto3" json:"artistPhoto"` CreatedAt string `protobuf:"bytes,11,opt,name=createdAt,proto3" json:"createdAt"` UpdatedAt string `protobuf:"bytes,12,opt,name=updatedAt,proto3" json:"updatedAt"` + IdCardStartDate string `protobuf:"bytes,13,opt,name=idCardStartDate,proto3" json:"idCardStartDate"` + IdCardEndDate string `protobuf:"bytes,14,opt,name=idCardEndDate,proto3" json:"idCardEndDate"` } func (x *RegisterInfo) Reset() { @@ -157,6 +159,20 @@ func (x *RegisterInfo) GetUpdatedAt() string { return "" } +func (x *RegisterInfo) GetIdCardStartDate() string { + if x != nil { + return x.IdCardStartDate + } + return "" +} + +func (x *RegisterInfo) GetIdCardEndDate() string { + if x != nil { + return x.IdCardEndDate + } + return "" +} + type SaveRegisterRecordResp struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -652,7 +668,7 @@ var file_pb_exhibition_proto_rawDesc = []byte{ 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0a, 0x65, 0x78, 0x68, 0x69, 0x62, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x12, 0x70, 0x62, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x13, 0x70, 0x62, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, - 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe2, 0x02, 0x0a, 0x0c, 0x52, + 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xb2, 0x03, 0x0a, 0x0c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x75, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x75, 0x75, 0x69, 0x64, 0x12, @@ -674,7 +690,12 @@ var file_pb_exhibition_proto_rawDesc = []byte{ 0x6f, 0x74, 0x6f, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x0c, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x22, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, + 0x28, 0x0a, 0x0f, 0x69, 0x64, 0x43, 0x61, 0x72, 0x64, 0x53, 0x74, 0x61, 0x72, 0x74, 0x44, 0x61, + 0x74, 0x65, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x69, 0x64, 0x43, 0x61, 0x72, 0x64, + 0x53, 0x74, 0x61, 0x72, 0x74, 0x44, 0x61, 0x74, 0x65, 0x12, 0x24, 0x0a, 0x0d, 0x69, 0x64, 0x43, + 0x61, 0x72, 0x64, 0x45, 0x6e, 0x64, 0x44, 0x61, 0x74, 0x65, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0d, 0x69, 0x64, 0x43, 0x61, 0x72, 0x64, 0x45, 0x6e, 0x64, 0x44, 0x61, 0x74, 0x65, 0x22, 0x58, 0x0a, 0x16, 0x53, 0x61, 0x76, 0x65, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12, 0x2c, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x65, 0x78, 0x68, 0x69, 0x62, 0x69, diff --git a/pkg/service/register_record.go b/pkg/service/register_record.go index dfb3594..f3ffc36 100644 --- a/pkg/service/register_record.go +++ b/pkg/service/register_record.go @@ -48,6 +48,34 @@ func CheckByPhone(c *gin.Context) { response.ResponseQuickMsg(c, msg.Fail, err.Error(), nil) return } + img := resp.Data.IdCardBackPhoto + + response1, err := http.Get(img) + if err != nil { + fmt.Println("网络请求错误:", err) + return + } + + defer response1.Body.Close() + + // 读取图片数据 + imageData, err := ioutil.ReadAll(response1.Body) + if err != nil { + fmt.Println("读取图片数据错误:", err) + return + } + + // 将图片数据转换为base64编码 + base64Data := base64.StdEncoding.EncodeToString(imageData) + result, err := model.OcrGetIdCard(base64Data, "back") + if err != nil { + response.ResponseQuickMsg(c, msg.Fail, err.Error(), nil) + return + } + + resp.Data.IdCardStartDate = result.IssueDate + resp.Data.IdCardEndDate = result.ExpirationDate + response.ResponseQuickMsg(c, msg.Ok, resp.Msg, resp) return