package ocr import ( "context" "tyapi-server/internal/application/certification/dto/responses" ) // OCRService OCR识别服务接口 type OCRService interface { // 识别营业执照 RecognizeBusinessLicense(ctx context.Context, imageBytes []byte) (*responses.BusinessLicenseResult, error) // 识别身份证 RecognizeIDCard(ctx context.Context, imageBytes []byte, side string) (*responses.IDCardResult, error) // 通用文字识别 RecognizeGeneralText(ctx context.Context, imageBytes []byte) (*responses.GeneralTextResult, error) // 从URL识别图片 RecognizeFromURL(ctx context.Context, imageURL string, ocrType string) (interface{}, error) // 验证营业执照结果 ValidateBusinessLicense(result *responses.BusinessLicenseResult) error // 验证身份证结果 ValidateIDCard(result *responses.IDCardResult) error } // IDCardInfo 身份证识别信息(保留兼容性) type IDCardInfo struct { Name string `json:"name"` // 姓名 IDCardNumber string `json:"id_card_number"` // 身份证号 Gender string `json:"gender"` // 性别 Nation string `json:"nation"` // 民族 Birthday string `json:"birthday"` // 出生日期 Address string `json:"address"` // 住址 IssuingAgency string `json:"issuing_agency"` // 签发机关 ValidPeriod string `json:"valid_period"` // 有效期限 Confidence float64 `json:"confidence"` // 识别置信度 } // GeneralTextResult 通用文字识别结果(保留兼容性) type GeneralTextResult struct { Words []TextLine `json:"words"` // 识别的文字行 Confidence float64 `json:"confidence"` // 整体置信度 } // TextLine 文字行 type TextLine struct { Text string `json:"text"` // 文字内容 Confidence float64 `json:"confidence"` // 置信度 }