Files
tyapi-server/internal/domains/certification/dto/ocr_dto.go
2025-07-11 21:05:58 +08:00

78 lines
4.0 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package dto
// BusinessLicenseResult 营业执照识别结果
type BusinessLicenseResult struct {
CompanyName string `json:"company_name"` // 公司名称
LegalRepresentative string `json:"legal_representative"` // 法定代表人
RegisteredCapital string `json:"registered_capital"` // 注册资本
RegisteredAddress string `json:"registered_address"` // 注册地址
RegistrationNumber string `json:"registration_number"` // 统一社会信用代码
BusinessScope string `json:"business_scope"` // 经营范围
RegistrationDate string `json:"registration_date"` // 成立日期
ValidDate string `json:"valid_date"` // 营业期限
Confidence float64 `json:"confidence"` // 识别置信度
Words []string `json:"words"` // 识别的所有文字
}
// IDCardResult 身份证识别结果
type IDCardResult struct {
Side string `json:"side"` // 身份证面front/back
Name string `json:"name"` // 姓名(正面)
Sex string `json:"sex"` // 性别(正面)
Nation string `json:"nation"` // 民族(正面)
BirthDate string `json:"birth_date"` // 出生日期(正面)
Address string `json:"address"` // 住址(正面)
IDNumber string `json:"id_number"` // 身份证号码(正面)
IssuingAuthority string `json:"issuing_authority"` // 签发机关(背面)
ValidDate string `json:"valid_date"` // 有效期限(背面)
Confidence float64 `json:"confidence"` // 识别置信度
Words []string `json:"words"` // 识别的所有文字
}
// GeneralTextResult 通用文字识别结果
type GeneralTextResult struct {
Words []string `json:"words"` // 识别的文字列表
Confidence float64 `json:"confidence"` // 识别置信度
}
// OCREnterpriseInfo OCR识别的企业信息
type OCREnterpriseInfo struct {
CompanyName string `json:"company_name"` // 企业名称
UnifiedSocialCode string `json:"unified_social_code"` // 统一社会信用代码
LegalPersonName string `json:"legal_person_name"` // 法人姓名
LegalPersonID string `json:"legal_person_id"` // 法人身份证号
Confidence float64 `json:"confidence"` // 识别置信度
}
// LicenseProcessResult 营业执照处理结果
type LicenseProcessResult struct {
LicenseURL string `json:"license_url"` // 营业执照文件URL
EnterpriseInfo *OCREnterpriseInfo `json:"enterprise_info"` // OCR识别的企业信息
OCRSuccess bool `json:"ocr_success"` // OCR是否成功
OCRError string `json:"ocr_error,omitempty"` // OCR错误信息
}
// UploadLicenseRequest 上传营业执照请求
type UploadLicenseRequest struct {
// 文件通过multipart/form-data上传这里定义验证规则
}
// UploadLicenseResponse 上传营业执照响应
type UploadLicenseResponse struct {
UploadRecordID string `json:"upload_record_id"` // 上传记录ID
FileURL string `json:"file_url"` // 文件URL
OCRProcessed bool `json:"ocr_processed"` // OCR是否已处理
OCRSuccess bool `json:"ocr_success"` // OCR是否成功
EnterpriseInfo *OCREnterpriseInfo `json:"enterprise_info"` // OCR识别的企业信息如果成功
OCRErrorMessage string `json:"ocr_error_message,omitempty"` // OCR错误信息如果失败
}
// UploadResult 上传结果
type UploadResult struct {
Key string `json:"key"` // 文件key
URL string `json:"url"` // 文件访问URL
MimeType string `json:"mime_type"` // MIME类型
Size int64 `json:"size"` // 文件大小
Hash string `json:"hash"` // 文件哈希值
}