This commit is contained in:
Mrx
2026-03-05 10:54:16 +08:00
parent 4ee6e891cd
commit c0898e6829
2 changed files with 11 additions and 2 deletions

View File

@@ -599,6 +599,7 @@ type YYSY6F2BReq struct {
type IVYZOCR1Req struct {
PhotoData string `json:"photo_data" validate:"required,validBase64Image"`
}
type YYSY8B1CReq struct {
MobileNo string `json:"mobile_no" validate:"required,min=11,max=11,validMobileNo"`

View File

@@ -21,8 +21,16 @@ func ProcessIVYZOCR2Request(ctx context.Context, params []byte, deps *processors
return nil, errors.Join(processors.ErrInvalidParam, err)
}
reqFormData := map[string]interface{}{
"photo_data": paramsDto.PhotoData,
if paramsDto.PhotoData == "" && paramsDto.ImageUrl == "" {
return nil, errors.Join(processors.ErrInvalidParam, errors.New("photo_data or image_url is required"))
}
// 2选1有值的用对应 key空则用另一个
reqFormData := make(map[string]interface{})
if paramsDto.PhotoData != "" {
reqFormData["image"] = paramsDto.PhotoData
} else {
reqFormData["url"] = paramsDto.ImageUrl
}
// 以表单方式调用数脉 API参数在 CallAPIForm 内转为 application/x-www-form-urlencoded