sunpengfei
2025-08-20 b15ba0723040b5e9a348662a09af824f2d5ae9e6
feat:开发
1个文件已添加
2 文件已重命名
1 文件已复制
5个文件已修改
462 ■■■■ 已修改文件
FlexJobApi.CommonServer.Application/FlexJobApi.CommonServer.Application.xml 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
FlexJobApi.CommonServer.Application/OcrUtils/Commands/OcrCommandHandler.cs 23 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
FlexJobApi.Core/FlexJobApi.Core.xml 180 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
FlexJobApi.Core/Models/CommonServer/OcrUtils/Commands/GetIdentityFrontOcrCommand.cs 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
FlexJobApi.Core/Models/CommonServer/OcrUtils/Commands/c.cs 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
FlexJobApi.Core/Utils/BaiduUtils/BaiduOcrIdentityBackResult.cs 78 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
FlexJobApi.Core/Utils/BaiduUtils/BaiduOcrIdentityFrontResult.cs 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
FlexJobApi.Core/Utils/BaiduUtils/BaiduOcrUtils.cs 84 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
FlexJobApi.Core/Utils/DateTimeUtils/DateTimeUtils.cs 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
FlexJobApi.CommonServer.Application/FlexJobApi.CommonServer.Application.xml
@@ -216,9 +216,17 @@
            <param name="cancellationToken"></param>
            <returns></returns>
        </member>
        <member name="M:FlexJobApi.CommonServer.Application.OcrCommandHandler.Handle(FlexJobApi.Core.GetIdentityOcrCommand,System.Threading.CancellationToken)">
        <member name="M:FlexJobApi.CommonServer.Application.OcrCommandHandler.Handle(FlexJobApi.Core.GetIdentityFrontOcrCommand,System.Threading.CancellationToken)">
            <summary>
            文字识别身份证
            文字识别身份证正面
            </summary>
            <param name="request"></param>
            <param name="cancellationToken"></param>
            <returns></returns>
        </member>
        <member name="M:FlexJobApi.CommonServer.Application.OcrCommandHandler.Handle(FlexJobApi.Core.GetIdentityBackOcrCommand,System.Threading.CancellationToken)">
            <summary>
            文字识别身份证背面
            </summary>
            <param name="request"></param>
            <param name="cancellationToken"></param>
FlexJobApi.CommonServer.Application/OcrUtils/Commands/OcrCommandHandler.cs
@@ -14,7 +14,8 @@
    /// </summary>
    public class OcrCommandHandler :
        IRequestHandler<GetLicenseOcrCommand, GetLicenseOcrCommandResult>,
        IRequestHandler<GetIdentityOcrCommand, GetIdentityOcrCommandResult>
        IRequestHandler<GetIdentityFrontOcrCommand, GetIdentityFrontOcrCommandResult>,
        IRequestHandler<GetIdentityBackOcrCommand, GetIdentityBackOcrCommandResult>
    {
        /// <summary>
        /// 文字识别营业执照
@@ -29,15 +30,27 @@
        }
        /// <summary>
        /// 文字识别身份证
        /// 文字识别身份证正面
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        public async Task<GetIdentityOcrCommandResult> Handle(GetIdentityOcrCommand request, CancellationToken cancellationToken)
        public async Task<GetIdentityFrontOcrCommandResult> Handle(GetIdentityFrontOcrCommand request, CancellationToken cancellationToken)
        {
            var result = await request.Url.OcrBusinessLicense(request.Scene, request.IsOssUrl);
            return result.Adapt<GetIdentityOcrCommandResult>();
            var result = await request.Url.OcrIdentityFront(request.Scene, request.IsOssUrl);
            return result.Adapt<GetIdentityFrontOcrCommandResult>();
        }
        /// <summary>
        /// 文字识别身份证背面
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        public async Task<GetIdentityBackOcrCommandResult> Handle(GetIdentityBackOcrCommand request, CancellationToken cancellationToken)
        {
            var result = await request.Url.OcrIdentityBack(request.Scene, request.IsOssUrl);
            return result.Adapt<GetIdentityBackOcrCommandResult>();
        }
    }
}
FlexJobApi.Core/FlexJobApi.Core.xml
@@ -4463,42 +4463,82 @@
            数据库审计日志
            </summary>
        </member>
        <member name="T:FlexJobApi.Core.GetIdentityOcrCommand">
        <member name="T:FlexJobApi.Core.GetIdentityBackOcrCommand">
            <summary>
            文字识别身份证
            文字识别身份证背面
            </summary>
        </member>
        <member name="P:FlexJobApi.Core.GetIdentityOcrCommand.Access">
        <member name="P:FlexJobApi.Core.GetIdentityBackOcrCommand.Access">
            <summary>
            通道
            </summary>
        </member>
        <member name="P:FlexJobApi.Core.GetIdentityOcrCommand.Scene">
        <member name="P:FlexJobApi.Core.GetIdentityBackOcrCommand.Scene">
            <summary>
            场景
            </summary>
        </member>
        <member name="P:FlexJobApi.Core.GetIdentityOcrCommand.Url">
        <member name="P:FlexJobApi.Core.GetIdentityBackOcrCommand.Url">
            <summary>
            链接地址
            </summary>
        </member>
        <member name="P:FlexJobApi.Core.GetIdentityOcrCommand.IsOssUrl">
        <member name="P:FlexJobApi.Core.GetIdentityBackOcrCommand.IsOssUrl">
            <summary>
            是否为云存储相对地址
            </summary>
        </member>
        <member name="T:FlexJobApi.Core.GetIdentityOcrCommandResult">
        <member name="T:FlexJobApi.Core.GetIdentityBackOcrCommandResult">
            <summary>
            文字识别身份证
            </summary>
        </member>
        <member name="P:FlexJobApi.Core.GetIdentityOcrCommandResult.Url">
        <member name="P:FlexJobApi.Core.GetIdentityBackOcrCommandResult.Url">
            <summary>
            地址
            </summary>
        </member>
        <member name="P:FlexJobApi.Core.GetIdentityOcrCommandResult.Model">
        <member name="P:FlexJobApi.Core.GetIdentityBackOcrCommandResult.Model">
            <summary>
            模型
            </summary>
        </member>
        <member name="T:FlexJobApi.Core.GetIdentityFrontOcrCommand">
            <summary>
            文字识别身份证正面
            </summary>
        </member>
        <member name="P:FlexJobApi.Core.GetIdentityFrontOcrCommand.Access">
            <summary>
            通道
            </summary>
        </member>
        <member name="P:FlexJobApi.Core.GetIdentityFrontOcrCommand.Scene">
            <summary>
            场景
            </summary>
        </member>
        <member name="P:FlexJobApi.Core.GetIdentityFrontOcrCommand.Url">
            <summary>
            链接地址
            </summary>
        </member>
        <member name="P:FlexJobApi.Core.GetIdentityFrontOcrCommand.IsOssUrl">
            <summary>
            是否为云存储相对地址
            </summary>
        </member>
        <member name="T:FlexJobApi.Core.GetIdentityFrontOcrCommandResult">
            <summary>
            文字识别身份证
            </summary>
        </member>
        <member name="P:FlexJobApi.Core.GetIdentityFrontOcrCommandResult.Url">
            <summary>
            地址
            </summary>
        </member>
        <member name="P:FlexJobApi.Core.GetIdentityFrontOcrCommandResult.Model">
            <summary>
            模型
            </summary>
@@ -10947,79 +10987,135 @@
            经营范围
            </summary>
        </member>
        <member name="T:FlexJobApi.Core.BaiduOcrIdentityResult">
        <member name="T:FlexJobApi.Core.BaiduOcrIdentityBackResult">
            <summary>
            百度文字识别结果
            </summary>
        </member>
        <member name="P:FlexJobApi.Core.BaiduOcrIdentityResult.Url">
        <member name="P:FlexJobApi.Core.BaiduOcrIdentityBackResult.Url">
            <summary>
            地址
            </summary>
        </member>
        <member name="P:FlexJobApi.Core.BaiduOcrIdentityResult.Model">
        <member name="P:FlexJobApi.Core.BaiduOcrIdentityBackResult.Model">
            <summary>
            模型
            </summary>
        </member>
        <member name="P:FlexJobApi.Core.BaiduOcrIdentityResult.ErrorCode">
        <member name="P:FlexJobApi.Core.BaiduOcrIdentityBackResult.ErrorCode">
            <summary>
            错误码
            </summary>
        </member>
        <member name="P:FlexJobApi.Core.BaiduOcrIdentityResult.ErrorMessage">
        <member name="P:FlexJobApi.Core.BaiduOcrIdentityBackResult.ErrorMessage">
            <summary>
            错误消息
            </summary>
        </member>
        <member name="P:FlexJobApi.Core.BaiduOcrIdentityResult.WordsResult">
        <member name="P:FlexJobApi.Core.BaiduOcrIdentityBackResult.WordsResult">
            <summary>
            文字结果
            </summary>
        </member>
        <member name="T:FlexJobApi.Core.BaiduOcrIdentityResultModel">
        <member name="T:FlexJobApi.Core.BaiduOcrIdentityBackResultModel">
            <summary>
            百度文字识别结果
            </summary>
        </member>
        <member name="P:FlexJobApi.Core.BaiduOcrIdentityResultModel.EnterpriseName">
        <member name="P:FlexJobApi.Core.BaiduOcrIdentityBackResultModel.ExpiryDateText">
            <summary>
            企业全称
            失效日期
            </summary>
        </member>
        <member name="P:FlexJobApi.Core.BaiduOcrIdentityResultModel.SocietyCreditCode">
        <member name="P:FlexJobApi.Core.BaiduOcrIdentityBackResultModel.ExpiryDate">
            <summary>
            统一社会信用代码
            失效日期
            </summary>
        </member>
        <member name="P:FlexJobApi.Core.BaiduOcrIdentityResultModel.LegalPerson">
        <member name="P:FlexJobApi.Core.BaiduOcrIdentityBackResultModel.IssueAuthority">
            <summary>
            法人姓名
            签发机关
            </summary>
        </member>
        <member name="P:FlexJobApi.Core.BaiduOcrIdentityResultModel.EnterpriseType">
        <member name="P:FlexJobApi.Core.BaiduOcrIdentityBackResultModel.IssueDateText">
            <summary>
            企业类型
            签发日期
            </summary>
        </member>
        <member name="P:FlexJobApi.Core.BaiduOcrIdentityResultModel.RegisteredCapital">
        <member name="P:FlexJobApi.Core.BaiduOcrIdentityBackResultModel.IssueDate">
            <summary>
            注册资本
            签发日期
            </summary>
        </member>
        <member name="P:FlexJobApi.Core.BaiduOcrIdentityResultModel.EstablishmentDate">
        <member name="T:FlexJobApi.Core.BaiduOcrIdentityFrontResult">
            <summary>
            成立日期
            百度文字识别结果
            </summary>
        </member>
        <member name="P:FlexJobApi.Core.BaiduOcrIdentityResultModel.Address">
        <member name="P:FlexJobApi.Core.BaiduOcrIdentityFrontResult.Url">
            <summary>
            企业地址
            地址
            </summary>
        </member>
        <member name="P:FlexJobApi.Core.BaiduOcrIdentityResultModel.MainBusiness">
        <member name="P:FlexJobApi.Core.BaiduOcrIdentityFrontResult.Model">
            <summary>
            经营范围
            模型
            </summary>
        </member>
        <member name="P:FlexJobApi.Core.BaiduOcrIdentityFrontResult.ErrorCode">
            <summary>
            错误码
            </summary>
        </member>
        <member name="P:FlexJobApi.Core.BaiduOcrIdentityFrontResult.ErrorMessage">
            <summary>
            错误消息
            </summary>
        </member>
        <member name="P:FlexJobApi.Core.BaiduOcrIdentityFrontResult.WordsResult">
            <summary>
            文字结果
            </summary>
        </member>
        <member name="T:FlexJobApi.Core.BaiduOcrIdentityFrontResultModel">
            <summary>
            百度文字识别结果
            </summary>
        </member>
        <!-- Badly formed XML comment ignored for member "P:FlexJobApi.Core.BaiduOcrIdentityFrontResultModel.Name" -->
        <member name="P:FlexJobApi.Core.BaiduOcrIdentityFrontResultModel.Identity">
            <summary>
            身份证号
            </summary>
        </member>
        <member name="P:FlexJobApi.Core.BaiduOcrIdentityFrontResultModel.GenderText">
            <summary>
            性别
            </summary>
        </member>
        <member name="P:FlexJobApi.Core.BaiduOcrIdentityFrontResultModel.Gender">
            <summary>
            性别
            </summary>
        </member>
        <member name="P:FlexJobApi.Core.BaiduOcrIdentityFrontResultModel.BirthdayText">
            <summary>
            生日
            </summary>
        </member>
        <member name="P:FlexJobApi.Core.BaiduOcrIdentityFrontResultModel.Birthday">
            <summary>
            生日
            </summary>
        </member>
        <member name="P:FlexJobApi.Core.BaiduOcrIdentityFrontResultModel.Nation">
            <summary>
            民族
            </summary>
        </member>
        <member name="P:FlexJobApi.Core.BaiduOcrIdentityFrontResultModel.Address">
            <summary>
            住址
            </summary>
        </member>
        <member name="T:FlexJobApi.Core.BaiduOcrResultWord">
