username@email.com
2024-08-22 17308f6494c81fb5a5ee035724a414ec7da11936
Merge branch 'master' of http://47.108.235.38:8080/r/cylsg
16个文件已修改
2个文件已删除
6个文件已添加
1244 ■■■■■ 已修改文件
.gitignore 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cylsg/EzTencentCloud/Class1.cs 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cylsg/EzTencentCloud/ITencentCloudService.cs 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cylsg/EzTencentCloud/TencentCloudConfig.json 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cylsg/EzTencentCloud/TencentCloudService.cs 213 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cylsg/EzUpFile/Class1.cs 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cylsg/EzUpFile/EzFileUploadService.cs 531 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cylsg/EzUpFile/EzUpFile.csproj 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cylsg/EzUpFile/IEzFileUploadService.cs 67 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cylsg/EzUpFile/UpFileConfig.json 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cylsg/EzUpFile/UpFileController.cs 187 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cylsg/EzWechat/EzWechat.csproj 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cylsg/EzWechat/IWecharPayServicecs.cs 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cylsg/EzWechat/WecharPayServicecs.cs 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cylsg/EzWechat/WechatConfig.json 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cylsg/EzWechat/WechatService.cs 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cylsg/cylsg.Application/LogoInController.cs 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cylsg/cylsg.Application/System/Services/SystemService.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
cylsg/cylsg.Application/applicationsettings.json 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cylsg/cylsg.Application/cylsg.Application.csproj 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cylsg/cylsg.Authorization/cylsg.Authorization.csproj 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cylsg/cylsg.Model/UserModel/UserWorker.cs 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cylsg/cylsg.Web.Core/cylsg.Web.Core.csproj 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cylsg/cylsg.Web.Entry/appsettings.json 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.gitignore
@@ -23,3 +23,7 @@
cylsg/EzTencentCloud/bin/
cylsg/EzTencentCloud/obj/
cylsg/EzUpFile/obj/
cylsg/cylsg.services/bin/
cylsg/EzUpFile/bin/
cylsg/cylsg.Web.Entry/wwwroot/wechartKey/
cylsg/cylsg.Web.Entry/wwwroot/1669018589_20240820_cert.zip
cylsg/EzTencentCloud/Class1.cs
File was deleted
cylsg/EzTencentCloud/ITencentCloudService.cs
@@ -4,6 +4,7 @@
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TencentCloud.Iai.V20200303.Models;
using TencentCloud.Ocr.V20181119.Models;
namespace EzTencentCloud
@@ -13,10 +14,11 @@
    /// </summary>
    public interface ITencentCloudService: IScoped
    {
        #region orc 图文识别
        /// <summary>
        /// 身份证识别,并剪裁
        /// </summary>
        /// <param name="ImageBase64"></param>
        /// <param name="ImageBase64">图片base64</param>
        /// <param name="isFRONT"></param>
        /// <returns></returns>
        IDCardOCRResponse IdCord(string ImageBase64, bool isFRONT);
@@ -25,5 +27,45 @@
        /// </summary>
        /// <returns></returns>
        string GetIdCordImg();
        /// <summary>
        /// 营业执照认证
        /// </summary>
        /// <param name="ImageBase64"> 图片base64</param>
        /// <returns></returns>
        BizLicenseOCRResponse BizLicenseOCR(string ImageBase64);
        #endregion
        #region iai 人脸识别
        /// <summary>
        /// 创建人脸库,一般一个云账号只需要创建一次
        /// </summary>
        public void IaiCreatGroup();
        /// <summary>
        /// 人脸验证 一般分数超过50 分识别为一个人
        /// </summary>
        /// <param name="img64"></param>
        /// <param name="PersonNameId"></param>
        /// <returns></returns>
        public VerifyFaceResponse VerifyFace(string img64, string PersonNameId);
        /// <summary>
        /// 增加一个人的人脸图片特征,一个最多只允许有五个人脸特这
        /// </summary>
        /// <param name="img64"></param>
        /// <param name="PersonNameId"></param>
        /// <param name="PersonName"></param>
        /// <param name="PersonGender"></param>
        /// <returns></returns>
        public bool IaiAddPersoImg(string img64, string PersonNameId, string PersonName, int PersonGender);
        /// <summary>
        /// 增加一个人
        /// </summary>
        /// <param name="img64">人脸照</param>
        /// <param name="PersonNameId">人脸ID 一个云账户中唯一</param>
        /// <param name="PersonName">姓名</param>
        /// <param name="PersonGender">性别    0代表未填写,1代表男性,2代表女性。</param>
        /// <returns></returns>
        public bool IaiAddPerso(string img64, string PersonNameId, string PersonName, int  PersonGender);
        #endregion
    }
}
cylsg/EzTencentCloud/TencentCloudConfig.json
@@ -1,6 +1,12 @@
{
  "TencentCloud": {
    "SecretId":    "AKIDIPFp9CyThfMmvoQlpeCl34pKYVBahY9T",
    "SecretKey":   "4rNcaHhrkMhmb9QQ9bmgKipfFZcOt86n"
    "SecretId": "AKIDIPFp9CyThfMmvoQlpeCl34pKYVBahY9T",
    "SecretKey": "4rNcaHhrkMhmb9QQ9bmgKipfFZcOt86n"
  },
  //人脸库相关配置
  "IAIGroupSet": {
    "ID": "cylsg",
    "Name": "川印临时工"
  }
}
cylsg/EzTencentCloud/TencentCloudService.cs
@@ -12,11 +12,25 @@
using TencentCloud.Common.Profile;
using Furion.DependencyInjection;
using Furion;
using TencentCloud.Iai.V20200303;
using TencentCloud.Iai.V20200303.Models;
namespace EzTencentCloud
{
    public class TencentCloudService: ITencentCloudService, IScoped
    {
        public   TencentCloudService()
        {
        }
        #region orc 图文识别
        /// <summary>
        /// 剪裁后的身份证图片
        /// </summary>
@@ -31,13 +45,14 @@
        }
        public   IDCardOCRResponse IdCord(string ImageBase64, bool isFRONT)
        public IDCardOCRResponse IdCord(string ImageBase64, bool isFRONT)
        {
            try
            {
                Credential cred = new Credential
                {
                    SecretId = App.Configuration["TencentCloud:SecretId"] ??"AKIDIPFp9CyThfMmvoQlpeCl34pKYVBahY9T",
                    SecretId = App.Configuration["TencentCloud:SecretId"] ?? "AKIDIPFp9CyThfMmvoQlpeCl34pKYVBahY9T",
                    SecretKey = App.Configuration["TencentCloud:SecretKey"] ?? "4rNcaHhrkMhmb9QQ9bmgKipfFZcOt86n"
                };
@@ -48,7 +63,8 @@
                httpProfile.Endpoint = ("ocr.tencentcloudapi.com");
                clientProfile.HttpProfile = httpProfile;
                OcrClient client = new OcrClient(cred, "ap-beijing", clientProfile);
                var _ocrClient = new OcrClient(cred, "ap-shanghai", clientProfile);
                IDCardOCRRequest req = new IDCardOCRRequest();
                if (isFRONT)
                    req.CardSide = "FRONT";
@@ -73,7 +89,7 @@
                    Quality = true,
                });
                IDCardOCRResponse resp =  client.IDCardOCRSync(req);
                IDCardOCRResponse resp = _ocrClient.IDCardOCRSync(req);
                if (resp == null)
                    throw new Exception("图片无法识别,请重新选择身份证图片");
@@ -103,6 +119,195 @@
        }
        public BizLicenseOCRResponse BizLicenseOCR(string ImageBase64)
        {
            try
            {
                Credential cred = new Credential
                {
                    SecretId = App.Configuration["TencentCloud:SecretId"] ?? "AKIDIPFp9CyThfMmvoQlpeCl34pKYVBahY9T",
                    SecretKey = App.Configuration["TencentCloud:SecretKey"] ?? "4rNcaHhrkMhmb9QQ9bmgKipfFZcOt86n"
                };
                ClientProfile clientProfile = new ClientProfile();
                HttpProfile httpProfile = new HttpProfile();
                httpProfile.Endpoint = ("ocr.tencentcloudapi.com");
                clientProfile.HttpProfile = httpProfile;
                var _ocrClient = new OcrClient(cred, "ap-chengdu", clientProfile);
                var ret = _ocrClient.BizLicenseOCRSync(new BizLicenseOCRRequest()
                {
                     ImageBase64 = ImageBase64,
                });
                return ret;
            }
            catch (Exception)
            {
                throw;
            }
        }
        #endregion
        #region iai 人脸识别
        public void  IaiCreatGroup()
        {
            Credential cred = new Credential
            {
                SecretId = App.Configuration["TencentCloud:SecretId"] ?? "AKIDIPFp9CyThfMmvoQlpeCl34pKYVBahY9T",
                SecretKey = App.Configuration["TencentCloud:SecretKey"] ?? "4rNcaHhrkMhmb9QQ9bmgKipfFZcOt86n"
            };
            ClientProfile clientProfile = new ClientProfile();
            HttpProfile httpProfile = new HttpProfile();
            httpProfile.Endpoint = ("iai.tencentcloudapi.com");
            clientProfile.HttpProfile = httpProfile;
            var iaiClient = new IaiClient(cred, "ap-shanghai", clientProfile);
            try
            {
                var retinfo = iaiClient.GetGroupInfoSync(new GetGroupInfoRequest
                {
                    GroupId = App.Configuration["IAIGroupSet:ID"] ?? "",
                });
            }
            catch (TencentCloudSDKException e)
            {
                if (e.ErrorCode == "InvalidParameterValue.GroupIdNotExist")
                {
                    CreateGroupRequest request = new CreateGroupRequest()
                    {
                        GroupId = App.Configuration["IAIGroupSet:ID"],
                        GroupName= App.Configuration["IAIGroupSet:Name"],
                    };
                    var aia = iaiClient.CreateGroupSync(request);
                }
            }
        }
        public bool IaiAddPerso( string img64,string PersonNameId,string PersonName,  int PersonGender)
        {
            Credential cred = new Credential
            {
                SecretId = App.Configuration["TencentCloud:SecretId"] ?? "AKIDIPFp9CyThfMmvoQlpeCl34pKYVBahY9T",
                SecretKey = App.Configuration["TencentCloud:SecretKey"] ?? "4rNcaHhrkMhmb9QQ9bmgKipfFZcOt86n"
            };
            ClientProfile clientProfile = new ClientProfile();
            HttpProfile httpProfile = new HttpProfile();
            httpProfile.Endpoint = ("iai.tencentcloudapi.com");
            clientProfile.HttpProfile = httpProfile;
            var iaiClient = new IaiClient(cred, "ap-shanghai", clientProfile);
           var ret=  iaiClient.CreatePerson(new TencentCloud.Iai.V20200303.Models.CreatePersonRequest
            {
                GroupId = App.Configuration["IAIGroupSet:ID"],
                Image = img64,
                 PersonId= PersonNameId,
                PersonName= PersonName,
                Gender=PersonGender,
            });
            if(ret.IsFaulted)
            return false;
            else
            return true;
        }
        public bool IaiAddPersoImg(string img64, string PersonNameId, string PersonName, int PersonGender)
        {
            Credential cred = new Credential
            {
                SecretId = App.Configuration["TencentCloud:SecretId"] ?? "AKIDIPFp9CyThfMmvoQlpeCl34pKYVBahY9T",
                SecretKey = App.Configuration["TencentCloud:SecretKey"] ?? "4rNcaHhrkMhmb9QQ9bmgKipfFZcOt86n"
            };
            ClientProfile clientProfile = new ClientProfile();
            HttpProfile httpProfile = new HttpProfile();
            httpProfile.Endpoint = ("iai.tencentcloudapi.com");
            clientProfile.HttpProfile = httpProfile;
            var iaiClient = new IaiClient(cred, "ap-chengdu", clientProfile);
            var ret = iaiClient.CreateFace( new TencentCloud.Iai.V20200303.Models.CreateFaceRequest
            {
                PersonId = PersonNameId,
                Images = [img64],
            });
            if (ret.IsFaulted)
                return false;
            else
                return true;
        }
        public VerifyFaceResponse VerifyFace(string img64, string PersonNameId)
        {
            Credential cred = new Credential
            {
                SecretId = App.Configuration["TencentCloud:SecretId"] ?? "AKIDIPFp9CyThfMmvoQlpeCl34pKYVBahY9T",
                SecretKey = App.Configuration["TencentCloud:SecretKey"] ?? "4rNcaHhrkMhmb9QQ9bmgKipfFZcOt86n"
            };
            ClientProfile clientProfile = new ClientProfile();
            HttpProfile httpProfile = new HttpProfile();
            httpProfile.Endpoint = ("iai.tencentcloudapi.com");
            clientProfile.HttpProfile = httpProfile;
            var iaiClient = new IaiClient(cred, "ap-chengdu", clientProfile);
            var ret = iaiClient.VerifyFaceSync(new  TencentCloud.Iai.V20200303.Models.VerifyFaceRequest
            {
                PersonId = PersonNameId,
                 Image= img64
            });
            return ret;
        }
        #endregion
    }
    //返回扩展参数
cylsg/EzUpFile/Class1.cs
File was deleted
cylsg/EzUpFile/EzFileUploadService.cs
New file
@@ -0,0 +1,531 @@

using Aliyun.OSS;
using Aliyun.OSS.Util;
using cylsg.utility;
using cylsg.utility.Extend;
using EzTencentCloud;
using Furion;
using Furion.DependencyInjection;
using Furion.FriendlyException;
using Microsoft.AspNetCore.Http;
using SqlSugar;
using System;
using System.Buffers.Text;
using System.Drawing;
using System.Globalization;
using System.Security.Policy;
using TencentCloud.Ocr.V20181119.Models;
using TencentCloud.Teo.V20220901.Models;
using Task = System.Threading.Tasks.Task;
namespace EzUpFile
{
    /// <summary>
    /// 附件服务程序
    /// </summary>
    public class EzFileUploadService : IEzFileUploadService, IScoped
    {
        private readonly HttpRequest? _request;
        private readonly ISqlSugarClient _sqlSugarClient;
        private readonly ITencentCloudService _tcs;
        public EzFileUploadService(IHttpContextAccessor httpContext, ISqlSugarClient sqlSugarClient,ITencentCloudService tencentCloudService)
        {
            _request = httpContext.HttpContext?.Request ?? null;
            _sqlSugarClient = sqlSugarClient;
            _tcs= tencentCloudService;
        }
        /// <summary>
        /// 上传附件
        /// </summary>
        /// <returns></returns>
        public async Task<string> UploadFiles()
        {
            var maxSize = 1024 * 1024 * 5; //上传大小5M
            var file = _request?.Form?.Files["file"];
            if (file == null)
            {
                throw Oops.Oh("你没有选择文件");
            }
            var fileName = file.FileName;
            var fileExt = Path.GetExtension(fileName).ToLowerInvariant();
            //检查大小
            if (file.Length > maxSize)
            {
                throw Oops.Oh("文件大于设置文件");
            }
            ////检查文件扩展名
            //if (string.IsNullOrEmpty(fileExt) || Array.IndexOf(op.AttachmentSaveFileExtName?.Split(',') ?? new string[] { "" }, fileExt.Substring(1).ToLower()) == -1)
            //{
            //    throw Oops.Oh("上传文件扩展名是不允许的扩展名,请上传后缀名为:" + op.AttachmentSaveFileExtName);
            //}
            string url = string.Empty;
            url = await UpLoadFileForAliYunOSS(fileExt, file);
            return url;
        }
        /// <summary>
        /// 上传base64
        /// </summary>
        /// <param name="base64"></param>
        /// <returns></returns>
        public async Task<string> UploadFilesFByBase64(string base64)
        {
            if (string.IsNullOrEmpty(base64))
            {
                throw Oops.Oh("没有内容");
            }
            //检查上传大小
            if (!CommonHelper.CheckBase64Size(base64, 5))
            {
                throw Oops.Oh("上传文件大小超过限制,最大允许上传" + "5" + "M");
            }
            base64 = base64.Replace("data:image/png;base64,", "").Replace("data:image/jgp;base64,", "").Replace("data:image/jpg;base64,", "").Replace("data:image/jpeg;base64,", "");//将base64头部信息替换
            byte[] bytes = Convert.FromBase64String(base64);
            MemoryStream memStream = new MemoryStream(bytes);
            string url = string.Empty;
            url = await UpLoadBase64ForAliYunOSS(memStream);
            return url;
        }
        /// <summary>
        /// 删除文件
        /// </summary>
        /// <param name="Path"></param>
        /// <returns></returns>
        public async Task<bool> DelFile(string Path)
        {
            var ret = await DelFileForAliYunOSS(Path);
            return ret;
        }
        #region 阿里云上传方法(File)
        /// <summary>
        /// 阿里云上传方法(File)
        /// </summary>
        /// <param name="options"></param>
        /// <param name="fileExt"></param>
        /// <param name="file"></param>
        /// <returns></returns>
        public async Task<string> UpLoadFileForAliYunOSS(string fileExt, IFormFile file)
        {
            var newFileName = DateTime.Now.ToString("yyyyMMddHHmmss_ffff", DateTimeFormatInfo.InvariantInfo) + fileExt;
            var today = DateTime.Now.ToString("yyyyMMdd");
            //上传到阿里云
            await using var fileStream = file.OpenReadStream();
            var md5 = OssUtils.ComputeContentMd5(fileStream, file.Length);
            var filePath = App.Configuration["FileUploadOptions:SavePath"] + today + "/" + newFileName; //云文件保存路径
            //初始化阿里云配置--外网Endpoint、访问ID、访问password
            var aliYun = new OssClient(App.Configuration["FileUploadOptions:AliOSSEndpoint"], App.Configuration["FileUploadOptions:AliOSSAccessKeyID"], App.Configuration["FileUploadOptions:AliOSSAccessKeySecret"]);
            //将文件md5值赋值给meat头信息,服务器验证文件MD5
            var objectMeta = new ObjectMetadata
            {
                ContentMd5 = md5
            };
            var task = Task.Run(() =>
            //文件上传--空间名、文件保存路径、文件流、meta头信息(文件md5) //返回meta头信息(文件md5)
                aliYun.PutObject(App.Configuration["FileUploadOptions:AliOSSBucketName"], filePath, fileStream, objectMeta)
              );
            //等待完成
            try
            {
                task.Wait();
            }
            catch (AggregateException ex)
            {
                throw Oops.Oh(ex.Message);
            }
            //返回给UEditor的插入编辑器的图片的src
            return App.Configuration["FileUploadOptions:AliOSSSaveBaseUrl"] + filePath;
        }
        #endregion
        #region 阿里云上传方法(Base64)
        /// <summary>
        /// 阿里云上传方法(Base64)
        /// </summary>
        /// <param name="options"></param>
        /// <param name="memStream"></param>
        /// <returns></returns>
        public async Task<string> UpLoadBase64ForAliYunOSS(MemoryStream memStream)
        {
            var newFileName = DateTime.Now.ToString("yyyyMMddHHmmss_ffff", DateTimeFormatInfo.InvariantInfo) + ".jpg";
            var today = DateTime.Now.ToString("yyyyMMdd");
            // 设置当前流的位置为流的开始
            memStream.Seek(0, SeekOrigin.Begin);
            await using var fileStream = memStream;
            var md5 = OssUtils.ComputeContentMd5(fileStream, memStream.Length);
            var filePath = App.Configuration["FileUploadOptions:SavePath"] + today + "/" + newFileName; //云文件保存路径
                                                                                                        //初始化阿里云配置--外网Endpoint、访问ID、访问password
            var aliYun = new OssClient(App.Configuration["FileUploadOptions:AliOSSEndpoint"], App.Configuration["FileUploadOptions:AliOSSAccessKeyID"], App.Configuration["FileUploadOptions:AliOSSAccessKeySecret"]);
            //将文件md5值赋值给meat头信息,服务器验证文件MD5
            var objectMeta = new ObjectMetadata
            {
                ContentMd5 = md5
            };
            try
            {
                //文件上传--空间名、文件保存路径、文件流、meta头信息(文件md5) //返回meta头信息(文件md5)
                aliYun.PutObject(App.Configuration["FileUploadOptions:AliOSSBucketName"], filePath, fileStream, objectMeta);
            }
            catch (AggregateException ex)
            {
                throw Oops.Oh(ex.Message);
            }
            //返回给UEditor的插入编辑器的图片的src
            return App.Configuration["FileUploadOptions:AliOSSSaveBaseUrl"] + filePath;
        }
        #endregion
        #region 删除文件
        /// <summary>
        /// 阿里云删除
        /// </summary>
        /// <param name="options"></param>
        /// <param name="fileUrl">带xxx.xx的链接地址</param>
        /// <returns></returns>
        public async Task<bool> DelFileForAliYunOSS(string fileUrl)
        {
            //初始化阿里云配置--外网Endpoint、访问ID、访问password
            var aliYun = new OssClient(App.Configuration["FileUploadOptions:AliOSSEndpoint"], App.Configuration["FileUploadOptions:AliOSSAccessKeyID"], App.Configuration["FileUploadOptions:AliOSSAccessKeySecret"]);
            try
            {
                var task = Task.Run(() => aliYun.DeleteObject(App.Configuration["FileUploadOptions:AliOSSBucketName"], (App.Configuration["FileUploadOptions:SavePath"]?.RemoveStartWithStr("/") ?? "") + fileUrl.GetFileName()));
                task.Wait();
            }
            catch (Exception ex)
            {
                throw Oops.Oh(ex.Message);
            }
            //返回给UEditor的插入编辑器的图片的src
            return true;
        }
        #endregion
        #region 识别上传
        public async Task<(IDCardOCRResponse, string)> UpIdCord(string PageName = "FRONT")
        {
            try
            {
                var maxSize = 1024 * 1024 * 5; //上传大小5M
                var FileData = _request?.Form?.Files["file"];
                if (FileData.Length > maxSize)
                {
                    throw Oops.Oh(" 上传文件不可超出500K");
                }
                //处理图形
                //  var FileData = Request.Form.Files[0];
                Image oimage = Image.FromStream(FileData.OpenReadStream());
                if (oimage == null)
                {
                    throw Oops.Oh(" 上传失败");
                }
                MemoryStream ms = new MemoryStream();
                if (oimage.Width > 600)
                {
                    if (oimage.Width > oimage.Height)
                        oimage.GetThumbnailImage(600, 400, null, IntPtr.Zero).Save(ms, System.Drawing.Imaging.ImageFormat.Png);
                    else
                        oimage.GetThumbnailImage(400, 600, null, IntPtr.Zero).Save(ms, System.Drawing.Imaging.ImageFormat.Png);
                }
                else
                    oimage.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
                ms.Position = 0;
                var arr = ms.ToArray();
                string img64 = Convert.ToBase64String(arr);
                IDCardOCRResponse idcordinfo = null;
                string url = "";
                try
                {
                    idcordinfo = _tcs.IdCord(img64, PageName == "FRONT");
                    url = await UploadFilesFByBase64(_tcs.GetIdCordImg());
                    idcordinfo.AdvancedInfo = null;
                    return (idcordinfo, url);
                }
                catch (Exception e)
                {
                    throw Oops.Oh(e.Message);
                }
            }
            catch (Exception e)
            {
                throw Oops.Oh(e.Message);
            }
        }
        public async Task<(BizLicenseOCRResponse, string)> UpBizLicense()
        {
            try
            {
                var maxSize = 1024 * 1024 * 5; //上传大小5M
                var FileData = _request?.Form?.Files["file"];
                if (FileData.Length > maxSize)
                {
                    throw Oops.Oh(" 上传文件不可超出500K");
                }
                //处理图形
                //  var FileData = Request.Form.Files[0];
                Image oimage = Image.FromStream(FileData.OpenReadStream());
                if (oimage == null)
                {
                    throw Oops.Oh(" 上传失败");
                }
                MemoryStream ms = new MemoryStream();
                if (oimage.Width > 600)
                {
                    if (oimage.Width > oimage.Height)
                        oimage.GetThumbnailImage(600, 400, null, IntPtr.Zero).Save(ms, System.Drawing.Imaging.ImageFormat.Png);
                    else
                        oimage.GetThumbnailImage(400, 600, null, IntPtr.Zero).Save(ms, System.Drawing.Imaging.ImageFormat.Png);
                }
                else
                    oimage.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
                ms.Position = 0;
                var arr = ms.ToArray();
                string img64 = Convert.ToBase64String(arr);
                BizLicenseOCRResponse info = null;
                string url = "";
                try
                {
                    info = _tcs.BizLicenseOCR(img64);
                    url = await UploadFilesFByBase64(img64);
                    return (info, url);
                }
                catch (Exception e)
                {
                    throw Oops.Oh(e.Message);
                }
            }
            catch (Exception e)
            {
                throw Oops.Oh(e.Message);
            }
        }
        public async Task<(bool,string)> IaiAddPerso(string CoredID,string Name,int PersonGender)
        {
            try
            {
                var maxSize = 1024 * 1024 * 5; //上传大小5M
                var FileData = _request?.Form?.Files["file"];
                if (FileData.Length > maxSize)
                {
                    throw Oops.Oh(" 上传文件不可超出500K");
                }
                //处理图形
                //  var FileData = Request.Form.Files[0];
                Image oimage = Image.FromStream(FileData.OpenReadStream());
                if (oimage == null)
                {
                    throw Oops.Oh(" 上传失败");
                }
                MemoryStream ms = new MemoryStream();
                if (oimage.Width > 600)
                {
                    if (oimage.Width > oimage.Height)
                        oimage.GetThumbnailImage(600, 400, null, IntPtr.Zero).Save(ms, System.Drawing.Imaging.ImageFormat.Png);
                    else
                        oimage.GetThumbnailImage(400, 600, null, IntPtr.Zero).Save(ms, System.Drawing.Imaging.ImageFormat.Png);
                }
                else
                    oimage.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
                ms.Position = 0;
                var arr = ms.ToArray();
                string img64 = Convert.ToBase64String(arr);
                bool  info = false;
                string url = "";
                try
                {
                    info =  _tcs.IaiAddPerso(img64, CoredID, Name, PersonGender);
                    url = await UploadFilesFByBase64(img64);
                    return (info, url);
                }
                catch (Exception e)
                {
                    throw Oops.Oh(e.Message);
                }
            }
            catch (Exception e)
            {
                throw Oops.Oh(e.Message);
            }
        }
/// <inheritdoc/>
        public async Task<(bool, string)> IaiAddPerso(string imgBase64, string CoredID, string Name, int PersonGender)
        {
            if (string.IsNullOrEmpty(imgBase64))
            {
                throw Oops.Oh("没有内容");
            }
            //检查上传大小
            if (!CommonHelper.CheckBase64Size(imgBase64, 5))
            {
                throw Oops.Oh("上传文件大小超过限制,最大允许上传" + "5" + "M");
            }
            imgBase64 = imgBase64.Replace("data:image/png;base64,", "").Replace("data:image/jgp;base64,", "").Replace("data:image/jpg;base64,", "").Replace("data:image/jpeg;base64,", "");//将base64头部信息替换
            bool info = false;
            string url = "";
            try
            {
                info = _tcs.IaiAddPerso(imgBase64, CoredID, Name, PersonGender);
                url = await UploadFilesFByBase64(imgBase64);
                return (info, url);
            }
            catch (Exception e)
            {
                throw Oops.Oh(e.Message);
            }
        }
        #endregion
    }
}
cylsg/EzUpFile/EzUpFile.csproj
@@ -4,6 +4,23 @@
    <TargetFramework>net8.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
    <GenerateDocumentationFile>True</GenerateDocumentationFile>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Aliyun.OSS.SDK.NetCore" Version="2.14.1" />
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\cylsg.Core\cylsg.Core.csproj" />
    <ProjectReference Include="..\cylsg.utility\cylsg.utility.csproj" />
    <ProjectReference Include="..\EzTencentCloud\EzTencentCloud.csproj" />
  </ItemGroup>
  <ItemGroup>
    <None Update="UpFileConfig.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
  </ItemGroup>
</Project>
cylsg/EzUpFile/IEzFileUploadService.cs
New file
@@ -0,0 +1,67 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TencentCloud.Ocr.V20181119.Models;
namespace EzUpFile
{
    public interface IEzFileUploadService
    {
        /// <summary>
        /// 上传base64
        /// </summary>
        /// <param name="base64"></param>
        /// <returns></returns>
        Task<string> UploadFilesFByBase64(string base64);
        /// <summary>
        /// 上传文件
        /// </summary>
        /// <returns></returns>
        Task<string> UploadFiles();
        /// <summary>
        /// 删除文件
        /// </summary>
        /// <param name="Path"></param>
        /// <returns></returns>
        Task<bool> DelFile(string Path);
        /// <summary>
        /// 上传身份证
        /// </summary>
        /// <param name="Path"></param>
        /// <returns></returns>
        Task<(IDCardOCRResponse, string)> UpIdCord(string PageName = "FRONT");
        /// <summary>
        /// 上传营业执照
        /// </summary>
        /// <returns></returns>
        Task<(BizLicenseOCRResponse, string)> UpBizLicense();
        /// <summary>
        /// 创建人脸特征 文件传送
        /// </summary>
        /// <param name="CoredID"> 身份证号</param>
        /// <param name="Name">姓名</param>
        /// <param name="PersonGender"> 性别    0代表未填写,1代表男性,2代表女性。</param>
        /// <returns></returns>
        Task<(bool, string)> IaiAddPerso(string CoredID, string Name, int PersonGender);
        /// <summary>
        /// 创建人脸特征
        /// </summary>
        /// <param name="imgBase64">img base64</param>
        /// <param name="CoredID"> 身份证号</param>
        /// <param name="Name">姓名</param>
        /// <param name="PersonGender"> 性别    0代表未填写,1代表男性,2代表女性。</param>
        /// <returns></returns>
        Task<(bool, string)> IaiAddPerso(string imgBase64, string CoredID, string Name, int PersonGender);
    }
}
cylsg/EzUpFile/UpFileConfig.json
New file
@@ -0,0 +1,29 @@
{
  "FileUploadOptions": {
    "AliOSSBucketName": "appimchat",
    "SavePath": "cylsg/",
    "AliOSSEndpoint": "oss-accelerate.aliyuncs.com",
    "AliOSSAccessKeyID": "LTAI5tNYGwTd3swLhC8H2XYV",
    "AliOSSAccessKeySecret": "TyfkpYbXRUCh1K8LLtUyxY3ZcFCy1A",
    "AliOSSSaveBaseUrl": "https://appimchat.oss-cn-chengdu.aliyuncs.com/"
  },
  "[openapi:FileUpdata]": {
    "Title": "文件上传",
    "Order": 0,
    "Description": "文件上传API",
    "Version": "1.0.0",
    "TermsOfService": "",
    "Contact": {
      "Name": "文件上传川印临时工",
      "Url": "",
      "Email": "liaoXuJun@QQ.Com"
    },
    "License": {
      "Name": "MIT",
      "Url": ""
    }
  }
}
cylsg/EzUpFile/UpFileController.cs
New file
@@ -0,0 +1,187 @@
using EzTencentCloud;
using Furion.FriendlyException;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.HttpResults;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.IdentityModel.Abstractions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TencentCloud.Ocr.V20181119.Models;
namespace EzUpFile
{
    /// <summary>
    /// 文件上传下载
    /// </summary>
    [DynamicApiController]
    [ApiDescriptionSettings("FileUpdata")]
    public class UpFileController
    {
        /// <summary>
        /// 上传身份证信息
        /// </summary>
        /// <param name="PageName"> 身份证正反面 FRONT 正面  Back  国徽反面 </param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Object> UploadIdCord([FromServices] IEzFileUploadService fileUploadService,IFormFile file, [FromQuery] string PageName = "FRONT")
        {
            var ret= await fileUploadService.UpIdCord(PageName);
            return new { Info = ret.Item1, url = ret.Item2 };
        }
        /// <summary>
        /// 上传和识别营业执照
        /// </summary>
        /// <param name="PageName"> 身份证正反面 FRONT 正面  Back  国徽反面 </param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Object> UpBizLicense([FromServices] IEzFileUploadService fileUploadService, IFormFile file)
        {
            var ret= await fileUploadService.UpBizLicense();
            return new { Info = ret.Item1, url = ret.Item2 };
        }
        /// <summary>
        /// 增加人脸特征
        /// </summary>
        /// <param name="CordId">身份证号</param>
        /// <param name="Name">名称</param>
        /// <param name="Gender">0代表未填写,1代表男性,2代表女性。</param>
        /// <returns></returns>
        [HttpPost]
        public async Task<object> IaiAddPerso([FromServices] IEzFileUploadService fileUploadService, IFormFile file,[FromQuery] string CordId, [FromQuery] string Name, [FromQuery] int Gender)
        {
            var ret= await fileUploadService.IaiAddPerso(CordId, Name,Gender);
            return new { IsOK = ret.Item1, url = ret.Item2 };
        }
        /// <summary>
        /// 增加人脸库 base64
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<object> IaiAddPersoBase64([FromServices] IEzFileUploadService fileUploadService, UpDataFileData param)
        {
            if (string.IsNullOrEmpty(param.imgBase64))
                throw Oops.Oh("没有文件类容");
            if (string.IsNullOrEmpty(param.Name))
                throw Oops.Oh("没有姓名");
            if (string.IsNullOrEmpty(param.CordId))
                throw Oops.Oh("没有身份证信息");
            var ret = await fileUploadService.IaiAddPerso(param.imgBase64, param.CordId, param. Name, param.Gender??0);
            return new { IsOK = ret.Item1, url = ret.Item2 };
        }
        public async Task test([FromServices] ITencentCloudService fileUploadService)
        {
            fileUploadService.IaiCreatGroup();
        }
        /// <summary>
        /// 上传附件
        /// </summary>
        /// <param name="fileUploadService"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<string> UpdateFile([FromServices] IEzFileUploadService fileUploadService, IFormFile file)
        {
            return await fileUploadService.UploadFiles();
        }
        /// <summary>
        /// 获取到客户端的IPv4
        /// </summary>
        /// <param name="httpContextAccessor"></param>
        /// <returns></returns>
        [HttpGet]
        public string GetIp4([FromServices] IHttpContextAccessor httpContextAccessor)
        {
            var httpc = httpContextAccessor.HttpContext;
            var ipv4 = httpc.GetRemoteIpAddressToIPv4();
            return ipv4;
        }
        /// <summary>
        /// 上传附件
        /// </summary>
        /// <param name="fileUploadService"></param>
        /// <param name="Param"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<string> UpdateFileBase64([FromServices] IEzFileUploadService fileUploadService, UpDataFileData Param)
        {
            return await fileUploadService.UploadFilesFByBase64(Param.imgBase64);
        }
        [HttpPost]
        public async Task<bool> DelFile([FromServices] IEzFileUploadService fileUploadService, DelFileData Param)
        {
            return await fileUploadService.DelFile(Param.FilePath);
        }
    }
    /// <summary>
    /// 上传数据
    /// </summary>
    public class UpDataFileData
    {
        /// <summary>
        /// 数据base64
        /// </summary>
        public string imgBase64 { get; set; }
        /// <summary>
        /// 身份证号码
        /// </summary>
        public string? CordId { get; set; }
        /// <summary>
        /// 姓名
        /// </summary>
        public string? Name { get; set; }
        /// <summary>
        /// 性别
        /// </summary>
        public int? Gender { get; set; }
    }
    /// <summary>
    /// 上传数据
    /// </summary>
    public class DelFileData
    {
        /// <summary>
        /// 数据base64
        /// </summary>
        public string FilePath { get; set; }
    }
    /// <summary>
    /// 身份证返回输出
    /// </summary>
    public class IdCordOuput
    {
        /// <summary>
        /// 身份证相关信息
        /// </summary>
        public IDCardOCRResponse IdCordInfo { get; set; }
        /// <summary>
        ///  url
        /// </summary>
        public string Url {  get; set; }
    }
}
cylsg/EzWechat/EzWechat.csproj
@@ -8,6 +8,7 @@
  <ItemGroup>
    <PackageReference Include="SKIT.FlurlHttpClient.Wechat.Api" Version="3.4.0" />
    <PackageReference Include="SKIT.FlurlHttpClient.Wechat.TenpayV3" Version="3.7.0" />
  </ItemGroup>
  <ItemGroup>
cylsg/EzWechat/IWecharPayServicecs.cs
New file
@@ -0,0 +1,19 @@
using SKIT.FlurlHttpClient.Wechat.TenpayV3.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EzWechat
{
    public interface IWecharPayServicecs
    {
        /// <summary>
        /// 支付一单
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
       Task<CreateTransferBatchResponse> PayOderAsync(CreateTransferBatchRequest request);
    }
}
cylsg/EzWechat/WecharPayServicecs.cs
New file
@@ -0,0 +1,43 @@
using Furion;
using Furion.DependencyInjection;
using SKIT.FlurlHttpClient.Wechat.TenpayV3;
using SKIT.FlurlHttpClient.Wechat.TenpayV3.Models;
using SKIT.FlurlHttpClient.Wechat.TenpayV3.Settings;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static SKIT.FlurlHttpClient.Wechat.Api.Models.CgibinOpenApiRequestIdGetResponse.Types;
namespace EzWechat
{
    /// <summary>
    /// 微信支付服务
    /// </summary>
    public class WecharPayServicecs:IWecharPayServicecs, IScoped
    {
        private readonly WechatTenpayClient _V3Client;
        public WecharPayServicecs() {
            var manager = new InMemoryCertificateManager();
            var options = new WechatTenpayClientOptions()
            {
                MerchantId = App.Configuration["WechartPay:MerchantId"],
                MerchantV3Secret = App.Configuration["WechartPay:lojdhuqyt5648dikunm623ddsl2543a5"],
                MerchantCertificateSerialNumber = App.Configuration["WechartPay:MerchantCertificateSerialNumber"],
                MerchantCertificatePrivateKey = System.IO.File.ReadAllText(App.Configuration["WechartPay:apiclient_keyFile"]),
                PlatformCertificateManager = manager // 平台证书管理器的具体用法请参阅下文的基础用法与加密、验签有关的章节
            };
             _V3Client = WechatTenpayClientBuilder.Create(options).Build();
        }
        public async Task<CreateTransferBatchResponse> PayOderAsync(CreateTransferBatchRequest request)
        {
            var response = await _V3Client.ExecuteCreateTransferBatchAsync(request);
            return response;
        }
    }
}
cylsg/EzWechat/WechatConfig.json
@@ -3,5 +3,14 @@
    "AppId": "wx983556688354dd14",
    "AppSecret": "2ab1aefaac926855dc9d5f7bf7f04477"
  },
  "WechartPay": {
    "MerchantV3Secret": "lojdhuqyt5648dikunm623ddsl2543a5",
    "MerchantId": "1669018589",
    "MerchantCertificateSerialNumber": "49FFE8CB27B5EDD026BFF23C41F0DAA83405EB10",
    "apiclient_keyFile": "wwwroot\\wechartKey\\apiclient_key.pem"
  }
}
cylsg/EzWechat/WechatService.cs
@@ -13,6 +13,7 @@
using System.Text;
using System.Threading.Tasks;
namespace EzWechat
{
@@ -106,5 +107,16 @@
            return key;
        }
    }
}
cylsg/cylsg.Application/LogoInController.cs
@@ -15,6 +15,7 @@
    /// 登录
    /// </summary>
    [DynamicApiController]
    [ApiDescriptionSettings("Default@1")]
    public class LogoIn
    {
        private readonly IWechatService _wechatService;
@@ -47,7 +48,7 @@
            }
            var jwt = new EzJwtModel()
            {
                ITCode = user.ItCode,
                //ITCode = user.ItCode, 不在明文中使用Itcode
                NickName = user.Nickname,
                UserID = user.Id,
cylsg/cylsg.Application/System/Services/SystemService.cs
@@ -4,6 +4,6 @@
{
    public string GetDescription()
    {
        return "川印招聘";
        return "川印招聘服务";
    }
}
cylsg/cylsg.Application/applicationsettings.json
@@ -1,14 +1,14 @@
{
  "$schema": "https://gitee.com/dotnetchina/Furion/raw/v4/schemas/v4/furion-schema.json",
  "SpecificationDocumentSettings": {
    "DocumentTitle": "Furion | 川印零时工",
    "DocumentTitle": " 川印临时工",
    "GroupOpenApiInfos": [
      {
        "Group": "Default",
        "Title": "川印零时工",
        "Description": "川印零时工",
        "Title": "川印临时工",
        "Description": "川印临时工",
        "Version": "1.0.0",
        "Order": 10,
        "Contact": {
          "Name": "",
cylsg/cylsg.Application/cylsg.Application.csproj
@@ -28,6 +28,7 @@
        <ProjectReference Include="..\cylsg.redis\cylsg.redis.csproj" />
        <ProjectReference Include="..\cylsg.utility\cylsg.utility.csproj" />
        <ProjectReference Include="..\EzTencentCloud\EzTencentCloud.csproj" />
        <ProjectReference Include="..\EzUpFile\EzUpFile.csproj" />
        <ProjectReference Include="..\EzWechat\EzWechat.csproj" />
    </ItemGroup>
cylsg/cylsg.Authorization/cylsg.Authorization.csproj
@@ -4,6 +4,7 @@
    <TargetFramework>net8.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
    <GenerateDocumentationFile>True</GenerateDocumentationFile>
  </PropertyGroup>
  <ItemGroup>
cylsg/cylsg.Model/UserModel/UserWorker.cs
@@ -85,5 +85,32 @@
        [SugarColumn(ColumnDescription = "已提现金额", Length = 18, DecimalDigits = 2, IsNullable = true)]
        public decimal? YiTiXianJine { get; set; }
        /// <summary>
        /// 人脸ID
        /// </summary>
        [SugarColumn(ColumnDescription = "人脸ID", IsNullable = true)]
        public string? IAIPersonId { get; set; }
        /// <summary>
        /// 人脸库ID
        /// </summary>
        [SugarColumn(ColumnDescription = "人脸库ID", IsNullable = true)]
        public string? IAIGroupId { get; set; }
        /// <summary>
        /// 人脸库名称
        /// </summary>
        [SugarColumn(ColumnDescription = "人脸库名称", IsNullable = true)]
        public string? IAIGroupName { get; set; }
        /// <summary>
        /// 性别    0代表未填写,1代表男性,2代表女性。
        /// </summary>
        [SugarColumn(ColumnDescription = "人脸库名称", IsNullable = true)]
        public long? Gender { get; set; } = 0;
    }
}
cylsg/cylsg.Web.Core/cylsg.Web.Core.csproj
@@ -16,6 +16,7 @@
    <ItemGroup>
        <ProjectReference Include="..\cylsg.Application\cylsg.Application.csproj" />
        <ProjectReference Include="..\cylsg.Authorization\cylsg.Authorization.csproj" />
        <ProjectReference Include="..\EzUpFile\EzUpFile.csproj" />
    </ItemGroup>
</Project>
cylsg/cylsg.Web.Entry/appsettings.json
@@ -24,6 +24,7 @@
  ],
  "DynamicApiControllerSettings": {
    "KeepName": true,
    "KeepVerb": true,