소스 검색

OCR识别-营业执照接口修改

lcl 10 달 전
부모
커밋
c16178bcee
1개의 변경된 파일11개의 추가작업 그리고 7개의 파일을 삭제
  1. 11 7
      Areas/Api/Controllers/PubController.cs

+ 11 - 7
Areas/Api/Controllers/PubController.cs

@@ -27,16 +27,20 @@ namespace MySystem.Areas.Api.Controllers
         public JsonResult BusinessLicenseOcr(string value)
         {
             value = DesDecrypt(value);
-            Dictionary<string, object> Obj = BusinessLicenseOcrDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
-        }
-        public Dictionary<string, object> BusinessLicenseOcrDo(string value)
-        {
             JsonData data = JsonMapper.ToObject(value);
             string Url = data["Url"].ToString();
+            if(string.IsNullOrEmpty(Url))
+            {
+                return Json(new AppResultJson() { Status = "-1", Info = "营业执照识别异常,请手动填写" });
+            }
+            string content = AliyunOcr.Check(Url);
+            if(string.IsNullOrEmpty(content))
+            {
+                return Json(new AppResultJson() { Status = "-1", Info = "营业执照识别异常,请手动填写" });
+            }
             Dictionary<string, object> Obj = new Dictionary<string, object>();
-            Obj.Add("OcrData", AliyunOcr.Check(Url));
-            return Obj;
+            Obj.Add("OcrData", content);
+            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
         }
         #endregion
     }