@@ -11075,9 +11171,17 @@
            <param name="scene"></param>
            <param name="isOssUrl"></param>
        </member>
        <member name="M:FlexJobApi.Core.BaiduOcrUtils.OcrIdentity(System.String,System.String,System.Boolean)">
        <member name="M:FlexJobApi.Core.BaiduOcrUtils.OcrIdentityFront(System.String,System.String,System.Boolean)">
            <summary>
            营业执照OCR
            身份证正面OCR
            </summary>
            <param name="url"></param>
            <param name="scene"></param>
            <param name="isOssUrl"></param>
        </member>
        <member name="M:FlexJobApi.Core.BaiduOcrUtils.OcrIdentityBack(System.String,System.String,System.Boolean)">
            <summary>
            身份证背面OCR
            </summary>
            <param name="url"></param>
            <param name="scene"></param>
@@ -11166,6 +11270,14 @@
            <param name="obj">对象</param>
            <returns>时间</returns>
        </member>
        <member name="M:FlexJobApi.Core.DateTimeUtils.ToDateTime(System.Object,System.String)">
            <summary>
            转时间
            </summary>
            <param name="obj">对象</param>
            <param name="format"></param>
            <returns>时间</returns>
        </member>
        <member name="M:FlexJobApi.Core.DateTimeUtils.ToDateTime``2(System.Collections.Generic.IDictionary{``0,``1},``0)">
            <summary>
            转时间
