| | |
| | | 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 |
| | |
| | | httpProfile.Endpoint = ("ocr.tencentcloudapi.com"); |
| | | clientProfile.HttpProfile = httpProfile; |
| | | |
| | | var _ocrClient = new OcrClient(cred, "ap-chengdu", clientProfile); |
| | | var _ocrClient = new OcrClient(cred, "ap-shanghai", clientProfile); |
| | | |
| | | IDCardOCRRequest req = new IDCardOCRRequest(); |
| | | if (isFRONT) |
| | |
| | | httpProfile.Endpoint = ("iai.tencentcloudapi.com"); |
| | | clientProfile.HttpProfile = httpProfile; |
| | | |
| | | var iaiClient = new IaiClient(cred, "ap-chengdu", clientProfile); |
| | | var iaiClient = new IaiClient(cred, "ap-shanghai", clientProfile); |
| | | try |
| | | { |
| | | var retinfo = iaiClient.GetGroupInfoSync(new GetGroupInfoRequest |
| | |
| | | httpProfile.Endpoint = ("iai.tencentcloudapi.com"); |
| | | clientProfile.HttpProfile = httpProfile; |
| | | |
| | | var iaiClient = new IaiClient(cred, "ap-chengdu", clientProfile); |
| | | var iaiClient = new IaiClient(cred, "ap-shanghai", clientProfile); |
| | | var ret= iaiClient.CreatePerson(new TencentCloud.Iai.V20200303.Models.CreatePersonRequest |
| | | { |
| | | GroupId = App.Configuration["IAIGroupSet:ID"], |
| | |
| | | using Microsoft.AspNetCore.Http; |
| | | |
| | | using SqlSugar; |
| | | using System; |
| | | using System.Buffers.Text; |
| | | using System.Drawing; |
| | | using System.Globalization; |
| | | using System.Security.Policy; |
| | |
| | | idcordinfo = _tcs.IdCord(img64, PageName == "FRONT"); |
| | | |
| | | url = await UploadFilesFByBase64(_tcs.GetIdCordImg()); |
| | | idcordinfo.AdvancedInfo = null; |
| | | |
| | | return (idcordinfo, url); |
| | | |
| | |
| | | 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 |
| | | } |
| | | } |
| | |
| | | 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); |
| | | |
| | | } |
| | | |
| | |
| | | using EzTencentCloud; |
| | | using Furion.FriendlyException; |
| | | using Microsoft.AspNetCore.Http; |
| | | using Microsoft.AspNetCore.Http.HttpResults; |
| | | using Microsoft.AspNetCore.Mvc; |
| | |
| | | /// <param name="PageName"> 身份证正反面 FRONT 正面 Back 国徽反面 </param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public async Task<(IDCardOCRResponse, string)> UploadIdCord([FromServices] IEzFileUploadService fileUploadService,IFormFile file, [FromQuery] string PageName = "FRONT") |
| | | public async Task<Object> UploadIdCord([FromServices] IEzFileUploadService fileUploadService,IFormFile file, [FromQuery] string PageName = "FRONT") |
| | | { |
| | | |
| | | |
| | | return await fileUploadService.UpIdCord(PageName); |
| | | |
| | | var ret= await fileUploadService.UpIdCord(PageName); |
| | | return new { Info = ret.Item1, url = ret.Item2 }; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <param name="PageName"> 身份证正反面 FRONT 正面 Back 国徽反面 </param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public async Task<(BizLicenseOCRResponse, string)> UpBizLicense([FromServices] IEzFileUploadService fileUploadService, IFormFile file) |
| | | public async Task<Object> UpBizLicense([FromServices] IEzFileUploadService fileUploadService, IFormFile file) |
| | | { |
| | | |
| | | |
| | | return await fileUploadService.UpBizLicense(); |
| | | var ret= await fileUploadService.UpBizLicense(); |
| | | return new { Info = ret.Item1, url = ret.Item2 }; |
| | | |
| | | } |
| | | /// <summary> |
| | |
| | | /// <param name="Gender">0代表未填写,1代表男性,2代表女性。</param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public async Task<(bool , string)> IaiAddPerso([FromServices] IEzFileUploadService fileUploadService, IFormFile file,[FromQuery] string CordId, [FromQuery] string Name, [FromQuery] int Gender) |
| | | public async Task<object> IaiAddPerso([FromServices] IEzFileUploadService fileUploadService, IFormFile file,[FromQuery] string CordId, [FromQuery] string Name, [FromQuery] int Gender) |
| | | { |
| | | |
| | | |
| | | return await fileUploadService.IaiAddPerso(CordId, Name,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 }; |
| | | |
| | | |
| | | } |
| | |
| | | [HttpPost] |
| | | public async Task<string> UpdateFileBase64([FromServices] IEzFileUploadService fileUploadService, UpDataFileData Param) |
| | | { |
| | | return await fileUploadService.UploadFilesFByBase64(Param.FileBase64); |
| | | return await fileUploadService.UploadFilesFByBase64(Param.imgBase64); |
| | | } |
| | | [HttpPost] |
| | | public async Task<bool> DelFile([FromServices] IEzFileUploadService fileUploadService, DelFileData Param) |
| | |
| | | /// <summary> |
| | | /// 数据base64 |
| | | /// </summary> |
| | | public string FileBase64 { get; set; } |
| | | 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 string FilePath { get; set; } |
| | | } |
| | | /// <summary> |
| | | /// 身份证返回输出 |
| | | /// </summary> |
| | | public class IdCordOuput |
| | | { |
| | | /// <summary> |
| | | /// 身份证相关信息 |
| | | /// </summary> |
| | | public IDCardOCRResponse IdCordInfo { get; set; } |
| | | |
| | | /// <summary> |
| | | /// url |
| | | /// </summary> |
| | | public string Url { get; set; } |
| | | |
| | | } |
| | | } |
| | |
| | | |
| | | <ItemGroup> |
| | | <PackageReference Include="SKIT.FlurlHttpClient.Wechat.Api" Version="3.4.0" /> |
| | | <PackageReference Include="SKIT.FlurlHttpClient.Wechat.TenpayV3" Version="3.7.0" /> |
| | | </ItemGroup> |
| | | |
| | | <ItemGroup> |
New file |
| | |
| | | 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); |
| | | } |
| | | } |
New file |
| | |
| | | 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; |
| | | |
| | | } |
| | | } |
| | | } |
| | |
| | | "AppId": "wx983556688354dd14", |
| | | "AppSecret": "2ab1aefaac926855dc9d5f7bf7f04477" |
| | | |
| | | }, |
| | | |
| | | "WechartPay": { |
| | | |
| | | "MerchantV3Secret": "lojdhuqyt5648dikunm623ddsl2543a5", |
| | | "MerchantId": "1669018589", |
| | | "MerchantCertificateSerialNumber": "49FFE8CB27B5EDD026BFF23C41F0DAA83405EB10", |
| | | "apiclient_keyFile": "wwwroot\\wechartKey\\apiclient_key.pem" |
| | | |
| | | } |
| | | } |
| | |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | |
| | | namespace EzWechat |
| | | { |
| | | |
| | |
| | | return key; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | } |