瀏覽代碼

Merge branch 'master' of http://8.136.199.33:3000/hongze/hz_crm_api into debug

xingzai 1 年之前
父節點
當前提交
96f8dc7f4a
共有 1 個文件被更改,包括 19 次插入2 次删除
  1. 19 2
      services/aliyun.go

+ 19 - 2
services/aliyun.go

@@ -10,6 +10,7 @@ import (
 	util "github.com/alibabacloud-go/tea-utils/v2/service"
 	"github.com/alibabacloud-go/tea/tea"
 	rhttp "github.com/rdlucklib/rdluck_tools/http"
+	"hongze/hz_crm_api/models/company"
 	"hongze/hz_crm_api/models/cygx"
 	"hongze/hz_crm_api/utils"
 	"io"
@@ -232,9 +233,25 @@ func AliyunOcrBusinessCard(imageurl string) (result *OcrBusinessCardResult, errM
 	if len(result.Company) == 0 && len(result.TelCell) == 0 {
 		errMsg = "OCR识别失败"
 	} else if len(result.Company) == 0 {
-		errMsg = "名片中未识别到公司名称"
+		// 获取图片识别客户名称的配置
+		crmConfig, errCode := company.GetConfigDetailByCode("card_recognition_company_name")
+		if errCode != nil {
+			err = errCode
+			return
+		}
+		if crmConfig.ConfigValue == "true" {
+			errMsg = "名片中未识别到公司名称"
+		}
 	} else if len(result.TelCell) == 0 {
-		errMsg = " 名片中未识别到手机号"
+		// 获取图片识别手机号的配置
+		crmConfig2, errCode := company.GetConfigDetailByCode("card_recognition_tel")
+		if errCode != nil {
+			err = errCode
+			return
+		}
+		if crmConfig2.ConfigValue == "true" {
+			errMsg = " 名片中未识别到手机号"
+		}
 	}
 
 	logItem := new(cygx.AliyunOcrLog)