FlexJobApi.Core/Models/CommonServer/OcrUtils/Commands/GetIdentityFrontOcrCommand.cs
copy from FlexJobApi.Core/Models/CommonServer/OcrUtils/Commands/GetIdentityOcrCommand.cs copy to FlexJobApi.Core/Models/CommonServer/OcrUtils/Commands/GetIdentityFrontOcrCommand.cs
File was copied from FlexJobApi.Core/Models/CommonServer/OcrUtils/Commands/GetIdentityOcrCommand.cs
@@ -8,10 +8,10 @@
namespace FlexJobApi.Core
{
    /// <summary>
    /// 文字识别身份证
    /// 文字识别身份证正面
    /// </summary>
    [Resource([EnumResourceController.CommonServerOcrUtils], Method = EnumResourceMethod.Post)]
    public class GetIdentityOcrCommand : IRequest<GetIdentityOcrCommandResult>
    public class GetIdentityFrontOcrCommand : IRequest<GetIdentityFrontOcrCommandResult>
    {
        /// <summary>
        /// 通道
@@ -37,7 +37,7 @@
    /// <summary>
    /// 文字识别身份证
    /// </summary>
    public class GetIdentityOcrCommandResult
    public class GetIdentityFrontOcrCommandResult
    {
        /// <summary>
        /// 地址
@@ -47,6 +47,6 @@
        /// <summary>
        /// 模型
        /// </summary>
        public BaiduOcrBusinessLicenseResultModel Model { get; set; }
        public BaiduOcrIdentityFrontResultModel Model { get; set; }
    }
}
FlexJobApi.Core/Models/CommonServer/OcrUtils/Commands/c.cs
File was renamed from FlexJobApi.Core/Models/CommonServer/OcrUtils/Commands/GetIdentityOcrCommand.cs
@@ -8,10 +8,10 @@
namespace FlexJobApi.Core
{
    /// <summary>
    /// 文字识别身份证
    /// 文字识别身份证背面
    /// </summary>
    [Resource([EnumResourceController.CommonServerOcrUtils], Method = EnumResourceMethod.Post)]
    public class GetIdentityOcrCommand : IRequest<GetIdentityOcrCommandResult>
    public class GetIdentityBackOcrCommand : IRequest<GetIdentityBackOcrCommandResult>
    {
        /// <summary>
        /// 通道
@@ -37,7 +37,7 @@
    /// <summary>
    /// 文字识别身份证
    /// </summary>
    public class GetIdentityOcrCommandResult
    public class GetIdentityBackOcrCommandResult
    {
        /// <summary>
        /// 地址
@@ -47,6 +47,6 @@
        /// <summary>
        /// 模型
        /// </summary>
        public BaiduOcrBusinessLicenseResultModel Model { get; set; }
        public BaiduOcrIdentityBackResultModel Model { get; set; }
    }
}
FlexJobApi.Core/Utils/BaiduUtils/BaiduOcrIdentityBackResult.cs
New file
@@ -0,0 +1,78 @@
using Newtonsoft.Json;
using Swashbuckle.AspNetCore.Annotations;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FlexJobApi.Core
{
    /// <summary>
    /// 百度文字识别结果
    /// </summary>
    public class BaiduOcrIdentityBackResult
    {
        /// <summary>
        /// 地址
        /// </summary>
        public string Url { get; set; }
        /// <summary>
        /// 模型
        /// </summary>
        public BaiduOcrIdentityBackResultModel Model { get; set; }
        /// <summary>
        /// 错误码
        /// </summary>
        [JsonProperty("error_code")]
        public string ErrorCode { get; set; }
        /// <summary>
        /// 错误消息
        /// </summary>
        [JsonProperty("error_msg")]
        public string ErrorMessage { get; set; }
        /// <summary>
        /// 文字结果
        /// </summary>
        [JsonProperty("words_result")]
        public Dictionary<string, BaiduOcrResultWord> WordsResult { get; set; }
    }
    /// <summary>
    /// 百度文字识别结果
    /// </summary>
    public class BaiduOcrIdentityBackResultModel
    {
        /// <summary>
        /// 失效日期
        /// </summary>
        [JsonIgnore, SwaggerIgnore]
        public string ExpiryDateText { get; set; }
        /// <summary>
        /// 失效日期
        /// </summary>
        public DateTime? ExpiryDate => ExpiryDateText?.ToDateTime("yyyyMMdd");
        /// <summary>
        /// 签发机关
        /// </summary>
        public string IssueAuthority { get; set; }
        /// <summary>
        /// 签发日期
        /// </summary>
        [JsonIgnore, SwaggerIgnore]
        public string IssueDateText { get; set; }
        /// <summary>
        /// 签发日期
        /// </summary>
        public DateTime? IssueDate => IssueDateText?.ToDateTime("yyyyMMdd");
    }
}
FlexJobApi.Core/Utils/BaiduUtils/BaiduOcrIdentityFrontResult.cs
File was renamed from FlexJobApi.Core/Utils/BaiduUtils/BaiduOcrIdentityResult.cs
@@ -1,4 +1,5 @@
using Newtonsoft.Json;
using Swashbuckle.AspNetCore.Annotations;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
@@ -11,7 +12,7 @@
    /// <summary>
    /// 百度文字识别结果
    /// </summary>
    public class BaiduOcrIdentityResult
    public class BaiduOcrIdentityFrontResult
    {
        /// <summary>
        /// 地址
@@ -21,7 +22,7 @@
        /// <summary>
        /// 模型
        /// </summary>
        public BaiduOcrIdentityResultModel Model { get; set; }
        public BaiduOcrIdentityFrontResultModel Model { get; set; }
        /// <summary>
        /// 错误码
@@ -45,46 +46,55 @@
    /// <summary>
    /// 百度文字识别结果
    /// </summary>
    public class BaiduOcrIdentityResultModel
    public class BaiduOcrIdentityFrontResultModel
    {
        /// <summary>
        /// 企业全称
        /// <summary>
        /// 姓名
        /// </summary>
        public string EnterpriseName { get; set; }
        public string Name { get; set; }
        /// <summary>
        /// 统一社会信用代码
        /// 身份证号
        /// </summary>
        public string SocietyCreditCode { get; set; }
        public string Identity { get; set; }
        /// <summary>
        /// 法人姓名
        /// 性别
        /// </summary>
        public string LegalPerson { get; set; }
        [JsonIgnore, SwaggerIgnore]
        public string GenderText { get; set; }
        /// <summary>
        /// 企业类型
        /// 性别
        /// </summary>
        public string EnterpriseType { get; set; }
        public EnumUserGender? Gender =>
            GenderText == "男"
            ? EnumUserGender.Male
            : GenderText == "女"
            ? EnumUserGender.Female
            : null;
        /// <summary>
        /// 注册资本
        /// 生日
        /// </summary>
        public string RegisteredCapital { get; set; }
        [JsonIgnore, SwaggerIgnore]
        public string BirthdayText { get; set; }
        /// <summary>
        /// 成立日期
        /// 生日
        /// </summary>
        public string EstablishmentDate { get; set; }
        public DateTime? Birthday => BirthdayText?.ToDateTime("yyyyMMdd");
        /// <summary>
        /// 企业地址
        /// 民族
        /// </summary>
        public string Nation { get; set; }
        /// <summary>
        /// 住址
        /// </summary>
        public string Address { get; set; }
        /// <summary>
        /// 经营范围
        /// </summary>
        public string MainBusiness { get; set; }
    }
}
FlexJobApi.Core/Utils/BaiduUtils/BaiduOcrUtils.cs
@@ -67,12 +67,12 @@
        }
        /// <summary>
        /// 营业执照OCR
        /// 身份证正面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)
        public static async Task<BaiduOcrIdentityFrontResult> OcrIdentityFront(this string url, string scene = null, bool isOssUrl = true)
        {
            var options = App.GetOptions<BaiduOptions>();
            var ocr = new Ocr(options.Ocr.Key, options.Ocr.Secret);
@@ -82,33 +82,71 @@
            {
                var downloadUrl = AliyunOSSUtils.GetUrl(url);
                var buffer = await App.GetRequiredService<IHttpRemoteService>().GetAsByteArrayAsync(downloadUrl);
                value = ocr.Idcard(buffer, "1");
                value = ocr.Idcard(buffer, "front");
            }
            else
            {
                var upload = AliyunOSSUtils.Upload(scene, url);
                url = upload.Url;
                //value = ocr.Idcard(upload.Buffer);
                value = ocr.Idcard(upload.Buffer, "front");
            }
            //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["社会信用代码"].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();
            var result = value.ToObject<BaiduOcrIdentityFrontResult>();
            result.Url = url;
            if (result.ErrorCode.IsNotNull())
            {
                return result;
            }
            result.Model = new BaiduOcrIdentityFrontResultModel
            {
                Address = result.WordsResult["住址"].Words,
                Identity = result.WordsResult["公民身份号码"].Words,
                BirthdayText = result.WordsResult["出生"].Words,
                Name = result.WordsResult["姓名"].Words,
                GenderText = result.WordsResult["性别"].Words,
                Nation = result.WordsResult["民族"].Words,
            };
            return result;
        }
        /// <summary>
        /// 身份证背面OCR
        /// </summary>
        /// <param name="url"></param>
        /// <param name="scene"></param>
        /// <param name="isOssUrl"></param>
        public static async Task<BaiduOcrIdentityBackResult> OcrIdentityBack(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, "back");
            }
            else
            {
                var upload = AliyunOSSUtils.Upload(scene, url);
                url = upload.Url;
                value = ocr.Idcard(upload.Buffer, "back");
            }
            var result = value.ToObject<BaiduOcrIdentityBackResult>();
            result.Url = url;
            if (result.ErrorCode.IsNotNull())
            {
                return result;
            }
            result.Model = new BaiduOcrIdentityBackResultModel
            {
                ExpiryDateText = result.WordsResult["失效日期"].Words,
                IssueAuthority = result.WordsResult["签发机关"].Words,
                IssueDateText = result.WordsResult["签发日期"].Words,
            };
            return result;
        }
    }
}
FlexJobApi.Core/Utils/DateTimeUtils/DateTimeUtils.cs
@@ -1,5 +1,7 @@
using System;
using Microsoft.SqlServer.Server;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -28,6 +30,21 @@
        /// <summary>
        /// 转时间
        /// </summary>
        /// <param name="obj">对象</param>
        /// <param name="format"></param>
        /// <returns>时间</returns>
        public static DateTime? ToDateTime(this object obj, string format)
        {
            if (obj != null && DateTime.TryParseExact(obj.ToString(), format, CultureInfo.InvariantCulture, DateTimeStyles.None, out var date) && date != DateTime.MinValue && date != DateTimeOffset.MinValue)
            {
                return date;
            }
            return null;
        }
        /// <summary>
        /// 转时间
        /// </summary>
        /// <param name="dic">字典</param>
        /// <param name="key">键</param>
        /// <returns>值</returns>