From a9ee8bf270eb8a3315808b24b41417be4b1a8a9a Mon Sep 17 00:00:00 2001
From: sunpengfei <i@angelzzz.com>
Date: 星期三, 20 八月 2025 16:47:34 +0800
Subject: [PATCH] feat:开发

---
 FlexJobApi.Core/Utils/BaiduUtils/BaiduOcrUtils.cs |   46 +++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 45 insertions(+), 1 deletions(-)

diff --git a/FlexJobApi.Core/Utils/BaiduUtils/BaiduOcrUtils.cs b/FlexJobApi.Core/Utils/BaiduUtils/BaiduOcrUtils.cs
index 9e890c9..49bec7f 100644
--- a/FlexJobApi.Core/Utils/BaiduUtils/BaiduOcrUtils.cs
+++ b/FlexJobApi.Core/Utils/BaiduUtils/BaiduOcrUtils.cs
@@ -28,7 +28,7 @@
         /// <param name="url"></param>
         /// <param name="scene"></param>
         /// <param name="isOssUrl"></param>
-        public static async Task<BaiduOcrBusinessLicenseResult> OcrBusinessLicense(this string url, string scene, bool isOssUrl = true)
+        public static async Task<BaiduOcrBusinessLicenseResult> OcrBusinessLicense(this string url, string scene = null, bool isOssUrl = true)
         {
             var options = App.GetOptions<BaiduOptions>();
             var ocr = new Ocr(options.Ocr.Key, options.Ocr.Secret);
@@ -66,5 +66,49 @@
             return result;
         }
 
+        /// <summary>
+        /// 钀ヤ笟鎵х収OCR
+        /// </summary>
+        /// <param name="url"></param>
+        /// <param name="scene"></param>
+        /// <param name="isOssUrl"></param>
+        public static async Task<BaiduOcrIdentityResultModel> OcrIdentity(this string url, string scene = null, bool isOssUrl = true)
+        {
+            var options = App.GetOptions<BaiduOptions>();
+            var ocr = new Ocr(options.Ocr.Key, options.Ocr.Secret);
+            ocr.Timeout = 60000;
+            JObject value;
+            if (isOssUrl)
+            {
+                var downloadUrl = AliyunOSSUtils.GetUrl(url);
+                var buffer = await App.GetRequiredService<IHttpRemoteService>().GetAsByteArrayAsync(downloadUrl);
+                value = ocr.Idcard(buffer, "1");
+            }
+            else
+            {
+                var upload = AliyunOSSUtils.Upload(scene, url);
+                url = upload.Url;
+                //value = ocr.Idcard(upload.Buffer);
+            }
+            //var result = value.ToObject<BaiduOcrIdentityResult>();
+            //result.Url = url;
+            //if (result.ErrorCode.IsNotNull())
+            //{
+            //    return result;
+            //}
+            //result.Model = new BaiduOcrIdentityResultModel
+            //{
+            //    EnterpriseName = result.WordsResult["鍗曚綅鍚嶇О"].Words,
+            //    SocietyCreditCode = result.WordsResult["绀句細淇$敤浠g爜"].Words,
+            //    LegalPerson = result.WordsResult["娉曚汉"].Words,
+            //    EnterpriseType = result.WordsResult["绫诲瀷"].Words,
+            //    RegisteredCapital = result.WordsResult["娉ㄥ唽璧勬湰"].Words,
+            //    EstablishmentDate = result.WordsResult["鎴愮珛鏃ユ湡"].Words,
+            //    Address = result.WordsResult["鍦板潃"].Words,
+            //    MainBusiness = result.WordsResult["缁忚惀鑼冨洿"].Words,
+            //};
+            //return result;
+            throw new Exception();
+        }
     }
 }

--
Gitblit v1.9.1