├── date ├── src ├── Yoyo.Abp.Wechat.MP │ ├── README.md │ ├── icon.png │ ├── YoyoAbpWechatMPModule.cs │ ├── Yoyo.Abp.Wechat.MP.csproj │ ├── YoyoAbpWechatMPExtensions.cs │ ├── YoyoAbpWechatMP.cs │ ├── Containers │ │ └── MpInfoContainer.cs │ └── Yoyo.Abp.Wechat.MP.xml ├── Yoyo.Abp.Wechat │ ├── README.md │ ├── icon.png │ ├── YoyoAbpWechatModule.cs │ ├── YoyoAbpWechatRegisterService.cs │ ├── Yoyo.Abp.Wechat.csproj │ ├── Yoyo.Abp.Wechat.xml │ └── YoyoAbpWechatExtensions.cs ├── Yoyo.Abp.Wechat.Open │ ├── README.md │ ├── icon.png │ ├── YoyoAbpWechatOpenModule.cs │ ├── Yoyo.Abp.Wechat.Open.csproj │ ├── Yoyo.Abp.Wechat.Open.xml │ └── YoyoAbpWechatOpenExtensions.cs ├── Yoyo.Abp.Wechat.TenPay │ ├── README.md │ ├── icon.png │ ├── YoyoAbpWechatTenPayModule.cs │ ├── V3 │ │ ├── Register.cs │ │ └── RegisterV3InfoCollection.cs │ ├── V2 │ │ ├── Register.cs │ │ └── RegisterInfoCollection.cs │ ├── Yoyo.Abp.Wechat.TenPay.csproj │ ├── YoyoAbpWechatTenPayExtensions.cs │ └── Yoyo.Abp.Wechat.TenPay.xml ├── Yoyo.Abp.Wechat.Work │ ├── README.md │ ├── icon.png │ ├── YoyoAbpWechatWorkModule.cs │ ├── Yoyo.Abp.Wechat.Work.csproj │ ├── Yoyo.Abp.Wechat.Work.xml │ └── YoyoAbpWechatWorkExtensions.cs ├── Yoyo.Abp.Wechat.WxOpen │ ├── README.md │ ├── icon.png │ ├── YoyoAbpWechatWxOpenModule.cs │ ├── YoyoAbpWechatWxOpenExtensions.cs │ ├── Yoyo.Abp.Wechat.WxOpen.xml │ └── Yoyo.Abp.Wechat.WxOpen.csproj ├── Yoyo.Abp.Alipay │ ├── icon.png │ ├── Other │ │ ├── RefundInput.cs │ │ ├── OrderCloseInput.cs │ │ ├── OrderQueryInput.cs │ │ ├── RefundQueryInput.cs │ │ └── PayRequestCheckOutput.cs │ ├── WapPay │ │ ├── WapPayOutput.cs │ │ └── WapPayInput.cs │ ├── WebPay │ │ ├── WebPayOutput.cs │ │ └── WebPayInput.cs │ ├── FTF │ │ ├── FTFConfig.cs │ │ └── FTFOutput.cs │ ├── YoyoAbpAlipayModule.cs │ ├── YoyoAbpAlipayExtension.cs │ ├── YoyoAbpAlipayConsts.cs │ ├── Yoyo.Abp.Alipay.csproj │ ├── README.md │ ├── IAlipayHelper.cs │ └── DefatultAlipayHelper.cs └── Yoyo.Abp.Aliyun.Vod │ ├── icon.png │ ├── ConfigHelper.cs │ ├── AliyunAppConsts.cs │ ├── Oss │ ├── OssFileData.cs │ └── AliyunOssManager.cs │ ├── Vod │ ├── Model │ │ └── SearchMediaInputDto.cs │ ├── Enum │ │ └── AliyunVodAppConts.cs │ └── AliyunVodManager.cs │ ├── Configuration │ ├── AliyunOssConfigInfo.cs │ ├── AliyunAccessConfigInfo.cs │ └── AliyunVodConfigInfo.cs │ ├── YoyoAbpAlipayModule.cs │ ├── Yoyo.Abp.Aliyun.Vod.csproj │ └── Sms │ └── AliyunSmsManager.cs ├── tempCodeRunnerFile.sh ├── nupkg ├── publish.ps1 ├── 无标题1.ps1 ├── 无标题2.ps1 └── pack_abp_modules.ps1 ├── ceshi.sh ├── test.sh ├── Jenkinsfile ├── LICENSE ├── README.md ├── demo.sh ├── .gitattributes ├── Yoyo.Abp.Modules.sln └── .gitignore /date: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/Yoyo.Abp.Wechat.MP/README.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/Yoyo.Abp.Wechat/README.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/Yoyo.Abp.Wechat.Open/README.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/Yoyo.Abp.Wechat.TenPay/README.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/Yoyo.Abp.Wechat.Work/README.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/Yoyo.Abp.Wechat.WxOpen/README.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tempCodeRunnerFile.sh: -------------------------------------------------------------------------------- 1 | ./build/pack.sh 2 | -------------------------------------------------------------------------------- /nupkg/publish.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/52ABP/Yoyosoft-abp-modules/HEAD/nupkg/publish.ps1 -------------------------------------------------------------------------------- /src/Yoyo.Abp.Alipay/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/52ABP/Yoyosoft-abp-modules/HEAD/src/Yoyo.Abp.Alipay/icon.png -------------------------------------------------------------------------------- /src/Yoyo.Abp.Wechat/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/52ABP/Yoyosoft-abp-modules/HEAD/src/Yoyo.Abp.Wechat/icon.png -------------------------------------------------------------------------------- /src/Yoyo.Abp.Aliyun.Vod/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/52ABP/Yoyosoft-abp-modules/HEAD/src/Yoyo.Abp.Aliyun.Vod/icon.png -------------------------------------------------------------------------------- /src/Yoyo.Abp.Wechat.MP/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/52ABP/Yoyosoft-abp-modules/HEAD/src/Yoyo.Abp.Wechat.MP/icon.png -------------------------------------------------------------------------------- /src/Yoyo.Abp.Wechat.Open/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/52ABP/Yoyosoft-abp-modules/HEAD/src/Yoyo.Abp.Wechat.Open/icon.png -------------------------------------------------------------------------------- /src/Yoyo.Abp.Wechat.Work/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/52ABP/Yoyosoft-abp-modules/HEAD/src/Yoyo.Abp.Wechat.Work/icon.png -------------------------------------------------------------------------------- /src/Yoyo.Abp.Wechat.TenPay/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/52ABP/Yoyosoft-abp-modules/HEAD/src/Yoyo.Abp.Wechat.TenPay/icon.png -------------------------------------------------------------------------------- /src/Yoyo.Abp.Wechat.WxOpen/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/52ABP/Yoyosoft-abp-modules/HEAD/src/Yoyo.Abp.Wechat.WxOpen/icon.png -------------------------------------------------------------------------------- /src/Yoyo.Abp.Aliyun.Vod/ConfigHelper.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/52ABP/Yoyosoft-abp-modules/HEAD/src/Yoyo.Abp.Aliyun.Vod/ConfigHelper.cs -------------------------------------------------------------------------------- /src/Yoyo.Abp.Aliyun.Vod/AliyunAppConsts.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/52ABP/Yoyosoft-abp-modules/HEAD/src/Yoyo.Abp.Aliyun.Vod/AliyunAppConsts.cs -------------------------------------------------------------------------------- /src/Yoyo.Abp.Aliyun.Vod/Oss/OssFileData.cs: -------------------------------------------------------------------------------- 1 | namespace Yoyo.Abp.Oss 2 | { 3 | public class OssFileData 4 | { 5 | public string Url { get; set; } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/Yoyo.Abp.Aliyun.Vod/Vod/Model/SearchMediaInputDto.cs: -------------------------------------------------------------------------------- 1 | namespace Yoyo.Abp.Vod.model 2 | { 3 | /// 4 | /// 二次封装的方法 5 | /// 6 | public class SearchMediaInputDto 7 | { 8 | 9 | } 10 | } -------------------------------------------------------------------------------- /src/Yoyo.Abp.Alipay/Other/RefundInput.cs: -------------------------------------------------------------------------------- 1 | using Alipay.AopSdk.Core.Domain; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace Yoyo.Abp.Other 7 | { 8 | public class RefundInput 9 | { 10 | public AlipayTradeRefundModel Data { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Yoyo.Abp.Alipay/Other/OrderCloseInput.cs: -------------------------------------------------------------------------------- 1 | using Alipay.AopSdk.Core.Domain; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace Yoyo.Abp.Other 7 | { 8 | public class OrderCloseInput 9 | { 10 | public AlipayTradeCloseModel Data { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Yoyo.Abp.Alipay/Other/OrderQueryInput.cs: -------------------------------------------------------------------------------- 1 | using Alipay.AopSdk.Core.Domain; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace Yoyo.Abp.Other 7 | { 8 | public class OrderQueryInput 9 | { 10 | public AlipayTradeQueryModel Data { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Yoyo.Abp.Alipay/Other/RefundQueryInput.cs: -------------------------------------------------------------------------------- 1 | using Alipay.AopSdk.Core.Domain; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace Yoyo.Abp.Other 7 | { 8 | public class RefundQueryInput 9 | { 10 | public AlipayTradeFastpayRefundQueryModel Data { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Yoyo.Abp.Wechat/YoyoAbpWechatModule.cs: -------------------------------------------------------------------------------- 1 | using Abp; 2 | using Abp.Modules; 3 | using System; 4 | 5 | namespace Yoyo.Abp 6 | { 7 | /// 8 | /// YoYo Soft Senparc.WeiXin Module 9 | /// 10 | [DependsOn(typeof(AbpKernelModule))] 11 | public class YoyoAbpWechatModule : AbpModule 12 | { 13 | 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Yoyo.Abp.Wechat.MP/YoyoAbpWechatMPModule.cs: -------------------------------------------------------------------------------- 1 | using Abp; 2 | using Abp.Modules; 3 | using System; 4 | 5 | namespace Yoyo.Abp 6 | { 7 | /// 8 | /// YoYo Soft Senparc.WeiXin.MP Module 9 | /// 10 | [DependsOn(typeof(AbpKernelModule))] 11 | public class YoyoAbpWechatMPModule : AbpModule 12 | { 13 | 14 | 15 | 16 | 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Yoyo.Abp.Alipay/WapPay/WapPayOutput.cs: -------------------------------------------------------------------------------- 1 | using Alipay.AopSdk.Core.Response; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace Yoyo.Abp.WapPay 7 | { 8 | public class WapPayOutput 9 | { 10 | public AlipayTradeWapPayResponse Response { get; set; } 11 | 12 | public string Body { get; set; } 13 | 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Yoyo.Abp.Aliyun.Vod/Configuration/AliyunOssConfigInfo.cs: -------------------------------------------------------------------------------- 1 | namespace Yoyo.Abp.Configuration 2 | { 3 | public class AliyunOssConfigInfo : AliyunAccessConfigInfo 4 | { 5 | public static string Endpoint => ConfigHelper.GetSection(AliyunAppConsts.Oss.Endpoint); 6 | 7 | public static string BucketName => ConfigHelper.GetSection(AliyunAppConsts.Oss.BucketName); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Yoyo.Abp.Wechat.Open/YoyoAbpWechatOpenModule.cs: -------------------------------------------------------------------------------- 1 | using Abp; 2 | using Abp.Modules; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | 7 | namespace Yoyo.Abp 8 | { 9 | /// 10 | /// YoYo Soft Senparc.WeiXin.Open Module 11 | /// 12 | [DependsOn(typeof(AbpKernelModule))] 13 | public class YoyoAbpWechatOpenModule : AbpModule 14 | { 15 | 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Yoyo.Abp.Wechat.Work/YoyoAbpWechatWorkModule.cs: -------------------------------------------------------------------------------- 1 | using Abp; 2 | using Abp.Modules; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | 7 | namespace Yoyo.Abp 8 | { 9 | /// 10 | /// YoYo Soft Senparc.WeiXin.Work Module 11 | /// 12 | [DependsOn(typeof(AbpKernelModule))] 13 | public class YoyoAbpWechatWorkModule : AbpModule 14 | { 15 | 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Yoyo.Abp.Wechat.WxOpen/YoyoAbpWechatWxOpenModule.cs: -------------------------------------------------------------------------------- 1 | using Abp; 2 | using Abp.Modules; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | 7 | namespace Yoyo.Abp 8 | { 9 | /// 10 | /// YoYo Soft Senparc.WeiXin.WxOpen Module 11 | /// 12 | [DependsOn(typeof(AbpKernelModule))] 13 | public class YoyoAbpWechatWxOpenModule : AbpModule 14 | { 15 | 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Yoyo.Abp.Aliyun.Vod/Configuration/AliyunAccessConfigInfo.cs: -------------------------------------------------------------------------------- 1 | namespace Yoyo.Abp.Configuration 2 | { 3 | 4 | /// 5 | /// 阿里云访问权限的信息获取 6 | /// 7 | public class AliyunAccessConfigInfo 8 | { 9 | public static string AccessKeyId => ConfigHelper.GetSection(AliyunAppConsts.AccessKeyId); 10 | 11 | public static string AccessKeySecret => ConfigHelper.GetSection(AliyunAppConsts.AccessKeySecret); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /nupkg/无标题1.ps1: -------------------------------------------------------------------------------- 1 | # Paths 2 | $packFolder = (Get-Item -Path "./" -Verbose).FullName 3 | #获取项目路径信息 4 | 5 | Write-Host "$packFolder" 6 | 7 | Write-Host "Generating Build Number" 8 | $baseDate = [datetime]"01/01/2000" 9 | 10 | Write-Host "$baseDate" 11 | 12 | $currentDate = $(Get-Date) 13 | $interval = NEW-TIMESPAN –Start $baseDate –End $currentDate 14 | Write-Host "$interval" 15 | 16 | $days = $interval.Days - 7200 17 | $minutes = $interval.Minutes 18 | $version = "3.8.$days.$minutes" 19 | Write-Host "$version" -------------------------------------------------------------------------------- /src/Yoyo.Abp.Aliyun.Vod/Configuration/AliyunVodConfigInfo.cs: -------------------------------------------------------------------------------- 1 | namespace Yoyo.Abp.Configuration 2 | { 3 | 4 | 5 | /// 6 | /// 阿里云视频点播配置信息 7 | /// 8 | public class AliyunVodConfigInfo : AliyunAccessConfigInfo 9 | { 10 | /// 11 | /// 点播服务器区域 12 | /// 13 | public static string RegionId 14 | { 15 | get { return ConfigHelper.GetSection(AliyunAppConsts.Vod.RegionId); } 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Yoyo.Abp.Alipay/Other/PayRequestCheckOutput.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Yoyo.Abp.Other 6 | { 7 | public class PayRequestCheckOutput 8 | { 9 | /// 10 | /// 请求中携带的数据 11 | /// 12 | public Dictionary SArray { get; set; } 13 | 14 | /// 15 | /// 校验结果,true表示成功,false表示失败 16 | /// 17 | public bool IsSuccess { get; set; } 18 | 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Yoyo.Abp.Wechat.TenPay/YoyoAbpWechatTenPayModule.cs: -------------------------------------------------------------------------------- 1 | using Abp; 2 | using Abp.Modules; 3 | using Senparc.Weixin; 4 | using Senparc.Weixin.TenPay.V2; 5 | using Senparc.Weixin.TenPay.V3; 6 | using System; 7 | using System.Collections.Generic; 8 | using System.Text; 9 | 10 | namespace Yoyo.Abp 11 | { 12 | /// 13 | /// YoYo Soft Senparc.WeiXin.TenPay Module 14 | /// 15 | [DependsOn(typeof(AbpKernelModule))] 16 | public class YoyoAbpWechatTenPayModule : AbpModule 17 | { 18 | 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Yoyo.Abp.Alipay/WebPay/WebPayOutput.cs: -------------------------------------------------------------------------------- 1 | using Alipay.AopSdk.Core.Response; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace Yoyo.Abp.WebPay 7 | { 8 | public class WebPayOutput 9 | { 10 | /// 11 | /// 支付的响应信息 12 | /// 13 | public AlipayTradePagePayResponse Response { get; set; } 14 | 15 | /// 16 | /// 默认创建的回调地址 17 | /// 18 | public string RedirectUrl { get; set; } 19 | 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Yoyo.Abp.Alipay/FTF/FTFConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Yoyo.Abp.FTF 6 | { 7 | /// 8 | /// 面对面支付配置 9 | /// 10 | public class FTFConfig 11 | { 12 | /// 13 | /// 二维码中间的图标全路径 14 | /// 15 | public string QRCodeIconFullPath { get; set; } 16 | 17 | /// 18 | /// 二维码生成错误读取的图片全路径 19 | /// 20 | public string QRCodeGenErrorImageFullPath { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Yoyo.Abp.Alipay/FTF/FTFOutput.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Yoyo.Abp.FTF 6 | { 7 | public class FTFOutput 8 | { 9 | /// 10 | /// 二维码图片字节数组 11 | /// 12 | public byte[] QRCodeImageBuffer { get; set; } 13 | 14 | /// 15 | /// 是否成功发起支付 16 | /// 17 | public bool IsSuccess { get; set; } 18 | 19 | /// 20 | /// 信息 21 | /// 22 | public string Message { get; set; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /ceshi.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo "你好,我的Shell练习。。。。哎。以后写脚本也要加注释啊。不然谁看得懂啊。" 3 | 4 | # 将 pack.sh 设定为只有该文件拥有者可以执行 : 5 | chmod +x ./build/pack.sh 6 | # 执行脚本 7 | ./build/pack.sh 8 | 9 | # chmod +x demo.sh 10 | # ./demo.sh 1 2 3 11 | 12 | # 执行脚本 后面传递的参数 13 | # ./test.sh 1 2 3 14 | 15 | baseDate =currentDate 16 | 17 | echo ${baseDate} 18 | 19 | # Write-Host "Generating Build Number" 20 | # $baseDate = [datetime]"01/01/2000" 21 | # $currentDate = $(Get-Date) 22 | # $interval = NEW-TIMESPAN –Start $baseDate –End $currentDate 23 | # $days = $interval.Days-7200 24 | # $minutes=$interval.Minutes 25 | # $version="3.8.$days.$minutes" 26 | # Write-Host "$version" 27 | -------------------------------------------------------------------------------- /src/Yoyo.Abp.Alipay/WebPay/WebPayInput.cs: -------------------------------------------------------------------------------- 1 | using Alipay.AopSdk.Core.Domain; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace Yoyo.Abp.WebPay 7 | { 8 | public class WebPayInput 9 | { 10 | /// 11 | /// 业务参数 12 | /// 13 | public AlipayTradePagePayModel Data { get; set; } 14 | 15 | /// 16 | /// 同步回调地址 17 | /// 18 | public string SynchronizationCallbackUrl { get; set; } 19 | 20 | /// 21 | /// 异步通知接收地址 22 | /// 23 | public string AsyncNotifyUrl { get; set; } 24 | 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Yoyo.Abp.Alipay/YoyoAbpAlipayModule.cs: -------------------------------------------------------------------------------- 1 | using Abp.Modules; 2 | using Abp.Reflection.Extensions; 3 | 4 | namespace Yoyo.Abp 5 | { 6 | public class YoYoAlipayModule : AbpModule 7 | { 8 | public YoYoAlipayModule() 9 | { 10 | 11 | } 12 | 13 | public override void Initialize() 14 | { 15 | var thisAssembly = typeof(YoYoAlipayModule).GetAssembly(); 16 | 17 | IocManager.RegisterAssemblyByConvention(thisAssembly); 18 | } 19 | 20 | public override void PostInitialize() 21 | { 22 | 23 | } 24 | 25 | public override void PreInitialize() 26 | { 27 | 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | export DOTNET_SYSTEM_NET_HTTP_USESOCKETSHTTPHANDLER=0 4 | 5 | # 编译项目 6 | echo "begin build..." 7 | 8 | # 指定通过Release 9 | dotnet build --configuration Release 10 | 11 | # 项目编译成功 12 | echo "build success" 13 | 14 | 15 | 16 | 17 | # 项目Releases 18 | 19 | echo "begin build..." 20 | echo "Nuget 上传包" 21 | 22 | echo ${env.NUGET_KEY} 23 | echo "build success" 24 | 25 | 26 | 27 | 28 | # 打包nuget 包,已经包含了 build,所以加上 --no-build 29 | # --version-suffix "ci-1234" 是增加后缀 ,如:Yoyo.Abp.Aliyun.Vod.1.0.0-ci-1234 30 | #dotnet pack --no-build --configuration Release --output nupkgs --version-suffix "" 31 | 32 | your_name="qinjx" 33 | echo $baseDate 34 | echo ${your_name} -------------------------------------------------------------------------------- /src/Yoyo.Abp.Aliyun.Vod/YoyoAbpAlipayModule.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using Abp; 3 | using Abp.Modules; 4 | using Abp.Reflection.Extensions; 5 | 6 | namespace Yoyo.Abp 7 | { 8 | /// 9 | /// YoyoSoft Abp 阿里云VOD模块 10 | /// 11 | 12 | public class YoyoAbpAliyunVodModule : AbpModule 13 | { 14 | public override void PreInitialize() 15 | { 16 | 17 | } 18 | 19 | public override void Initialize() 20 | { 21 | IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly()); 22 | 23 | } 24 | 25 | public override void PostInitialize() 26 | { 27 | 28 | } 29 | 30 | 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Yoyo.Abp.Alipay/WapPay/WapPayInput.cs: -------------------------------------------------------------------------------- 1 | using Alipay.AopSdk.Core.Domain; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace Yoyo.Abp.WapPay 7 | { 8 | public class WapPayInput 9 | { 10 | public AlipayTradeWapPayModel Data { get; set; } 11 | 12 | /// 13 | /// 支付中途退出返回商户网站地址 14 | /// 15 | public string QuitUrl { get; set; } 16 | 17 | 18 | /// 19 | /// 同步回调地址 20 | /// 21 | public string SynchronizationCallbackUrl { get; set; } 22 | 23 | /// 24 | /// 异步通知接收地址 25 | /// 26 | public string AsyncNotifyUrl { get; set; } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Jenkinsfile: -------------------------------------------------------------------------------- 1 | library 'JenkinsSharedLibraries' 2 | pipeline { 3 | agent any 4 | stages { 5 | stage('Build') { 6 | when { 7 | branch 'master' 8 | } 9 | steps { 10 | sh 'echo " Start Build...."' 11 | sh 'dotnet build' 12 | sh 'echo "Build Complete"' 13 | } 14 | } 15 | stage('Release') { 16 | when { 17 | branch "master" 18 | expression { ciRelease action: 'check' } 19 | } 20 | steps { 21 | withEnv(["nugetkey=${env.NUGET_KEY}"]) { 22 | sh "chmod +x ./build/pack.sh; ./build/pack.sh" 23 | } 24 | } 25 | } 26 | } 27 | environment { 28 | NUGET_KEY = credentials('Yoyosoft-abp-modules-nuget-key') 29 | } 30 | triggers { 31 | githubPush() 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Yoyo.Abp.Alipay/YoyoAbpAlipayExtension.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Alipay.AopSdk.AspnetCore; 3 | using Microsoft.Extensions.DependencyInjection; 4 | using Yoyo.Abp.FTF; 5 | 6 | namespace Yoyo.Abp 7 | { 8 | public static class YoYoAlipayExtension 9 | { 10 | /// 11 | /// 添加 YoYo Alipay 全局配置 12 | /// 13 | /// 14 | /// 支付配置信息创建函数 15 | /// 面对面支付基本信息创建函数 16 | /// 17 | public static IServiceCollection AddYoYoAlipay(this IServiceCollection services, 18 | Func alipayOptionsCreateFunc, 19 | Action ftfConfigCreateAction) 20 | { 21 | return services.AddAlipay(options => 22 | { 23 | options.SetOption(alipayOptionsCreateFunc.Invoke()); 24 | }) 25 | .Configure(ftfConfigCreateAction); 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /src/Yoyo.Abp.Wechat.TenPay/V3/Register.cs: -------------------------------------------------------------------------------- 1 | using Senparc.Weixin.TenPay.V3; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace Yoyo.Abp.V3 7 | { 8 | /// 9 | /// V3微信支付注册 10 | /// 11 | public class Register 12 | { 13 | /// 14 | /// 手动注册微信支付(V3) 15 | /// 16 | /// 17 | /// 18 | /// ()=>new TenPayV3Info() 19 | /// 20 | public static void RegisterTenpayV3(UserKeyType userId, TenantKeyType tenantId, Func tenPayV3Info, string name) 21 | { 22 | RegisterV3InfoCollection.Register(userId, tenantId, tenPayV3Info().MchId); 23 | TenPayV3InfoCollection.Register(tenPayV3Info(), name); 24 | } 25 | } 26 | public class Register: Register 27 | { 28 | 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Yoyo.Abp.Wechat.TenPay/V2/Register.cs: -------------------------------------------------------------------------------- 1 | using Senparc.Weixin.TenPay.V2; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace Yoyo.Abp.V2 7 | { 8 | /// 9 | /// V2微信支付注册 10 | /// 11 | public class Register 12 | { 13 | /// 14 | /// 手动注册微信支付(V2) 15 | /// 16 | /// 17 | /// 18 | /// ()=>new TenPayInfo() 19 | /// 20 | public static void RegisterTenpayOld(UserKeyType userId, TenantKeyType tenantId, Func tenPayInfo, string name) 21 | { 22 | RegisterInfoCollection.Register(userId, tenantId, tenPayInfo().PartnerId); 23 | TenPayInfoCollection.Register(tenPayInfo(), name); 24 | } 25 | } 26 | 27 | /// 28 | /// V2微信支付注册 29 | /// 30 | public class Register: Register 31 | { 32 | 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 52ABP 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/Yoyo.Abp.Wechat.WxOpen/YoyoAbpWechatWxOpenExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using Senparc.CO2NET.RegisterServices; 5 | using Senparc.Weixin.Entities; 6 | using Senparc.Weixin.WxOpen; 7 | 8 | namespace Yoyo.Abp 9 | { 10 | /// 11 | /// YoYo Soft 对 Senparc.Weixin.WxOpen 的扩展 12 | /// 13 | public static class YoyoAbpWechatWxOpenExtensions 14 | { 15 | /// 16 | /// 根据 SenparcWeixinSetting 自动注册小程序信息 17 | /// 18 | /// RegisterService 19 | /// SenparcWeixinSetting 20 | /// 统一标识,如果为null,则使用 SenparcWeixinSetting.ItemKey 21 | /// 22 | public static IRegisterService UseYoYoSenparcWxOpenAccount(this IRegisterService registerService, ISenparcWeixinSettingForWxOpen weixinSettingForWxOpen, string name = null) 23 | { 24 | return registerService.RegisterWxOpenAccount(weixinSettingForWxOpen, name); 25 | } 26 | 27 | 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Yoyo.Abp.Wechat.WxOpen/Yoyo.Abp.Wechat.WxOpen.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Yoyo.Abp.Wechat.WxOpen 5 | 6 | 7 | 8 | 9 | YoYo Soft 对 Senparc.Weixin.WxOpen 的扩展 10 | 11 | 12 | 13 | 14 | 根据 SenparcWeixinSetting 自动注册小程序信息 15 | 16 | RegisterService 17 | SenparcWeixinSetting 18 | 统一标识,如果为null,则使用 SenparcWeixinSetting.ItemKey 19 | 20 | 21 | 22 | 23 | YoYo Soft Senparc.WeiXin.WxOpen Module 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/Yoyo.Abp.Wechat/YoyoAbpWechatRegisterService.cs: -------------------------------------------------------------------------------- 1 | using Senparc.CO2NET; 2 | using Senparc.CO2NET.RegisterServices; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | 7 | namespace Yoyo.Abp 8 | { 9 | /// 10 | /// 快捷注册类,YoYoSoft 实现的 IRegisterService 11 | /// 12 | public class YoyoAbpWechatRegisterService : IRegisterService 13 | { 14 | private YoyoAbpWechatRegisterService(SenparcSetting senparcSetting) 15 | { 16 | Config.SenparcSetting = (senparcSetting ?? new SenparcSetting()); 17 | } 18 | 19 | /// 20 | /// 开始 Senparc.CO2NET SDK 初始化参数流程(.NET Core) 21 | /// 22 | /// 23 | /// asp.net core应用中IHostingEnvironment对象的ContentRootPath 24 | /// 25 | public static IRegisterService Start(SenparcSetting senparcSetting, string contentRootPath = "") 26 | { 27 | if (!string.IsNullOrWhiteSpace(contentRootPath)) 28 | { 29 | Config.RootDictionaryPath = contentRootPath; 30 | } 31 | var registerService = new YoyoAbpWechatRegisterService(senparcSetting); 32 | registerService.RegisterThreads(); 33 | return registerService; 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Yoyo-abp-modules 2 | 3 | 本仓库由52ABP团队进行维护,以下的模块都是由52ABP组织发布的Nuget包,开箱即用。 4 | 5 | 6 | 7 | 8 | [![Build Status](http://ltm.eastasia.cloudapp.azure.com/job/Yoyosoft-abp-modules/job/master/badge/icon)](http://ltm.eastasia.cloudapp.azure.com/blue/organizations/jenkins/Yoyosoft-abp-modules/activity/) 9 | 10 | 11 | 12 | ## Nuget包 13 | 14 | 15 | 16 | | Package | Status |Doc| 17 | | :--- | :--- | :--- | 18 | |Yoyo.Abp.Alipay|[![NuGet version](https://badge.fury.io/nu/Yoyo.Abp.Alipay.svg)](https://badge.fury.io/nu/Yoyo.Abp.Alipay)|[文档](src/Yoyo.Abp.Alipay/README.md)| 19 | |Yoyo.Abp.Aliyun.Vod|[![NuGet version](https://badge.fury.io/nu/Yoyo.Abp.Aliyun.Vod.svg)](https://badge.fury.io/nu/Yoyo.Abp.Aliyun.Vod)|todo| 20 | |Yoyo.Abp.Wechat|[![NuGet version](https://badge.fury.io/nu/Yoyo.Abp.Wechat.svg)](https://badge.fury.io/nu/Yoyo.Abp.Wechat)|todo| 21 | |Yoyo.Abp.Wechat.MP|[![NuGet version](https://badge.fury.io/nu/Yoyo.Abp.Wechat.MP.svg)](https://badge.fury.io/nu/Yoyo.Abp.Wechat.MP)|todo| 22 | |Yoyo.Abp.Wechat.Open|[![NuGet version](https://badge.fury.io/nu/Yoyo.Abp.Wechat.Open.svg)](https://badge.fury.io/nu/Yoyo.Abp.Wechat.Open)|todo| 23 | |Yoyo.Abp.Wechat.TenPay|[![NuGet version](https://badge.fury.io/nu/Yoyo.Abp.Wechat.TenPay.svg)](https://badge.fury.io/nu/Yoyo.Abp.Wechat.TenPay)|todo| 24 | |Yoyo.Abp.Wechat.Work|[![NuGet version](https://badge.fury.io/nu/Yoyo.Abp.Wechat.Work.svg)](https://badge.fury.io/nu/Yoyo.Abp.Wechat.Work)|todo| 25 | |Yoyo.Abp.Wechat.WxOpen|[![NuGet version](https://badge.fury.io/nu/Yoyo.Abp.Wechat.WxOpen.svg)](https://badge.fury.io/nu/Yoyo.Abp.Wechat.WxOpen)|todo| 26 | 27 | |todo|todo|todo| 28 | -------------------------------------------------------------------------------- /src/Yoyo.Abp.Alipay/YoyoAbpAlipayConsts.cs: -------------------------------------------------------------------------------- 1 | namespace Yoyo.Abp 2 | { 3 | /// 4 | /// 常量 5 | /// 6 | public class YoYoAlipayConsts 7 | { 8 | /// 9 | /// 销售产品码 PC支付 FAST_INSTANT_TRADE_PAY 10 | /// 11 | public const string ProductCode_FAST_INSTANT_TRADE_PAY = "FAST_INSTANT_TRADE_PAY"; 12 | 13 | /// 14 | /// 销售产品码 H5/WAP支付 QUICK_WAP_WAY 15 | /// 16 | public const string ProductCode_QUICK_WAP_WAY = "QUICK_WAP_WAY"; 17 | 18 | /// 19 | /// 支付宝交易号 20 | /// 21 | public const string trade_no = "trade_no"; 22 | 23 | /// 24 | /// 开发者的app_id 25 | /// 26 | public const string app_id = "app_id"; 27 | 28 | /// 29 | /// 卖家支付宝用户号 30 | /// 31 | public const string seller_id = "seller_id"; 32 | 33 | /// 34 | /// 商户订单号 35 | /// 36 | public const string out_trade_no = "out_trade_no"; 37 | 38 | /// 39 | /// 实收金额 40 | /// 41 | public const string receipt_amount = "receipt_amount"; 42 | 43 | /// 44 | /// 交易状态 45 | /// 46 | public const string trade_status = "trade_status"; 47 | 48 | /// 49 | /// (同步)该笔订单的资金总额,单位为RMB-Yuan。取值范围为[0.01,100000000.00],精确到小数点后两位。 50 | /// 51 | public const string total_amount = "total_amount"; 52 | } 53 | } -------------------------------------------------------------------------------- /src/Yoyo.Abp.Alipay/Yoyo.Abp.Alipay.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp3.1false 5 | Yoyo.Abp 6 | 7 | 8 | 52ABP框架微信公众号的库 9 | Copyright © 52ABP.com All Rights Reserved 10 | 11 | icon.png 12 | 13 | 14 | 梁桐铭 15 | YoyoSoft 16 | 52ABP-PRO 17 | https://github.com/52ABP/Yoyosoft-abp-modules/blob/dev/LICENSE 18 | https://www.52abp.com/ 19 | https://github.com/52ABP/Yoyosoft-abp-modules 20 | MIT 21 | true 22 | false 23 | snupkg 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | Off 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /src/Yoyo.Abp.Wechat.Work/Yoyo.Abp.Wechat.Work.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp3.1false 5 | Yoyo.Abp 6 | 7 | 8 | 52ABP框架微信公众号的库 9 | Copyright © 52ABP.com All Rights Reserved 10 | 11 | icon.png 12 | 13 | 14 | 梁桐铭 15 | YoyoSoft 16 | 52ABP-PRO 17 | https://github.com/52ABP/Yoyosoft-abp-modules/blob/dev/LICENSE 18 | https://www.52abp.com/ 19 | https://github.com/52ABP/Yoyosoft-abp-modules 20 | MIT 21 | true 22 | false 23 | snupkg 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | D:\develops\52abp\Yoyo.Abp.Modules\src\Yoyo.Abp.Wechat.Work\Yoyo.Abp.Wechat.Work.xml 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /src/Yoyo.Abp.Wechat.WxOpen/Yoyo.Abp.Wechat.WxOpen.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp3.1false 5 | Yoyo.Abp 6 | 7 | 8 | 9 | 52ABP框架微信公众号的库 10 | Copyright © 52ABP.com All Rights Reserved 11 | 12 | icon.png 13 | 14 | 15 | 梁桐铭 16 | YoyoSoft 17 | 52ABP-PRO 18 | https://github.com/52ABP/Yoyosoft-abp-modules/blob/dev/LICENSE 19 | https://www.52abp.com/ 20 | https://github.com/52ABP/Yoyosoft-abp-modules 21 | MIT 22 | true 23 | false 24 | snupkg 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | D:\develops\52abp\Yoyo.Abp.Modules\src\Yoyo.Abp.Wechat.WxOpen\Yoyo.Abp.Wechat.WxOpen.xml 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /nupkg/无标题2.ps1: -------------------------------------------------------------------------------- 1 | # Paths 2 | $packFolder = (Get-Item -Path "./" -Verbose).FullName 3 | #获取项目路径信息 4 | 5 | 6 | Write-Host "$packFolder" 7 | 8 | Write-Host "Generating Build Number" 9 | $baseDate = [datetime]"01/01/2000" 10 | $currentDate = $(Get-Date) 11 | $interval = NEW-TIMESPAN –Start $baseDate –End $currentDate 12 | $days = $interval.Days-7200 13 | $minutes=$interval.Minutes 14 | $version="3.8.$days.$minutes" 15 | Write-Host "$version" 16 | 17 | 18 | $slnPath = Join-Path $packFolder "../" 19 | $srcPath = Join-Path $slnPath "src" 20 | 21 | Write-Host "$slnPath" 22 | 23 | Write-Host "$srcPath" 24 | 25 | # List of projects 26 | $projects = ( 27 | "Yoyo.Abp.Alipay", 28 | "Yoyo.Abp.Aliyun.Vod", 29 | "Yoyo.Abp.Wechat", 30 | "Yoyo.Abp.Wechat.MP", 31 | "Yoyo.Abp.Wechat.Open", 32 | "Yoyo.Abp.Wechat.TenPay", 33 | "Yoyo.Abp.Wechat.Work", 34 | "Yoyo.Abp.Wechat.WxOpen" 35 | ) 36 | 37 | # Rebuild solution 38 | Set-Location $slnPath 39 | & dotnet restore 40 | & dotnet build 41 | 42 | 43 | # Copy all nuget packages to the pack folder 44 | foreach ($project in $projects) { 45 | 46 | $projectFolder = Join-Path $srcPath $project 47 | 48 | # Create nuget pack 49 | Set-Location $projectFolder 50 | Remove-Item -Recurse (Join-Path $projectFolder "bin/Release") 51 | & dotnet msbuild /p:Configuration=Release /p:SourceLinkCreate=true 52 | & dotnet msbuild /t:pack /p:Configuration=Release /p:SourceLinkCreate=true /P:Version=$version 53 | 54 | # Copy nuget package 55 | $projectPackPath = Join-Path $projectFolder ("/bin/Release/" + $project + ".*.nupkg") 56 | Move-Item $projectPackPath $packFolder 57 | 58 | } 59 | 60 | # Go back to the pack folder 61 | Set-Location $packFolder -------------------------------------------------------------------------------- /src/Yoyo.Abp.Wechat.TenPay/Yoyo.Abp.Wechat.TenPay.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp3.1false 5 | Yoyo.Abp 6 | 7 | 8 | 52ABP框架微信公众号的库 9 | Copyright © 52ABP.com All Rights Reserved 10 | 11 | icon.png 12 | 13 | 14 | 梁桐铭 15 | YoyoSoft 16 | 52ABP-PRO 17 | https://github.com/52ABP/Yoyosoft-abp-modules/blob/dev/LICENSE 18 | https://www.52abp.com/ 19 | https://github.com/52ABP/Yoyosoft-abp-modules 20 | MIT 21 | true 22 | false 23 | snupkg 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | Off 32 | D:\develops\52abp\Yoyo.Abp.Modules\src\Yoyo.Abp.Wechat.TenPay\Yoyo.Abp.Wechat.TenPay.xml 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /nupkg/pack_abp_modules.ps1: -------------------------------------------------------------------------------- 1 | # Paths 2 | $packFolder = (Get-Item -Path "./" -Verbose).FullName 3 | #获取项目路径信息 4 | 5 | 6 | Write-Host "$packFolder" 7 | 8 | Write-Host "Generating Build Number" 9 | $baseDate = [datetime]"01/01/2000" 10 | $currentDate = $(Get-Date) 11 | $interval = NEW-TIMESPAN –Start $baseDate –End $currentDate 12 | Write-Host "$interval" 13 | 14 | $days = $interval.Days - 7200 15 | $minutes = $interval.Minutes 16 | $version = "3.8.$days.$minutes" 17 | Write-Host "$version" 18 | 19 | 20 | $slnPath = Join-Path $packFolder "../" 21 | $srcPath = Join-Path $slnPath "src" 22 | 23 | Write-Host "$slnPath" 24 | 25 | Write-Host "$srcPath" 26 | 27 | # List of projects 28 | $projects = ( 29 | "Yoyo.Abp.Alipay", 30 | "Yoyo.Abp.Aliyun.Vod", 31 | "Yoyo.Abp.Wechat", 32 | "Yoyo.Abp.Wechat.MP", 33 | "Yoyo.Abp.Wechat.Open", 34 | "Yoyo.Abp.Wechat.TenPay", 35 | "Yoyo.Abp.Wechat.Work", 36 | "Yoyo.Abp.Wechat.WxOpen" 37 | ) 38 | 39 | # Rebuild solution 40 | Set-Location $slnPath 41 | & dotnet restore 42 | & dotnet build 43 | 44 | 45 | # Copy all nuget packages to the pack folder 46 | foreach ($project in $projects) { 47 | 48 | $projectFolder = Join-Path $srcPath $project 49 | 50 | # Create nuget pack 51 | Set-Location $projectFolder 52 | Remove-Item -Recurse (Join-Path $projectFolder "bin/Release") 53 | & dotnet msbuild /p:Configuration=Release /p:SourceLinkCreate=true 54 | & dotnet msbuild /t:pack /p:Configuration=Release /p:SourceLinkCreate=true /P:Version=$version 55 | 56 | # Copy nuget package 57 | $projectPackPath = Join-Path $projectFolder ("/bin/Release/" + $project + ".*.nupkg") 58 | Move-Item $projectPackPath $packFolder 59 | 60 | } 61 | 62 | # Go back to the pack folder 63 | Set-Location $packFolder -------------------------------------------------------------------------------- /src/Yoyo.Abp.Wechat.Work/Yoyo.Abp.Wechat.Work.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Yoyo.Abp.Wechat.Work 5 | 6 | 7 | 8 | 9 | YoYo Soft 对 Senparc.Weixin.Work 的扩展 10 | 11 | 12 | 13 | 14 | 注册公众号(或小程序)信息 15 | 16 | RegisterService 17 | weixinCorpId 18 | weixinCorpSecret 19 | 标记AccessToken名称(如微信公众号名称),帮助管理员识别 20 | 21 | 22 | 23 | 24 | 根据 SenparcWeixinSetting 自动注册第三方平台信息 25 | 26 | RegisterService 27 | SenparcWeixinSetting 28 | 统一标识,如果为null,则使用 SenparcWeixinSetting.ItemKey 29 | 30 | 31 | 32 | 33 | YoYo Soft Senparc.WeiXin.Work Module 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /src/Yoyo.Abp.Wechat.Open/Yoyo.Abp.Wechat.Open.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp3.1false 5 | Yoyo.Abp 6 | 7 | 8 | 52ABP框架微信公众号的库 9 | Copyright © 52ABP.com All Rights Reserved 10 | 11 | icon.png 12 | 13 | 14 | 梁桐铭 15 | YoyoSoft 16 | 52ABP-PRO 17 | https://github.com/52ABP/Yoyosoft-abp-modules/blob/dev/LICENSE 18 | https://www.52abp.com/ 19 | https://github.com/52ABP/Yoyosoft-abp-modules 20 | MIT 21 | true 22 | false 23 | snupkg 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | D:\develops\52abp\Yoyo.Abp.Modules\src\Yoyo.Abp.Wechat.Open\Yoyo.Abp.Wechat.Open.xml 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | PreserveNewest 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /src/Yoyo.Abp.Wechat.Work/YoyoAbpWechatWorkExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using Senparc.CO2NET.RegisterServices; 5 | using Senparc.Weixin.Work.Containers; 6 | using Senparc.Weixin.Work; 7 | 8 | namespace Yoyo.Abp 9 | { 10 | /// 11 | /// YoYo Soft 对 Senparc.Weixin.Work 的扩展 12 | /// 13 | public static class YoyoAbpWechatWorkExtensions 14 | { 15 | /// 16 | /// 注册公众号(或小程序)信息 17 | /// 18 | /// RegisterService 19 | /// weixinCorpId 20 | /// weixinCorpSecret 21 | /// 标记AccessToken名称(如微信公众号名称),帮助管理员识别 22 | /// 23 | public static IRegisterService UseYoYoSenparcWorkAccount(this IRegisterService registerService, string weixinCorpId, string weixinCorpSecret, string name = null) 24 | { 25 | return registerService.RegisterWorkAccount(weixinCorpId, weixinCorpSecret, name); 26 | } 27 | 28 | /// 29 | /// 根据 SenparcWeixinSetting 自动注册第三方平台信息 30 | /// 31 | /// RegisterService 32 | /// SenparcWeixinSetting 33 | /// 统一标识,如果为null,则使用 SenparcWeixinSetting.ItemKey 34 | /// 35 | public static IRegisterService UseYoYoSenparcWorkAccount(this IRegisterService registerService, Senparc.Weixin.Entities.ISenparcWeixinSettingForWork weixinSettingForWork, 36 | string name = null) 37 | { 38 | return registerService.RegisterWorkAccount(weixinSettingForWork, name); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/Yoyo.Abp.Wechat.MP/Yoyo.Abp.Wechat.MP.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp3.1false 5 | Yoyo.Abp 6 | 7 | 8 | 52ABP框架微信公众号的库 9 | Copyright © 52ABP.com All Rights Reserved 10 | 11 | icon.png 12 | 13 | 14 | 梁桐铭 15 | YoyoSoft 16 | 52ABP-PRO 17 | https://github.com/52ABP/Yoyosoft-abp-modules/blob/dev/LICENSE 18 | https://www.52abp.com/ 19 | https://github.com/52ABP/Yoyosoft-abp-modules 20 | MIT 21 | true 22 | false 23 | snupkg 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | D:\develops\52abp\Yoyo.Abp.Modules\src\Yoyo.Abp.Wechat.MP\Yoyo.Abp.Wechat.MP.xml 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | PreserveNewest 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /src/Yoyo.Abp.Wechat.TenPay/V3/RegisterV3InfoCollection.cs: -------------------------------------------------------------------------------- 1 | using Senparc.Weixin.Exceptions; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace Yoyo.Abp.V3 7 | { 8 | /// 9 | /// 用户注册微信支付(V3)InfoCollection 10 | /// 11 | /// 用户主键类型 12 | /// 租户主键类型 13 | public class RegisterV3InfoCollection : Dictionary 14 | { 15 | public static RegisterV3InfoCollection Data = new RegisterV3InfoCollection(); 16 | 17 | /// 18 | /// 注册 19 | /// 20 | /// 21 | /// 22 | /// 商户Id 23 | public static void Register(UserKeyType userId, TenantKeyType tenantId, string MchId) 24 | { 25 | var key = $"{userId.ToString()}-{tenantId.ToString()}"; 26 | Data[key] = MchId; 27 | } 28 | 29 | public new string this[string key] 30 | { 31 | get 32 | { 33 | if (!base.ContainsKey(key)) 34 | { 35 | throw new WeixinException(string.Format("该用户 {0} 尚未注册Partner", key)); 36 | } 37 | else 38 | { 39 | return base[key]; 40 | } 41 | } 42 | set 43 | { 44 | base[key] = value; 45 | } 46 | } 47 | 48 | public RegisterV3InfoCollection() 49 | : base(StringComparer.OrdinalIgnoreCase) 50 | { 51 | } 52 | } 53 | 54 | /// 55 | /// 用户注册微信支付(V3)InfoCollection 56 | /// 57 | public class RegisterV3InfoCollection: RegisterV3InfoCollection 58 | { 59 | 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/Yoyo.Abp.Wechat.TenPay/V2/RegisterInfoCollection.cs: -------------------------------------------------------------------------------- 1 | using Senparc.Weixin.Exceptions; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace Yoyo.Abp.V2 7 | { 8 | /// 9 | /// 用户注册微信支付(V2)InfoCollection 10 | /// 11 | /// 用户主键类型 12 | /// 租户主键类型 13 | public class RegisterInfoCollection : Dictionary 14 | { 15 | public static RegisterInfoCollection Data = new RegisterInfoCollection(); 16 | 17 | /// 18 | /// 注册 19 | /// 20 | /// 21 | /// 22 | /// 商户Id 23 | public static void Register(UserKeyType userId, TenantKeyType tenantId, string PartnerId) 24 | { 25 | var key = $"{userId.ToString()}-{tenantId.ToString()}"; 26 | Data[key] = PartnerId; 27 | } 28 | 29 | public new string this[string key] 30 | { 31 | get 32 | { 33 | if (!base.ContainsKey(key)) 34 | { 35 | throw new WeixinException(string.Format("该用户 {0} 尚未注册Partner", key)); 36 | } 37 | else 38 | { 39 | return base[key]; 40 | } 41 | } 42 | set 43 | { 44 | base[key] = value; 45 | } 46 | } 47 | 48 | public RegisterInfoCollection() 49 | : base(StringComparer.OrdinalIgnoreCase) 50 | { 51 | } 52 | } 53 | 54 | /// 55 | /// 用户注册微信支付(V2)InfoCollection 56 | /// 57 | public class RegisterInfoCollection: RegisterInfoCollection 58 | { 59 | 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/Yoyo.Abp.Aliyun.Vod/Yoyo.Abp.Aliyun.Vod.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp3.1 5 | false 6 | Yoyo.Abp 7 | 8 | 9 | 52ABP框架微信公众号的库 10 | Copyright © 52ABP.com All Rights Reserved 11 | 12 | icon.png 13 | 14 | 15 | 梁桐铭 16 | YoyoSoft 17 | 52ABP-PRO 18 | https://github.com/52ABP/Yoyosoft-abp-modules/blob/dev/LICENSE 19 | https://www.52abp.com/ 20 | https://github.com/52ABP/Yoyosoft-abp-modules 21 | MIT 22 | true 23 | false 24 | snupkg 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /demo.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo${env.JOB_NAME} 4 | 5 | 6 | 7 | stage('echoenv'){ 8 | steps{ 9 | echo "env.JOBNAME===>${env.JOB_NAME}" 10 | echo "env.J0B_BASENAME二s>${env.JOB_BASENAME}" 11 | echo "env.BUILDTAG===>${env.BUILDTAG}" 12 | echo "env.WORKSPACE==>${env.WORKSPACE}" 13 | echo "env.BUILDNUMBER=>${env.BUILDNUMBER}" 14 | echo "env.BUILDID==>${env.BUILDID}" 15 | echo "env.BUILDDISPLAYNAME==>${env.BUILDDISPLAYNAME}" 16 | echo "env.NODENAME二:=>${env.NODE_NAME}" 17 | echo "env.NODE_LABELS===>${env.NODELABELS}" 18 | echo "env.JENKINSHOME>${env.JENKINSHOME}" 19 | echo "env.JENKINSURL===>${env.JENKINS_URL}" 20 | echo "env.BUILDURL=>${env.BUILDURL}" 21 | echo "env.JOB_URL>${env.JOB_URL}" 22 | }} 23 | 24 | 25 | #start_time="2015-03-16" 26 | #time1=$(($(date+%s-d"now")-$(date+%s-d"${start_time}"))) 27 | ##echo$time1#间隔的秒 28 | #echo "间隔的天数" 29 | #days=$((${time1}/(3600*24)-1600))#间隔的天数 30 | #echo$(((${time1}/(3600*24)+1)/365))#间隔的年数 31 | #echo$(((${time1}/(3600*24)+1)/365*12))#间隔的月数 32 | 33 | #echo "++++++++++++++++++++++++++++++++++++++++" 34 | 35 | #dateNow=$(date-d'now') 36 | #echo "系统当前时间:"${dateNow}""#系统当前时间 37 | 38 | #minutes=$(date+%H-d"now") 39 | 40 | #echo$minutes 41 | 42 | #echo "++++++++++++++++++++++++++++++++++++++++" 43 | 44 | #version="3.8.$days.$minutes" 45 | 46 | #starttime=$(date+'%Y-%m-%d%H:%M:%S') 47 | 48 | #echo${version} 49 | 50 | #nowtime=$(date+%Y%m%d) 51 | #echo$nowtime 52 | 53 | #echo$start2015 54 | 55 | #echo$((nowtime-start2015)) 56 | 57 | #执行程序 58 | #endtime=$(date+'%Y-%m-%d%H:%M:%S') 59 | #echo${endtime} 60 | 61 | #start_seconds=$(date--date="$starttime"+%s) 62 | 63 | #echo${start_seconds} 64 | 65 | #end_seconds=$(date--date="$endtime"+%s) 66 | #echo${end_seconds} 67 | 68 | #echo "本次运行时间:"$((end_seconds-start_seconds))"s" 69 | 70 | #echo${baseDate} 71 | 72 | #Write-Host"GeneratingBuildNumber" 73 | #$baseDate=[datetime]"01/01/2000" 74 | #$currentDate=$(Get-Date) 75 | #$interval=NEW-TIMESPAN–Start$baseDate–End$currentDate 76 | #$days=$interval.Days-7200 77 | #$minutes=$interval.Minutes 78 | #$version="3.8.$days.$minutes" 79 | #Write-Host"$version" 80 | -------------------------------------------------------------------------------- /src/Yoyo.Abp.Wechat/Yoyo.Abp.Wechat.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp3.1false 5 | Yoyo.Abp 6 | 7 | 8 | 52ABP框架微信公众号的库 9 | Copyright © 52ABP.com All Rights Reserved 10 | 11 | icon.png 12 | 13 | 14 | 梁桐铭 15 | YoyoSoft 16 | 52ABP-PRO 17 | https://github.com/52ABP/Yoyosoft-abp-modules/blob/dev/LICENSE 18 | https://www.52abp.com/ 19 | https://github.com/52ABP/Yoyosoft-abp-modules 20 | MIT 21 | true 22 | false 23 | snupkg 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | Off 33 | D:\develops\52abp\Yoyo.Abp.Modules\src\Yoyo.Abp.Wechat\Yoyo.Abp.Wechat.xml 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | Always 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /src/Yoyo.Abp.Aliyun.Vod/Oss/AliyunOssManager.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using Abp.Domain.Services; 4 | using Abp.UI; 5 | using Aliyun.OSS; 6 | using Yoyo.Abp.Configuration; 7 | 8 | namespace Yoyo.Abp.Oss 9 | { 10 | /// 11 | /// 阿里云OSS的服务类 12 | /// 13 | public class AliyunOssManager:DomainService 14 | { 15 | private static readonly OssClient Client = new OssClient(AliyunOssConfigInfo.Endpoint, AliyunOssConfigInfo.AccessKeyId, AliyunOssConfigInfo.AccessKeySecret); 16 | 17 | 18 | public OssFileData UpLoad(string key, string fileToUpload) 19 | { 20 | var fileExtensionName = Path.GetExtension(fileToUpload);//文件扩展名 21 | var filePath = $"{key}{fileExtensionName}";//云文件保存路径 22 | try 23 | { 24 | Client.PutObject(AliyunOssConfigInfo.BucketName, filePath, fileToUpload); 25 | var fielData = new OssFileData 26 | { 27 | Url = AliyunOssConfigInfo.BucketName + "." + AliyunOssConfigInfo.Endpoint + "/" + filePath 28 | }; 29 | return fielData; 30 | } 31 | catch (Exception e) 32 | { 33 | throw new UserFriendlyException($"文件上传失败:{e.Message}"); 34 | } 35 | } 36 | 37 | /// 38 | /// 39 | /// 40 | /// <param name="fileName">文件名称,包含后缀名称</param> 41 | /// 42 | /// 43 | /// 44 | public static OssFileData UpLoad(string fileName, Stream fileToUpload) 45 | { 46 | try 47 | { 48 | Client.PutObject(AliyunOssConfigInfo.BucketName, fileName, fileToUpload); 49 | var fielData = new OssFileData 50 | { 51 | Url = AliyunOssConfigInfo.BucketName + "." + AliyunOssConfigInfo.Endpoint + "/" + fileName 52 | }; 53 | return fielData; 54 | } 55 | catch (Exception e) 56 | { 57 | throw new UserFriendlyException($"文件上传失败:{e.Message}"); 58 | } 59 | } 60 | 61 | } 62 | } -------------------------------------------------------------------------------- /src/Yoyo.Abp.Alipay/README.md: -------------------------------------------------------------------------------- 1 | # Yoyo.Abp.Alipay 2 | 3 | ## 安装 4 | **Package Manager** 5 | ``` 6 | Install-Package Yoyo.Abp.Alipay 7 | ``` 8 | **.NET CLI** 9 | ``` 10 | dotnet add package Yoyo.Abp.Alipay 11 | ``` 12 | **Paket CLI** 13 | ``` 14 | paket add Yoyo.Abp.Alipay 15 | ``` 16 | 17 | ## 如何配置 18 | 19 | 20 | **appsetting.json添加 Pay:Alipay 配置项** 21 | 22 | *注意,填写你的支付宝配置参数* 23 | 24 | ``` json 25 | { 26 | // .... other configurations 27 | "Pay": { 28 | "Alipay": { 29 | "AlipayPublicKey": "公钥", 30 | "AppId": "AppId", 31 | "CharSet": "UTF-8", 32 | "Gatewayurl": "https://openapi.alipay.com/gateway.do", 33 | "PrivateKey": "私钥", 34 | "SignType": "RSA2", 35 | "Uid": "Uid" 36 | } 37 | } 38 | // .... other configurations 39 | } 40 | ``` 41 | 42 | 43 | 44 | **Startup.cs 添加启动配置** 45 | 46 | 添加以下代码到 `Startup.cs` 的 `ConfigureServices` 函数中 47 | 48 | *注意: 必须在 services.AddAbp 调用之前!* 49 | 50 | ``` cs 51 | services.AddYoYoAlipay(() => 52 | { 53 | // 加载 appsetting.json中的配置,配置详情见上方方配置文件说明 54 | var res = _appConfiguration.GetSection("Pay:Alipay").Get(); 55 | return res; 56 | }, (fTFConfig) => 57 | { 58 | // 配置面对面支付 59 | if (fTFConfig == null) 60 | { 61 | fTFConfig = new FTF.FTFConfig(); 62 | } 63 | // 面对面二维码生成错误显示图片 64 | fTFConfig.QRCodeGenErrorImageFullPath = System.IO.Path.Combine(_env.WebRootPath, "imgs", "pay", "alipay_error.png"); 65 | // 面对面生成二维码图中间图标 66 | fTFConfig.QRCodeIconFullPath = System.IO.Path.Combine(_env.WebRootPath, "imgs", "pay", "alipay.png"); 67 | }); 68 | ``` 69 | 70 | **添加模块依赖** 71 | 72 | 添加依赖 `typeof(YoyoAbpAlipayModule)` 到使用的 Module 73 | 74 | 示例: 75 | ``` cs 76 | 77 | [DependsOn( 78 | typeof(YoyoAbpAlipayModule) 79 | )] 80 | public class ABPCommunityWebCoreModule : AbpModule 81 | { 82 | 83 | } 84 | 85 | ``` 86 | ## 开始使用 87 | 88 | * 注入 `IAlipayHelper` 实例 `_alipayHelper` 89 | 90 | ### API说明 91 | *注意:详情请查看api xml提示信息* 92 | 93 | 函数名称 | 用途 | 附加说明 | 94 | | :-: | :-: | :-: | 95 | FTFPay | 面对面支付 | 支持轮询和异步通知两种方式 96 | FTFQuery | 面对面支付查询支付结果| 97 | WebPay | PC Web支付| 98 | WapPay | 手机 Web支付| 99 | Query | 订单查询| 100 | Refund | 订单退款| 101 | RefundQuery | 订单退款查询| 102 | OrderClose | 关闭订单| 103 | PayRequestCheck | 支付结果校验| 在支付同步回调中 或 支付异步回调通知校验支付结果信息 104 | 105 | 106 | ## 相关资源 107 | * [支付宝官方文档](https://docs.open.alipay.com/270/105899/) 108 | * [推荐博客](https://www.cnblogs.com/stulzq/category/1088543.html) 109 | -------------------------------------------------------------------------------- /src/Yoyo.Abp.Aliyun.Vod/Sms/AliyunSmsManager.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Abp.Domain.Services; 3 | using Abp.UI; 4 | using Aliyun.Acs.Core; 5 | using Aliyun.Acs.Core.Profile; 6 | using Yoyo.Abp.Configuration; 7 | 8 | namespace Yoyo.Abp.Sms 9 | { 10 | 11 | /// 12 | /// 阿里云短信服务 13 | /// 14 | public class AliyunSmsManager:DomainService 15 | { 16 | 17 | 18 | 19 | public string InitMethod() 20 | { 21 | 22 | return "短信方法注册成功"; 23 | } 24 | 25 | 26 | /// 27 | /// 初始化Sms获取客户端信息 28 | /// 29 | /// 默认为default 30 | /// 31 | public DefaultAcsClient InitSmsClient(string regionId="default") 32 | { 33 | 34 | IClientProfile profile = DefaultProfile.GetProfile(regionId, AliyunAccessConfigInfo.AccessKeyId, AliyunAccessConfigInfo.AccessKeySecret); 35 | 36 | try 37 | { 38 | var client = new DefaultAcsClient(profile); 39 | return client; 40 | } 41 | catch (Exception e) 42 | { 43 | Console.WriteLine(e); 44 | throw new UserFriendlyException(e.Message); 45 | } 46 | } 47 | 48 | 49 | /// 50 | /// 初始化Sms获取客户端信息 51 | /// 52 | /// 默认为default 53 | /// 54 | public DefaultAcsClient InitSmsClient(string accessKeyId,string accessKeySecret, string regionId = "default") 55 | { 56 | 57 | IClientProfile profile = DefaultProfile.GetProfile(regionId, accessKeyId, accessKeySecret); 58 | 59 | try 60 | { 61 | var client = new DefaultAcsClient(profile); 62 | return client; 63 | } 64 | catch (Exception e) 65 | { 66 | Console.WriteLine(e); 67 | throw new UserFriendlyException(e.Message); 68 | } 69 | } 70 | 71 | 72 | public void SendSms() 73 | { 74 | 75 | InitSmsClient(); 76 | 77 | 78 | } 79 | 80 | 81 | 82 | public void QuerySendDetails() 83 | { 84 | 85 | 86 | } 87 | 88 | 89 | 90 | 91 | public void SendBatchSms() 92 | { 93 | 94 | 95 | } 96 | 97 | 98 | 99 | } 100 | } -------------------------------------------------------------------------------- /src/Yoyo.Abp.Wechat.Open/Yoyo.Abp.Wechat.Open.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Yoyo.Abp.Wechat.Open 5 | 6 | 7 | 8 | 9 | YoYo Soft 对 Senparc.Weixin.Open 的扩展 10 | 11 | 12 | 13 | 14 | 注册第三方平台信息 15 | 16 | 17 | 18 | 19 | 获取ComponentVerifyTicket的方法 20 | 从数据库中获取已存的AuthorizerAccessToken的方法 21 | AuthorizerAccessToken更新后的回调 22 | 标记名称(如开放平台名称),帮助管理员识别 23 | 24 | 25 | 26 | 27 | 根据 SenparcWeixinSetting 自动注册第三方平台信息 28 | 29 | 30 | SenparcWeixinSetting 31 | 32 | 33 | 34 | 统一标识,如果为null,则使用 SenparcWeixinSetting.ItemKey 35 | 36 | 37 | 38 | 39 | YoYo Soft Senparc.WeiXin.Open Module 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /src/Yoyo.Abp.Wechat.Open/YoyoAbpWechatOpenExtensions.cs: -------------------------------------------------------------------------------- 1 | using Senparc.Weixin.Open.ComponentAPIs; 2 | using Senparc.Weixin.Open.Containers; 3 | using Senparc.CO2NET.RegisterServices; 4 | using Senparc.Weixin.Open; 5 | using System; 6 | using System.Threading.Tasks; 7 | 8 | namespace Yoyo.Abp 9 | { 10 | /// 11 | /// YoYo Soft 对 Senparc.Weixin.Open 的扩展 12 | /// 13 | public static class YoyoAbpWechatOpenExtensions 14 | { 15 | 16 | /// 17 | /// 注册第三方平台信息 18 | /// 19 | /// 20 | /// 21 | /// 22 | /// 获取ComponentVerifyTicket的方法 23 | /// 从数据库中获取已存的AuthorizerAccessToken的方法 24 | /// AuthorizerAccessToken更新后的回调 25 | /// 标记名称(如开放平台名称),帮助管理员识别 26 | /// 27 | public static IRegisterService UseYoYoSenparcOpenComponent(this IRegisterService registerService, 28 | string componentAppId, string componentAppSecret, 29 | Func> getComponentVerifyTicketFunc, 30 | Func> getAuthorizerRefreshTokenFunc, 31 | Action authorizerTokenRefreshedFunc, 32 | string name = null) 33 | { 34 | return registerService.RegisterOpenComponent( 35 | componentAppId, 36 | componentAppSecret, 37 | getComponentVerifyTicketFunc, 38 | getAuthorizerRefreshTokenFunc, 39 | authorizerTokenRefreshedFunc, 40 | name); 41 | } 42 | 43 | 44 | /// 45 | /// 根据 SenparcWeixinSetting 自动注册第三方平台信息 46 | /// 47 | /// 48 | /// SenparcWeixinSetting 49 | /// 50 | /// 51 | /// 52 | /// 统一标识,如果为null,则使用 SenparcWeixinSetting.ItemKey 53 | /// 54 | public static IRegisterService UseYoYoSenparcOpenComponent(this IRegisterService registerService, 55 | Senparc.Weixin.Entities.ISenparcWeixinSettingForOpen weixinSettingForOpen, 56 | Func> getComponentVerifyTicketFunc, 57 | Func> getAuthorizerRefreshTokenFunc, 58 | Action authorizerTokenRefreshedFunc, 59 | string name = null) 60 | { 61 | return registerService.RegisterOpenComponent( 62 | weixinSettingForOpen.Component_Appid, 63 | weixinSettingForOpen.Component_Secret, 64 | getComponentVerifyTicketFunc, 65 | getAuthorizerRefreshTokenFunc, 66 | authorizerTokenRefreshedFunc, 67 | name 68 | ); 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/Yoyo.Abp.Aliyun.Vod/Vod/Enum/AliyunVodAppConts.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Yoyo.Abp.Vod.Enum 4 | { 5 | 6 | /// 7 | /// 阿里云VOD中视频涉及的常量,如枚举,字段信息等 8 | /// 9 | 10 | public static class AliyunVodAppConts 11 | { /// 12 | /// 搜索媒体资源的类型 13 | /// 14 | public static class MediaTypeConsts 15 | { 16 | 17 | /// 18 | /// 视频,默认值 19 | /// 20 | public const string Video = "video"; 21 | /// 22 | /// (音频) 23 | /// 24 | public const string Audio = "audio"; 25 | /// 26 | /// (图片) 27 | /// 28 | public const string Image = "image"; 29 | /// 30 | /// (辅助媒资) 31 | /// 32 | public const string Attached = "attached"; 33 | 34 | 35 | 36 | } 37 | 38 | /// 39 | /// 管理媒体资源的常用返回字段 40 | /// 41 | public static class SearchMediaCommonFilds 42 | { 43 | 44 | 45 | 46 | 47 | 48 | /// 49 | /// 返回视频的常用字段 50 | /// 51 | public static string VideoCommonFilds = $"VideoId,MediaSource,MediaType,Title," + 52 | $"Tags,Status,Size,Duration," + 53 | $"Description,ModificationTime," + 54 | $"CreationTime,CoverURL," + 55 | "CateId,CateName,DownloadSwitch," + 56 | "PreprocessStatus," + 57 | "StorageLocation,RegionId," + 58 | "TranscodeMode,AuditStatus," + 59 | "AuditAIStatus,AuditManualStatus," + 60 | "AuditAIResult,AuditTemplateId," + 61 | "customMediaInfo,AppId"; 62 | 63 | public static string AudioCommonFilds = $"AudioId,mediaSource,Title,Tags,Status,Size,Duration,Description," + 64 | "ModificationTime,CreationTime,CoverURL,CateId,CateName," + 65 | "DownloadSwitch,PreprocessStatus,StorageLocation,RegionId," + 66 | "TranscodeMode,AuditStatus,AuditAIStatus,AuditManualStatus," + 67 | "AuditAIResult,AuditTemplateId,CustomMediaInfo,AppId"; 68 | 69 | 70 | public static string ImageCommonFilds = $"Title,ImageId,CateId,CateName,Ext," + 71 | "CreationTime,ModificationTime,Tags,Type,Url," + 72 | "Status,Description,StorageLocation,RegionId,AppId"; 73 | 74 | 75 | public static string AttachedMediaCommonFilds = $"Title,mediaId,Ext," + 76 | "CreationTime,ModificationTime,Tags,BusinessType,Url," + 77 | "Status,Description,StorageLocation,RegionId,AppId,Icon," + 78 | "OnlineStatus"; 79 | 80 | 81 | 82 | } 83 | 84 | 85 | } 86 | 87 | 88 | 89 | 90 | 91 | 92 | } -------------------------------------------------------------------------------- /src/Yoyo.Abp.Wechat/Yoyo.Abp.Wechat.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Yoyo.Abp.Wechat 5 | 6 | 7 | 8 | 9 | YoYo Soft 对 Senparc.Weixin、CO2NET、Redis 的扩展 10 | 11 | 12 | 13 | 14 | 添加YoYo Senparc CO2NET和Weixin 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 添加YoYo Senparc CO2NET 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 添加YoYo Senparc Weixin 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 开始YoYo Senparc.CO2NET SDK 初始化参数流程 39 | 40 | (关于 UseYoYoSenparc() 的更多用法见 CO2NET Demo 中的 UseSenparcGlobal:https://github.com/Senparc/Senparc.CO2NET/blob/master/Sample/Senparc.CO2NET.Sample.netcore/Startup.cs) 41 | 42 | 43 | 提供网站根目录(env.ContentRootPath,env类型为IHostingEnvironment) 44 | 是否自动扫描全局的扩展缓存(会增加系统启动时间) 45 | 46 | 需要手动注册的扩展缓存策略 47 | (LocalContainerCacheStrategy、RedisContainerCacheStrategy、MemcacheContainerCacheStrategy已经自动注册), 48 | 如果设置为 null(注意:不是委托返回 null,是整个委托参数为 null),则自动使用反射扫描所有可能存在的扩展缓存策略 49 | 50 | 51 | 52 | 53 | 54 | YoYo Senparc CO2NET 全局缓存配置(按需) 55 | 56 | 57 | 58 | 59 | 当同一个分布式缓存同时服务于多个网站(应用程序池)时,可以使用命名空间将其隔离(非必须) 60 | 配置全局使用Redis缓存(按需,独立),此函数返回结果为true将启用redis 61 | 62 | 63 | 64 | 65 | YoYo Senparc CO2NET 跟踪日志 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 开始 Senparc.Weixin SDK 初始化参数流程 74 | 75 | 76 | 微信全局设置参数,必填 77 | 用于提供 SenparcSetting.Cache_Redis_Configuration 和 Cache_Memcached_Configuration 两个参数,如果不使用这两种分布式缓存可传入null 78 | 79 | 80 | 81 | 82 | YoYo Soft Senparc.WeiXin Module 83 | 84 | 85 | 86 | 87 | 快捷注册类,YoYoSoft 实现的 IRegisterService 88 | 89 | 90 | 91 | 92 | 开始 Senparc.CO2NET SDK 初始化参数流程(.NET Core) 93 | 94 | 95 | asp.net core应用中IHostingEnvironment对象的ContentRootPath 96 | 97 | 98 | 99 | 100 | -------------------------------------------------------------------------------- /Yoyo.Abp.Modules.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.29318.209 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{D2C50266-8938-4907-A5F3-CB0562FFBD1B}" 7 | EndProject 8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yoyo.Abp.Alipay", "src\Yoyo.Abp.Alipay\Yoyo.Abp.Alipay.csproj", "{ED7FA409-3AEC-4BBD-B1DA-EE13DB154D61}" 9 | EndProject 10 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yoyo.Abp.Wechat", "src\Yoyo.Abp.Wechat\Yoyo.Abp.Wechat.csproj", "{22615E3F-DB2F-467B-86E6-D20A5489A4A8}" 11 | EndProject 12 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yoyo.Abp.Wechat.MP", "src\Yoyo.Abp.Wechat.MP\Yoyo.Abp.Wechat.MP.csproj", "{E49528C0-64C3-4FAD-B5E4-3CBE6A74943E}" 13 | EndProject 14 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yoyo.Abp.Wechat.Open", "src\Yoyo.Abp.Wechat.Open\Yoyo.Abp.Wechat.Open.csproj", "{7EEC718D-3684-44B5-B3E4-70BFF797BF41}" 15 | EndProject 16 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yoyo.Abp.Wechat.TenPay", "src\Yoyo.Abp.Wechat.TenPay\Yoyo.Abp.Wechat.TenPay.csproj", "{A456E99F-8080-4B0F-89DB-317D339AB4E6}" 17 | EndProject 18 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yoyo.Abp.Wechat.Work", "src\Yoyo.Abp.Wechat.Work\Yoyo.Abp.Wechat.Work.csproj", "{07289CA3-3B8E-459D-BDCF-3CA7D1EBE42D}" 19 | EndProject 20 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yoyo.Abp.Wechat.WxOpen", "src\Yoyo.Abp.Wechat.WxOpen\Yoyo.Abp.Wechat.WxOpen.csproj", "{7AE90FEF-348D-4CF3-AA33-C456C4A134C7}" 21 | EndProject 22 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yoyo.Abp.Aliyun.Vod", "src\Yoyo.Abp.Aliyun.Vod\Yoyo.Abp.Aliyun.Vod.csproj", "{639AD813-E943-4931-BB7B-CD9C41AEA5A1}" 23 | EndProject 24 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{28BABF57-09C0-4992-AC9C-82BA4645D347}" 25 | ProjectSection(SolutionItems) = preProject 26 | Jenkinsfile = Jenkinsfile 27 | build\pack.sh = build\pack.sh 28 | README.md = README.md 29 | EndProjectSection 30 | EndProject 31 | Global 32 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 33 | Debug|Any CPU = Debug|Any CPU 34 | Release|Any CPU = Release|Any CPU 35 | EndGlobalSection 36 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 37 | {ED7FA409-3AEC-4BBD-B1DA-EE13DB154D61}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 38 | {ED7FA409-3AEC-4BBD-B1DA-EE13DB154D61}.Debug|Any CPU.Build.0 = Debug|Any CPU 39 | {ED7FA409-3AEC-4BBD-B1DA-EE13DB154D61}.Release|Any CPU.ActiveCfg = Release|Any CPU 40 | {ED7FA409-3AEC-4BBD-B1DA-EE13DB154D61}.Release|Any CPU.Build.0 = Release|Any CPU 41 | {22615E3F-DB2F-467B-86E6-D20A5489A4A8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 42 | {22615E3F-DB2F-467B-86E6-D20A5489A4A8}.Debug|Any CPU.Build.0 = Debug|Any CPU 43 | {22615E3F-DB2F-467B-86E6-D20A5489A4A8}.Release|Any CPU.ActiveCfg = Release|Any CPU 44 | {22615E3F-DB2F-467B-86E6-D20A5489A4A8}.Release|Any CPU.Build.0 = Release|Any CPU 45 | {E49528C0-64C3-4FAD-B5E4-3CBE6A74943E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 46 | {E49528C0-64C3-4FAD-B5E4-3CBE6A74943E}.Debug|Any CPU.Build.0 = Debug|Any CPU 47 | {E49528C0-64C3-4FAD-B5E4-3CBE6A74943E}.Release|Any CPU.ActiveCfg = Release|Any CPU 48 | {E49528C0-64C3-4FAD-B5E4-3CBE6A74943E}.Release|Any CPU.Build.0 = Release|Any CPU 49 | {7EEC718D-3684-44B5-B3E4-70BFF797BF41}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 50 | {7EEC718D-3684-44B5-B3E4-70BFF797BF41}.Debug|Any CPU.Build.0 = Debug|Any CPU 51 | {7EEC718D-3684-44B5-B3E4-70BFF797BF41}.Release|Any CPU.ActiveCfg = Release|Any CPU 52 | {7EEC718D-3684-44B5-B3E4-70BFF797BF41}.Release|Any CPU.Build.0 = Release|Any CPU 53 | {A456E99F-8080-4B0F-89DB-317D339AB4E6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 54 | {A456E99F-8080-4B0F-89DB-317D339AB4E6}.Debug|Any CPU.Build.0 = Debug|Any CPU 55 | {A456E99F-8080-4B0F-89DB-317D339AB4E6}.Release|Any CPU.ActiveCfg = Release|Any CPU 56 | {A456E99F-8080-4B0F-89DB-317D339AB4E6}.Release|Any CPU.Build.0 = Release|Any CPU 57 | {07289CA3-3B8E-459D-BDCF-3CA7D1EBE42D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 58 | {07289CA3-3B8E-459D-BDCF-3CA7D1EBE42D}.Debug|Any CPU.Build.0 = Debug|Any CPU 59 | {07289CA3-3B8E-459D-BDCF-3CA7D1EBE42D}.Release|Any CPU.ActiveCfg = Release|Any CPU 60 | {07289CA3-3B8E-459D-BDCF-3CA7D1EBE42D}.Release|Any CPU.Build.0 = Release|Any CPU 61 | {7AE90FEF-348D-4CF3-AA33-C456C4A134C7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 62 | {7AE90FEF-348D-4CF3-AA33-C456C4A134C7}.Debug|Any CPU.Build.0 = Debug|Any CPU 63 | {7AE90FEF-348D-4CF3-AA33-C456C4A134C7}.Release|Any CPU.ActiveCfg = Release|Any CPU 64 | {7AE90FEF-348D-4CF3-AA33-C456C4A134C7}.Release|Any CPU.Build.0 = Release|Any CPU 65 | {639AD813-E943-4931-BB7B-CD9C41AEA5A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 66 | {639AD813-E943-4931-BB7B-CD9C41AEA5A1}.Debug|Any CPU.Build.0 = Debug|Any CPU 67 | {639AD813-E943-4931-BB7B-CD9C41AEA5A1}.Release|Any CPU.ActiveCfg = Release|Any CPU 68 | {639AD813-E943-4931-BB7B-CD9C41AEA5A1}.Release|Any CPU.Build.0 = Release|Any CPU 69 | EndGlobalSection 70 | GlobalSection(SolutionProperties) = preSolution 71 | HideSolutionNode = FALSE 72 | EndGlobalSection 73 | GlobalSection(NestedProjects) = preSolution 74 | {ED7FA409-3AEC-4BBD-B1DA-EE13DB154D61} = {D2C50266-8938-4907-A5F3-CB0562FFBD1B} 75 | {22615E3F-DB2F-467B-86E6-D20A5489A4A8} = {D2C50266-8938-4907-A5F3-CB0562FFBD1B} 76 | {E49528C0-64C3-4FAD-B5E4-3CBE6A74943E} = {D2C50266-8938-4907-A5F3-CB0562FFBD1B} 77 | {7EEC718D-3684-44B5-B3E4-70BFF797BF41} = {D2C50266-8938-4907-A5F3-CB0562FFBD1B} 78 | {A456E99F-8080-4B0F-89DB-317D339AB4E6} = {D2C50266-8938-4907-A5F3-CB0562FFBD1B} 79 | {07289CA3-3B8E-459D-BDCF-3CA7D1EBE42D} = {D2C50266-8938-4907-A5F3-CB0562FFBD1B} 80 | {7AE90FEF-348D-4CF3-AA33-C456C4A134C7} = {D2C50266-8938-4907-A5F3-CB0562FFBD1B} 81 | {639AD813-E943-4931-BB7B-CD9C41AEA5A1} = {D2C50266-8938-4907-A5F3-CB0562FFBD1B} 82 | EndGlobalSection 83 | GlobalSection(ExtensibilityGlobals) = postSolution 84 | SolutionGuid = {D4298007-FD29-4B62-B625-F7D7C6BE2BC7} 85 | EndGlobalSection 86 | EndGlobal 87 | -------------------------------------------------------------------------------- /src/Yoyo.Abp.Alipay/IAlipayHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | using Abp.Dependency; 4 | using Alipay.AopSdk.AspnetCore; 5 | using Alipay.AopSdk.Core.Domain; 6 | using Alipay.AopSdk.Core.Response; 7 | using Alipay.AopSdk.F2FPay.Business; 8 | using Alipay.AopSdk.F2FPay.Domain; 9 | using Microsoft.AspNetCore.Http; 10 | using Yoyo.Abp.FTF; 11 | using Yoyo.Abp.Other; 12 | using Yoyo.Abp.WapPay; 13 | using Yoyo.Abp.WebPay; 14 | 15 | namespace Yoyo.Abp 16 | { 17 | /// 18 | /// 支付宝支付 19 | /// 20 | public interface IAlipayHelper : ISingletonDependency 21 | { 22 | /// 23 | /// 面对面支付(异步消息通知),返回生成的图片二维码byte数组 24 | /// 25 | /// 支付信息 26 | /// 异步消息通知地址 27 | /// 面对面支付配置信息(不填则使用全局配置的) 28 | /// 二维码图片字节数组 29 | Task FTFPay(AlipayTradePrecreateContentBuilder input, string asyncNotifyUrl, FTFConfig fTFConfig = null); 30 | 31 | /// 32 | /// 面对面支付(轮询),返回生成的图片二维码byte数组 33 | /// 34 | /// 支付信息 35 | /// 轮询的回调函数 36 | /// 面对面支付配置信息(不填则使用全局配置的) 37 | /// 38 | Task FTFPay(AlipayTradePrecreateContentBuilder input, Action loopQueryAction, FTFConfig fTFConfig = null); 39 | 40 | /// 41 | /// 面对面支付结果查询 42 | /// 43 | /// 44 | /// 45 | Task FTFQuery(string outTradeNo); 46 | 47 | /// 48 | /// PC Web 支付 49 | /// 50 | /// 支付信息和回调通知信息 51 | /// 支付选项,如果为空则使用添加时内置的 52 | /// 53 | Task WebPay(WebPayInput input, AlipayOptions options = null); 54 | 55 | /// 56 | /// 手机Web支付 57 | /// 58 | /// 支付信息和回调通知信息 59 | /// 支付选项,如果为空则使用添加时内置的 60 | /// 61 | Task WapPay(WapPayInput input, AlipayOptions options = null); 62 | 63 | /// 64 | /// 订单查询 65 | /// 66 | /// 查询数据 67 | /// 68 | Task Query(OrderQueryInput input); 69 | /// 70 | /// 订单查询 71 | /// 72 | /// 查询数据 73 | /// 74 | Task Query(AlipayTradeQueryModel input); 75 | /// 76 | /// 订单查询 77 | /// 78 | /// 商户系统订单编码 79 | /// 支付宝订单编码 80 | /// 81 | Task Query(string tradeNo, string alipayTradeNo); 82 | 83 | 84 | /// 85 | /// 订单退款 86 | /// 87 | /// 退款数据 88 | /// 89 | Task Refund(RefundInput input); 90 | /// 91 | /// 订单退款 92 | /// 93 | /// 退款数据 94 | /// 95 | Task Refund(AlipayTradeRefundModel input); 96 | 97 | /// 98 | /// 订单退款 99 | /// 100 | /// 商户订单号 101 | /// 支付宝交易号 102 | /// 退款金额 103 | /// 退款原因 104 | /// 退款单号 105 | /// 106 | Task Refund(string tradeno, string alipayTradeNo, string refundAmount, string refundReason, string refundNo); 107 | 108 | /// 109 | /// 订单退款查询 110 | /// 111 | /// 查询数据 112 | /// 113 | Task RefundQuery(RefundQueryInput input); 114 | 115 | /// 116 | /// 订单退款查询 117 | /// 118 | /// 查询数据 119 | /// 120 | Task RefundQuery(AlipayTradeFastpayRefundQueryModel input); 121 | 122 | /// 123 | /// 订单退款查询 124 | /// 125 | /// 商户订单号 126 | /// 支付宝交易号 127 | /// 退款单号 128 | /// 129 | Task RefundQuery(string tradeno, string alipayTradeNo, string refundNo); 130 | 131 | /// 132 | /// 关闭订单 133 | /// 134 | /// 关闭订单数据 135 | /// 136 | Task OrderClose(OrderCloseInput input); 137 | /// 138 | /// 关闭订单 139 | /// 140 | /// 关闭订单数据 141 | /// 142 | Task OrderClose(AlipayTradeCloseModel input); 143 | /// 144 | /// 关闭订单 145 | /// 146 | /// 商户订单号 147 | /// 支付宝交易号 148 | /// 149 | Task OrderClose(string tradeNo, string alipayTradeNo); 150 | 151 | 152 | /// 153 | /// 校验,在支付同步回调中 或 支付异步回调通知 154 | /// 155 | /// 156 | Task PayRequestCheck(HttpRequest request); 157 | } 158 | } 159 | -------------------------------------------------------------------------------- /src/Yoyo.Abp.Wechat.MP/YoyoAbpWechatMPExtensions.cs: -------------------------------------------------------------------------------- 1 | using Senparc.CO2NET.RegisterServices; 2 | using Senparc.Weixin.Entities; 3 | using Senparc.Weixin.MP; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Text; 7 | using Yoyo.Abp.Containers; 8 | 9 | namespace Yoyo.Abp 10 | { 11 | /// 12 | /// YoYo Soft 对 Senparc.Weixin.MP 的扩展 13 | /// 14 | public static class YoyoAbpWechatMPExtensions 15 | { 16 | /// 17 | /// 注册公众号(或小程序)信息 18 | /// 19 | /// 用户唯一Id类型 20 | /// 租户唯一Id类型 21 | /// RegisterService 22 | /// 微信公众号后台的【开发】>【基本配置】中的“AppID(应用ID)” 23 | /// 微信公众号后台的【开发】>【基本配置】中的“AppSecret(应用密钥)” 24 | /// 标记AccessToken名称(如微信公众号名称),帮助管理员识别 25 | /// token 26 | /// encodingAESKey 27 | /// 获取公众号信息Key 28 | /// 用户Id 29 | /// 租户Id 30 | /// 31 | public static IRegisterService UseYoYoSenparcMpAccount(this IRegisterService registerService, string appId, string appSecret, string name, string token, string encodingAESKey, string key, UserKeyType userId = default(UserKeyType), TenantKeyType tenantId = default(TenantKeyType)) 32 | { 33 | MpInfoContainer.Register(key, appId, appSecret, token, encodingAESKey, name, default(UserKeyType), default(TenantKeyType)); 34 | return registerService.RegisterMpAccount(appId, appSecret, name); 35 | } 36 | 37 | /// 38 | /// 注册公众号(或小程序)信息 39 | /// 40 | /// RegisterService 41 | /// 微信公众号后台的【开发】>【基本配置】中的“AppID(应用ID)” 42 | /// 微信公众号后台的【开发】>【基本配置】中的“AppSecret(应用密钥)” 43 | /// 标记AccessToken名称(如微信公众号名称),帮助管理员识别 44 | /// token 45 | /// encodingAESKey 46 | /// 获取公众号信息Key 47 | /// 用户Id 48 | /// 租户Id 49 | /// 50 | public static IRegisterService UseYoYoSenparcMpAccount(this IRegisterService registerService, string appId, string appSecret, string name, string token, string encodingAESKey, string key, long userId = default(long), long tenantId = default(long)) 51 | { 52 | MpInfoContainer.Register(appId,appSecret,name,token,encodingAESKey,key, userId, tenantId); 53 | return registerService.RegisterMpAccount(appId, appSecret, name); 54 | } 55 | 56 | /// 57 | /// 根据 SenparcWeixinSetting 自动注册公众号信息(包括JsApi) 58 | /// 59 | /// RegisterService 60 | /// SenparcWeixinSetting 61 | /// token 62 | /// encodingAESKey 63 | /// 获取公众号信息Key 64 | /// 统一标识,如果为null,则使用 weixinSettingForMP.ItemKey 65 | /// 用户Id 66 | /// 租户Id 67 | /// 68 | public static IRegisterService UseYoYoSenparcMpAccount(this IRegisterService registerService, ISenparcWeixinSettingForMP weixinSettingForMP, string token, string encodingAESKey, string key, string name = null, UserKeyType userId = default(UserKeyType), TenantKeyType tenantId = default(TenantKeyType)) 69 | { 70 | MpInfoContainer.Register(key, weixinSettingForMP.WeixinAppId, weixinSettingForMP.WeixinAppSecret, token, encodingAESKey, name, default(long), default(long)); 71 | return registerService.RegisterMpAccount(weixinSettingForMP, name); 72 | } 73 | /// 74 | /// 根据 SenparcWeixinSetting 自动注册公众号信息(包括JsApi) 75 | /// 76 | /// RegisterService 77 | /// SenparcWeixinSetting 78 | /// token 79 | /// encodingAESKey 80 | /// 获取公众号信息Key 81 | /// 统一标识,如果为null,则使用 weixinSettingForMP.ItemKey 82 | /// 用户Id 83 | /// 租户Id 84 | /// 85 | public static IRegisterService UseYoYoSenparcMpAccount(this IRegisterService registerService, ISenparcWeixinSettingForMP weixinSettingForMP, string token, string encodingAESKey, string key, string name = null, long userId = default(long), long tenantId = default(long)) 86 | { 87 | MpInfoContainer.Register(key, weixinSettingForMP.WeixinAppId, weixinSettingForMP.WeixinAppSecret, token, encodingAESKey, name, userId, tenantId); 88 | return registerService.RegisterMpAccount(weixinSettingForMP, name); 89 | } 90 | 91 | /// 92 | /// 注册公众号(或小程序)的JSApi(RegisterMpAccount注册过程中已包含) 93 | /// 94 | /// RegisterService 95 | /// 微信公众号后台的【开发】>【基本配置】中的“AppID(应用ID)” 96 | /// 微信公众号后台的【开发】>【基本配置】中的“AppSecret(应用密钥)” 97 | /// 标记AccessToken名称(如微信公众号名称),帮助管理员识别 98 | /// 99 | public static IRegisterService UseYoYoSenparcMpJsApiTicket(this IRegisterService registerService, string appId, string appSecret, string name) 100 | { 101 | return registerService.RegisterMpJsApiTicket(appId, appSecret, name); 102 | } 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /src/Yoyo.Abp.Wechat.MP/YoyoAbpWechatMP.cs: -------------------------------------------------------------------------------- 1 | using Senparc.Weixin.MP.Containers; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using Yoyo.Abp.Containers; 7 | 8 | namespace Yoyo.Abp 9 | { 10 | /// 11 | /// 公众号操作 12 | /// 13 | public class YoyoAbpWechatMP 14 | { 15 | /// 16 | /// 注册公众号 17 | /// 18 | /// 用户唯一Id类型 19 | /// 租户唯一Id类型 20 | /// 获取公众号信息Key 21 | /// 公众号AppId 22 | /// 公众号AppSecret 23 | /// 公众号Token 24 | /// 公众号EncodingAESKey 25 | /// 公众号名称 26 | /// 用户Id 27 | /// 租户Id 28 | public static async Task RegisterMpAccount(string key, string appId, string appSecret, string token, string encodingAESKey, string name = null, UserKeyType userId = default(UserKeyType), TenantKeyType tenantId = default(TenantKeyType)) 29 | { 30 | MpInfoContainer.Register(key, appId, appSecret, token, encodingAESKey, name, userId, tenantId); 31 | await AccessTokenContainer.RegisterAsync(appId, appSecret, name); 32 | await JsApiTicketContainer.RegisterAsync(appId, appSecret, name); 33 | await WxCardApiTicketContainer.RegisterAsync(appId, appSecret, name); 34 | } 35 | 36 | /// 37 | /// 注册公众号 38 | /// 39 | /// 获取公众号信息Key 40 | /// 公众号AppId 41 | /// 公众号AppSecret 42 | /// 公众号Token 43 | /// 公众号EncodingAESKey 44 | /// 公众号名称 45 | /// 用户Id 46 | /// 租户Id 47 | public static void RegisterMpAccount(string key, string appId, string appSecret, string token, string encodingAESKey, string name = null, long userId = default(long), long tenantId = default(long)) 48 | { 49 | var task = RegisterMpAccountAsync(key, appId, appSecret, token, encodingAESKey, name, userId, tenantId); 50 | Task.WaitAll(new[] { task }, 10000); 51 | } 52 | /// 53 | /// 注册公众号 54 | /// 55 | /// 获取公众号信息Key 56 | /// 公众号AppId 57 | /// 公众号AppSecret 58 | /// 公众号Token 59 | /// 公众号EncodingAESKey 60 | /// 公众号名称 61 | /// 用户Id 62 | /// 租户Id 63 | public static async Task RegisterMpAccountAsync(string key, string appId, string appSecret, string token, string encodingAESKey, string name = null, long userId = default(long), long tenantId = default(long)) 64 | { 65 | await RegisterMpAccount(key, appId, appSecret, token, encodingAESKey, name, userId, tenantId); 66 | } 67 | 68 | /// 69 | /// 获取AccessToken 70 | /// 71 | /// 公众号AppId 72 | /// 是否强制重新获取新的Token 73 | /// 74 | public static string GetAccessToken(string appId, bool getNewToken = false) 75 | { 76 | return AccessTokenContainer.GetAccessToken(appId, getNewToken); 77 | } 78 | 79 | /// 80 | /// 获取AccessToken(异步) 81 | /// 82 | /// 公众号AppId 83 | /// 是否强制重新获取新的Token 84 | /// 85 | public static async Task GetAccessTokenAsync(string appId, bool getNewToken = false) 86 | { 87 | return await AccessTokenContainer.GetAccessTokenAsync(appId, getNewToken); 88 | } 89 | 90 | /// 91 | /// 获取可用JsApiTicket 92 | /// 93 | /// 公众号AppId 94 | /// 是否强制重新获取新的Ticket 95 | /// 96 | public static string GetJsApiTicket(string appId, bool getNewTicket = false) 97 | { 98 | return JsApiTicketContainer.GetJsApiTicket(appId, getNewTicket); 99 | } 100 | 101 | /// 102 | /// 获取可用JsApiTicket(异步) 103 | /// 104 | /// 公众号AppId 105 | /// 是否强制重新获取新的Ticket 106 | /// 107 | public static async Task GetJsApiTicketAsync(string appId, bool getNewTicket = false) 108 | { 109 | return await JsApiTicketContainer.GetJsApiTicketAsync(appId, getNewTicket); 110 | } 111 | /// 112 | /// 获取可用CardApiTicket 113 | /// 114 | /// 公众号AppId 115 | /// 是否强制重新获取新的Ticket 116 | /// 117 | public static string GetWxCardApiTicket(string appId, bool getNewTicket = false) 118 | { 119 | return WxCardApiTicketContainer.GetWxCardApiTicket(appId, getNewTicket); 120 | } 121 | 122 | /// 123 | /// 获取可用CardApiTicket(异步) 124 | /// 125 | /// 公众号AppId 126 | /// 是否强制重新获取新的Ticket 127 | /// 128 | public static async Task GetWxCardApiTicketAsync(string appId, bool getNewTicket = false) 129 | { 130 | return await WxCardApiTicketContainer.GetWxCardApiTicketAsync(appId, getNewTicket); 131 | } 132 | } 133 | } 134 | -------------------------------------------------------------------------------- /src/Yoyo.Abp.Aliyun.Vod/Vod/AliyunVodManager.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Abp.Domain.Services; 3 | using Abp.UI; 4 | using Aliyun.Acs.Core; 5 | using Aliyun.Acs.Core.Profile; 6 | using Aliyun.Acs.vod.Model.V20170321; 7 | using Yoyo.Abp.Configuration; 8 | 9 | namespace Yoyo.Abp.Vod 10 | { 11 | /// 12 | /// 阿里云VOD的领域服务 13 | /// 14 | public class AliyunVodManager:DomainService 15 | { 16 | 17 | public string InitMethod() 18 | { 19 | 20 | return "方法注册成功"; 21 | } 22 | 23 | /// 24 | /// 初始化vod获取客户端信息 25 | /// 26 | /// 如果是外国的源可以用这个方法 27 | /// 28 | public DefaultAcsClient InitVodClient(string regionId) 29 | { 30 | var profile = DefaultProfile.GetProfile(regionId, AliyunAccessConfigInfo.AccessKeyId, AliyunAccessConfigInfo.AccessKeySecret); 31 | profile.AddEndpoint(regionId, regionId, "vod", "vod." + regionId + ".aliyuncs.com"); 32 | var client= new DefaultAcsClient(profile); 33 | return client; 34 | } 35 | 36 | /// 37 | /// 默认初始化vod服务,读取setting中的内容 38 | /// 39 | /// 40 | public DefaultAcsClient InitVodClient() 41 | { 42 | IClientProfile profile = DefaultProfile.GetProfile(AliyunVodConfigInfo.RegionId, AliyunAccessConfigInfo.AccessKeyId, AliyunAccessConfigInfo.AccessKeySecret); 43 | try 44 | { 45 | var client = new DefaultAcsClient(profile); 46 | return client; 47 | } 48 | catch (Exception e) 49 | { 50 | Console.WriteLine(e); 51 | throw new UserFriendlyException(e.Message); 52 | } 53 | 54 | } 55 | 56 | 57 | /// 58 | /// 获取视频的播放信息 59 | /// 60 | /// 参数:https://help.aliyun.com/document_detail/56124.html?spm=a2c4g.11186623.2.14.140f6872F2JNHX 61 | public GetPlayInfoResponse GetPlayInfo(GetPlayInfoRequest input) 62 | { 63 | var client = InitVodClient(); 64 | // 发起请求,并得到 response 65 | 66 | 67 | try 68 | { 69 | GetPlayInfoResponse response = client.GetAcsResponse(input); 70 | return response; 71 | } 72 | catch (Exception e) 73 | { 74 | Console.WriteLine(e); 75 | throw new UserFriendlyException($"获取视频信息报错:{e.Message}"); 76 | 77 | } 78 | 79 | } 80 | 81 | 82 | /// 83 | /// 获取视频播放的凭证信息,加密播放。 84 | /// 85 | /// 参数:https://help.aliyun.com/document_detail/52833.html?spm=a2c4g.11186623.2.15.140f6872F2JNHX 86 | public GetVideoPlayAuthResponse GetVideoPlayAuth(GetVideoPlayAuthRequest input) 87 | { 88 | var client = InitVodClient(); 89 | var response = client.GetAcsResponse(input); 90 | 91 | return response; 92 | 93 | } 94 | 95 | #region 媒体资源分类管理 96 | 97 | /// 98 | /// 添加媒体资源分类 99 | /// 100 | /// 101 | /// 102 | public AddCategoryResponse CreateMediaCategory(AddCategoryRequest input) 103 | { 104 | // 父分类ID,若不填,则默认生成一级分类,根节点分类ID为 -1 105 | if (!input.ParentId.HasValue) 106 | { 107 | input.ParentId = -1; 108 | 109 | } 110 | 111 | var client = InitVodClient(); 112 | 113 | var model = client.GetAcsResponse(input); 114 | 115 | return model; 116 | 117 | 118 | } 119 | /// 120 | /// 修改媒体资源分类 121 | /// 122 | /// 123 | /// 124 | public UpdateCategoryResponse UpdateMediaCategory(UpdateCategoryRequest input) 125 | { 126 | 127 | 128 | var client = InitVodClient(); 129 | var model = client.GetAcsResponse(input); 130 | return model; 131 | } 132 | 133 | /// 134 | /// 查询分类以及其子分类 135 | /// 136 | /// 137 | /// 138 | public GetCategoriesResponse GetMediaCategories(GetCategoriesRequest input) 139 | { 140 | var client = InitVodClient(); 141 | GetCategoriesResponse response = client.GetAcsResponse(input); 142 | 143 | 144 | return response; 145 | 146 | } 147 | 148 | 149 | 150 | 151 | 152 | /// 153 | /// 删除媒体资源 154 | /// 155 | /// 156 | /// 157 | public DeleteCategoryResponse DeleteCategories(DeleteCategoryRequest input) 158 | { 159 | 160 | var client = InitVodClient(); 161 | 162 | DeleteCategoryResponse response = client.GetAcsResponse(input); 163 | 164 | 165 | return response; 166 | 167 | 168 | } 169 | 170 | 171 | 172 | #endregion 173 | 174 | 175 | #region 媒体资源管理 176 | 177 | /// 178 | /// 搜索媒体资源 179 | /// 180 | /// 181 | /// 182 | public SearchMediaResponse SearchMediaList(SearchMediaRequest input) 183 | { 184 | 185 | var client = InitVodClient(); 186 | 187 | 188 | var response = client.GetAcsResponse(input); 189 | 190 | return response; 191 | } 192 | 193 | /// 194 | /// 获取视频信息 195 | /// 196 | /// 197 | /// 198 | public GetVideoInfoResponse GetVideoInfo(GetVideoInfoRequest input) 199 | { 200 | var client = InitVodClient(); 201 | 202 | 203 | 204 | GetVideoInfoResponse response = client.GetAcsResponse(input); 205 | 206 | 207 | 208 | 209 | return response; 210 | 211 | 212 | 213 | } 214 | /// 215 | /// 批量获取视频信息 216 | /// 217 | /// 218 | public GetVideoInfosResponse GetBatchVideosInfo(GetVideoInfosRequest input) 219 | { 220 | 221 | var client = InitVodClient(); 222 | GetVideoInfosResponse response = client.GetAcsResponse(input); 223 | 224 | return response; 225 | 226 | } 227 | 228 | 229 | 230 | 231 | #endregion 232 | 233 | } 234 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.suo 8 | *.user 9 | *.userosscache 10 | *.sln.docstates 11 | 12 | # User-specific files (MonoDevelop/Xamarin Studio) 13 | *.userprefs 14 | 15 | # Build results 16 | [Dd]ebug/ 17 | [Dd]ebugPublic/ 18 | [Rr]elease/ 19 | [Rr]eleases/ 20 | x64/ 21 | x86/ 22 | bld/ 23 | [Bb]in/ 24 | [Oo]bj/ 25 | [Ll]og/ 26 | 27 | # Visual Studio 2015/2017 cache/options directory 28 | .vs/ 29 | # Uncomment if you have tasks that create the project's static files in wwwroot 30 | #wwwroot/ 31 | 32 | # Visual Studio 2017 auto generated files 33 | Generated\ Files/ 34 | 35 | # MSTest test Results 36 | [Tt]est[Rr]esult*/ 37 | [Bb]uild[Ll]og.* 38 | 39 | # NUNIT 40 | *.VisualState.xml 41 | TestResult.xml 42 | 43 | # Build Results of an ATL Project 44 | [Dd]ebugPS/ 45 | [Rr]eleasePS/ 46 | dlldata.c 47 | 48 | # Benchmark Results 49 | BenchmarkDotNet.Artifacts/ 50 | 51 | # .NET Core 52 | project.lock.json 53 | project.fragment.lock.json 54 | artifacts/ 55 | **/Properties/launchSettings.json 56 | 57 | # StyleCop 58 | StyleCopReport.xml 59 | 60 | # Files built by Visual Studio 61 | *_i.c 62 | *_p.c 63 | *_i.h 64 | *.ilk 65 | *.meta 66 | *.obj 67 | *.iobj 68 | *.pch 69 | *.pdb 70 | *.ipdb 71 | *.pgc 72 | *.pgd 73 | *.rsp 74 | *.sbr 75 | *.tlb 76 | *.tli 77 | *.tlh 78 | *.tmp 79 | *.tmp_proj 80 | *.log 81 | *.vspscc 82 | *.vssscc 83 | .builds 84 | *.pidb 85 | *.svclog 86 | *.scc 87 | 88 | # Chutzpah Test files 89 | _Chutzpah* 90 | 91 | # Visual C++ cache files 92 | ipch/ 93 | *.aps 94 | *.ncb 95 | *.opendb 96 | *.opensdf 97 | *.sdf 98 | *.cachefile 99 | *.VC.db 100 | *.VC.VC.opendb 101 | 102 | # Visual Studio profiler 103 | *.psess 104 | *.vsp 105 | *.vspx 106 | *.sap 107 | 108 | # Visual Studio Trace Files 109 | *.e2e 110 | 111 | # TFS 2012 Local Workspace 112 | $tf/ 113 | 114 | # Guidance Automation Toolkit 115 | *.gpState 116 | 117 | # ReSharper is a .NET coding add-in 118 | _ReSharper*/ 119 | *.[Rr]e[Ss]harper 120 | *.DotSettings.user 121 | 122 | # JustCode is a .NET coding add-in 123 | .JustCode 124 | 125 | # TeamCity is a build add-in 126 | _TeamCity* 127 | 128 | # DotCover is a Code Coverage Tool 129 | *.dotCover 130 | 131 | # AxoCover is a Code Coverage Tool 132 | .axoCover/* 133 | !.axoCover/settings.json 134 | 135 | # Visual Studio code coverage results 136 | *.coverage 137 | *.coveragexml 138 | 139 | # NCrunch 140 | _NCrunch_* 141 | .*crunch*.local.xml 142 | nCrunchTemp_* 143 | 144 | # MightyMoose 145 | *.mm.* 146 | AutoTest.Net/ 147 | 148 | # Web workbench (sass) 149 | .sass-cache/ 150 | 151 | # Installshield output folder 152 | [Ee]xpress/ 153 | 154 | # DocProject is a documentation generator add-in 155 | DocProject/buildhelp/ 156 | DocProject/Help/*.HxT 157 | DocProject/Help/*.HxC 158 | DocProject/Help/*.hhc 159 | DocProject/Help/*.hhk 160 | DocProject/Help/*.hhp 161 | DocProject/Help/Html2 162 | DocProject/Help/html 163 | 164 | # Click-Once directory 165 | publish/ 166 | 167 | # Publish Web Output 168 | *.[Pp]ublish.xml 169 | *.azurePubxml 170 | # Note: Comment the next line if you want to checkin your web deploy settings, 171 | # but database connection strings (with potential passwords) will be unencrypted 172 | *.pubxml 173 | *.publishproj 174 | 175 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 176 | # checkin your Azure Web App publish settings, but sensitive information contained 177 | # in these scripts will be unencrypted 178 | PublishScripts/ 179 | 180 | # NuGet Packages 181 | *.nupkg 182 | # The packages folder can be ignored because of Package Restore 183 | **/[Pp]ackages/* 184 | # except build/, which is used as an MSBuild target. 185 | !**/[Pp]ackages/build/ 186 | # Uncomment if necessary however generally it will be regenerated when needed 187 | #!**/[Pp]ackages/repositories.config 188 | # NuGet v3's project.json files produces more ignorable files 189 | *.nuget.props 190 | *.nuget.targets 191 | 192 | # Microsoft Azure Build Output 193 | csx/ 194 | *.build.csdef 195 | 196 | # Microsoft Azure Emulator 197 | ecf/ 198 | rcf/ 199 | 200 | # Windows Store app package directories and files 201 | AppPackages/ 202 | BundleArtifacts/ 203 | Package.StoreAssociation.xml 204 | _pkginfo.txt 205 | *.appx 206 | 207 | # Visual Studio cache files 208 | # files ending in .cache can be ignored 209 | *.[Cc]ache 210 | # but keep track of directories ending in .cache 211 | !*.[Cc]ache/ 212 | 213 | # Others 214 | ClientBin/ 215 | ~$* 216 | *~ 217 | *.dbmdl 218 | *.dbproj.schemaview 219 | *.jfm 220 | *.pfx 221 | *.publishsettings 222 | orleans.codegen.cs 223 | 224 | # Including strong name files can present a security risk 225 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 226 | #*.snk 227 | 228 | # Since there are multiple workflows, uncomment next line to ignore bower_components 229 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 230 | #bower_components/ 231 | 232 | # RIA/Silverlight projects 233 | Generated_Code/ 234 | 235 | # Backup & report files from converting an old project file 236 | # to a newer Visual Studio version. Backup files are not needed, 237 | # because we have git ;-) 238 | _UpgradeReport_Files/ 239 | Backup*/ 240 | UpgradeLog*.XML 241 | UpgradeLog*.htm 242 | ServiceFabricBackup/ 243 | *.rptproj.bak 244 | 245 | # SQL Server files 246 | *.mdf 247 | *.ldf 248 | *.ndf 249 | 250 | # Business Intelligence projects 251 | *.rdl.data 252 | *.bim.layout 253 | *.bim_*.settings 254 | *.rptproj.rsuser 255 | 256 | # Microsoft Fakes 257 | FakesAssemblies/ 258 | 259 | # GhostDoc plugin setting file 260 | *.GhostDoc.xml 261 | 262 | # Node.js Tools for Visual Studio 263 | .ntvs_analysis.dat 264 | node_modules/ 265 | 266 | # Visual Studio 6 build log 267 | *.plg 268 | 269 | # Visual Studio 6 workspace options file 270 | *.opt 271 | 272 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 273 | *.vbw 274 | 275 | # Visual Studio LightSwitch build output 276 | **/*.HTMLClient/GeneratedArtifacts 277 | **/*.DesktopClient/GeneratedArtifacts 278 | **/*.DesktopClient/ModelManifest.xml 279 | **/*.Server/GeneratedArtifacts 280 | **/*.Server/ModelManifest.xml 281 | _Pvt_Extensions 282 | 283 | # Paket dependency manager 284 | .paket/paket.exe 285 | paket-files/ 286 | 287 | # FAKE - F# Make 288 | .fake/ 289 | 290 | # JetBrains Rider 291 | .idea/ 292 | *.sln.iml 293 | 294 | # CodeRush 295 | .cr/ 296 | 297 | # Python Tools for Visual Studio (PTVS) 298 | __pycache__/ 299 | *.pyc 300 | 301 | # Cake - Uncomment if you are using it 302 | # tools/** 303 | # !tools/packages.config 304 | 305 | # Tabs Studio 306 | *.tss 307 | 308 | # Telerik's JustMock configuration file 309 | *.jmconfig 310 | 311 | # BizTalk build output 312 | *.btp.cs 313 | *.btm.cs 314 | *.odx.cs 315 | *.xsd.cs 316 | 317 | # OpenCover UI analysis results 318 | OpenCover/ 319 | 320 | # Azure Stream Analytics local run output 321 | ASALocalRun/ 322 | 323 | # MSBuild Binary and Structured Log 324 | *.binlog 325 | 326 | # NVidia Nsight GPU debugger configuration file 327 | *.nvuser 328 | 329 | # MFractors (Xamarin productivity tool) working folder 330 | .mfractor/ 331 | -------------------------------------------------------------------------------- /src/Yoyo.Abp.Wechat.TenPay/YoyoAbpWechatTenPayExtensions.cs: -------------------------------------------------------------------------------- 1 | using Senparc.CO2NET.RegisterServices; 2 | using Senparc.Weixin.Entities; 3 | using Senparc.Weixin.TenPay; 4 | using Senparc.Weixin.TenPay.V2; 5 | using Senparc.Weixin.TenPay.V3; 6 | using System; 7 | using System.Collections.Generic; 8 | using System.Text; 9 | using Yoyo.Abp.V2; 10 | using Yoyo.Abp.V3; 11 | 12 | namespace Yoyo.Abp 13 | { 14 | /// 15 | /// YoYo Soft 对 Senparc.Weixin.TenPay 的扩展 16 | /// 17 | public static class YoyoAbpWechatTenPayExtensions 18 | { 19 | /// 20 | /// 注册微信支付Tenpay(注意:新注册账号请使用 UseYoYoSenparcTenpayV3! 21 | /// 22 | /// RegisterService 23 | /// 微信支付(旧版本)参数 24 | /// 公众号唯一标识名称 25 | /// 26 | /// 27 | /// 28 | public static IRegisterService UseYoYoSenparcTenpayV2(this IRegisterService registerService, Func tenPayInfo, string name, UserKeyType userId = default(UserKeyType), TenantKeyType tenantId = default(TenantKeyType)) 29 | { 30 | RegisterInfoCollection.Register(userId, tenantId, tenPayInfo().PartnerId); 31 | return registerService.RegisterTenpayOld(tenPayInfo, name); 32 | } 33 | /// 34 | /// 注册微信支付Tenpay(注意:新注册账号请使用 UseYoYoSenparcTenpayV3! 35 | /// 36 | /// RegisterService 37 | /// 微信支付(旧版本)参数 38 | /// 公众号唯一标识名称 39 | /// 40 | /// 41 | /// 42 | public static IRegisterService UseYoYoSenparcTenpayV2(this IRegisterService registerService, Func tenPayInfo, string name, long userId, long tenantId) 43 | { 44 | RegisterInfoCollection.Register(userId, tenantId, tenPayInfo().PartnerId); 45 | return registerService.RegisterTenpayOld(tenPayInfo, name); 46 | } 47 | 48 | 49 | /// 50 | /// 根据 SenparcWeixinSetting 自动注册微信支付Tenpay(注意:新注册账号请使用 UseYoYoSenparcTenpayV3!) 51 | /// 52 | /// RegisterService 53 | /// ISenparcWeixinSetting 54 | /// 统一标识,如果为null,则使用 weixinSettingForOldTepay.ItemKey 55 | /// 56 | /// 57 | /// 58 | public static IRegisterService UseYoYoSenparcTenpayV2(this IRegisterService registerService, ISenparcWeixinSettingForOldTenpay weixinSettingForOldTepay, string name, UserKeyType userId = default(UserKeyType), TenantKeyType tenantId = default(TenantKeyType)) 59 | { 60 | RegisterInfoCollection.Register(userId, tenantId, weixinSettingForOldTepay.WeixinPay_PartnerId); 61 | return registerService.RegisterTenpayOld(weixinSettingForOldTepay, name ?? weixinSettingForOldTepay.ItemKey); 62 | } 63 | /// 64 | /// 根据 SenparcWeixinSetting 自动注册微信支付Tenpay(注意:新注册账号请使用 UseYoYoSenparcTenpayV3!) 65 | /// 66 | /// RegisterService 67 | /// ISenparcWeixinSetting 68 | /// 统一标识,如果为null,则使用 weixinSettingForOldTepay.ItemKey 69 | /// 70 | /// 71 | /// 72 | public static IRegisterService UseYoYoSenparcTenpayV2(this IRegisterService registerService, ISenparcWeixinSettingForOldTenpay weixinSettingForOldTepay, string name, long userId, long tenantId) 73 | { 74 | RegisterInfoCollection.Register(userId, tenantId, weixinSettingForOldTepay.WeixinPay_PartnerId); 75 | return registerService.RegisterTenpayOld(weixinSettingForOldTepay, name ?? weixinSettingForOldTepay.ItemKey); 76 | } 77 | 78 | 79 | /// 80 | /// 注册微信支付TenpayV3 81 | /// 82 | /// RegisterService 83 | /// 微信支付(新版本 V3)参数 84 | /// 公众号唯一标识名称 85 | /// 86 | /// 87 | /// 88 | public static IRegisterService UseYoYoSenparcTenpayV3(this IRegisterService registerService, Func tenPayV3Info, string name, UserKeyType userId = default(UserKeyType), TenantKeyType tenantId = default(TenantKeyType)) 89 | { 90 | RegisterV3InfoCollection.Register(userId, tenantId, tenPayV3Info().MchId); 91 | return registerService.RegisterTenpayV3(tenPayV3Info, name); 92 | } 93 | /// 94 | /// 注册微信支付TenpayV3 95 | /// 96 | /// RegisterService 97 | /// 微信支付(新版本 V3)参数 98 | /// 公众号唯一标识名称 99 | /// 100 | /// 101 | /// 102 | public static IRegisterService UseYoYoSenparcTenpayV3(this IRegisterService registerService, Func tenPayV3Info, string name, long userId, long tenantId) 103 | { 104 | RegisterV3InfoCollection.Register(userId, tenantId, tenPayV3Info().MchId); 105 | return registerService.RegisterTenpayV3(tenPayV3Info, name); 106 | } 107 | 108 | /// 109 | /// 根据 SenparcWeixinSetting 自动注册微信支付Tenpay(注意:新注册账号请使用 UseYoYoSenparcTenpayV3! 110 | /// 111 | /// RegisterService 112 | /// ISenparcWeixinSetting 113 | /// 统一标识,如果为null,则使用 SenparcWeixinSetting.ItemKey 114 | /// 115 | /// 116 | /// 117 | public static IRegisterService UseYoYoSenparcTenpayV3(this IRegisterService registerService, ISenparcWeixinSettingForTenpayV3 weixinSettingForTenpayV3, string name, UserKeyType userId = default(UserKeyType), TenantKeyType tenantId = default(TenantKeyType)) 118 | { 119 | RegisterV3InfoCollection.Register(userId, tenantId, weixinSettingForTenpayV3.TenPayV3_MchId); 120 | return registerService.RegisterTenpayV3(weixinSettingForTenpayV3, name); 121 | } 122 | /// 123 | /// 根据 SenparcWeixinSetting 自动注册微信支付Tenpay(注意:新注册账号请使用 UseYoYoSenparcTenpayV3! 124 | /// 125 | /// RegisterService 126 | /// ISenparcWeixinSetting 127 | /// 统一标识,如果为null,则使用 SenparcWeixinSetting.ItemKey 128 | /// 129 | /// 130 | /// 131 | public static IRegisterService UseYoYoSenparcTenpayV3(this IRegisterService registerService, ISenparcWeixinSettingForTenpayV3 weixinSettingForTenpayV3, string name, long userId, long tenantId) 132 | { 133 | RegisterV3InfoCollection.Register(userId, tenantId, weixinSettingForTenpayV3.TenPayV3_MchId); 134 | return registerService.RegisterTenpayV3(weixinSettingForTenpayV3, name); 135 | } 136 | 137 | } 138 | } 139 | -------------------------------------------------------------------------------- /src/Yoyo.Abp.Wechat.MP/Containers/MpInfoContainer.cs: -------------------------------------------------------------------------------- 1 | using Senparc.Weixin.Containers; 2 | using Senparc.Weixin.Exceptions; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace Yoyo.Abp.Containers 10 | { 11 | /// 12 | /// 公众号信息Container 13 | /// 14 | /// 用户唯一Id类型 15 | /// 租户唯一Id类型 16 | public class MpInfoContainer : BaseContainer 17 | { 18 | /// 19 | /// 存储注册列表的KEY 20 | /// 21 | private const string REGIEST_LIST = "MP_REGIEST_LIST"; 22 | 23 | /// 24 | /// 注册公众号信息 25 | /// 26 | /// 获取公众号信息Key 27 | /// 公众号AppId 28 | /// 公众号AppSecret 29 | /// 公众号Token 30 | /// 公众号EncodingAESKey 31 | /// 公众号名称 32 | /// 用户Id 33 | /// 租户Id 34 | public static void Register(string key, string appId, string appSecret, string token, string encodingAESKey, string name = null, UserKeyType userId = default(UserKeyType), TenantKeyType tenantId = default(TenantKeyType)) 35 | { 36 | var task = RegisterAsync(key, appId, appSecret, token, encodingAESKey, name, userId, tenantId); 37 | Task.WaitAll(new[] { task }, 10000); 38 | } 39 | 40 | /// 41 | /// 注册公众号信息 42 | /// 43 | /// 获取公众号信息Key 44 | /// 公众号AppId 45 | /// 公众号AppSecret 46 | /// 公众号Token 47 | /// 公众号EncodingAESKey 48 | /// 公众号名称 49 | /// 用户Id 50 | /// 租户Id 51 | public static async Task RegisterAsync(string key, string appId, string appSecret, string token, string encodingAESKey, string name = null, UserKeyType userId = default(UserKeyType), TenantKeyType tenantId = default(TenantKeyType)) 52 | { 53 | //记录注册信息,RegisterFunc委托内的过程会在缓存丢失之后自动重试 54 | 55 | RegisterFuncCollection[key] = async () => 56 | { 57 | //using (FlushCache.CreateInstance()) 58 | //{ 59 | var bag = new MpInfoBag() 60 | { 61 | Key = key, 62 | Name = name, 63 | AppId = appId, 64 | AppSecret= appSecret, 65 | Token = token, 66 | EncodingAESKey = encodingAESKey, 67 | }; 68 | await UpdateAsync(key, bag, null).ConfigureAwait(false);//第一次添加,此处已经立即更新 69 | return bag; 70 | //} 71 | }; 72 | var registerTask = RegisterFuncCollection[key](); 73 | 74 | var updateRegiestListTask = UpdateRegiestList(key, userId, tenantId); 75 | await Task.WhenAll(new[] { registerTask, updateRegiestListTask });//等待所有任务完成 76 | } 77 | 78 | /// 79 | /// 获取指定公众号信息 80 | /// 81 | /// 82 | /// 83 | public static MpInfoBag TryGetMpInfo(string key) 84 | { 85 | if (!CheckRegistered(key)) 86 | { 87 | throw new UnRegisterAppIdException(key, string.Format("此appId尚未注册,WechatTokenContainer.Register完成注册(全局执行一次即可)!")); 88 | } 89 | 90 | var mpInfoBag = TryGetItem(key); 91 | 92 | return mpInfoBag; 93 | } 94 | 95 | /// 96 | /// 获取所有注册信息 97 | /// 98 | /// 用户Id 99 | /// 租户Id 100 | /// 101 | public static IDictionary GetAll(UserKeyType userId, TenantKeyType tenantId) 102 | { 103 | var registerList = Cache.Get>>(REGIEST_LIST) 104 | .Where(info => info.UserId.Equals(userId) && info.TenantId.Equals(tenantId)) 105 | .Select(info => info.Key) 106 | .ToList(); 107 | IDictionary dic = new Dictionary(); 108 | foreach (var key in registerList) 109 | { 110 | dic.Add(key, TryGetItem(key)); 111 | } 112 | return dic; 113 | } 114 | 115 | /// 116 | /// 从缓存中删除指定项 117 | /// 118 | /// 获取公众号信息Key 119 | /// 用户Id 120 | /// 租户Id 121 | public static void RemoveFromCache(string shortKey, UserKeyType userId, TenantKeyType tenantId) 122 | { 123 | Cache.RemoveFromCache(shortKey); 124 | var registerList = Cache.Get>>(REGIEST_LIST) 125 | .Where(info => info.UserId.Equals(userId) && info.TenantId.Equals(tenantId)).ToList(); 126 | registerList.Remove(registerList.FirstOrDefault(info => info.Key == shortKey)); 127 | Cache.Update(REGIEST_LIST, registerList); 128 | } 129 | 130 | /// 131 | /// 从缓存中删除指定项 132 | /// 133 | /// 获取公众号信息Key 134 | public static new void RemoveFromCache(string shortKey) 135 | { 136 | RemoveFromCache(shortKey, default(UserKeyType), default(TenantKeyType)); 137 | } 138 | 139 | private static async Task UpdateRegiestList(string key, UserKeyType userId, TenantKeyType tenantId) 140 | { 141 | if (Cache.CheckExisted(REGIEST_LIST, true)) 142 | { 143 | var registerList = Cache.Get>>(REGIEST_LIST); 144 | registerList.Add(new KeyInfo { Key = key, UserId = userId,TenantId = tenantId }); 145 | await Cache.UpdateAsync(REGIEST_LIST, registerList); 146 | } 147 | else 148 | { 149 | var registerList = new List>(); 150 | registerList.Add(new KeyInfo { Key = key, UserId = userId, TenantId = tenantId }); 151 | await Cache.SetAsync(REGIEST_LIST, registerList); 152 | } 153 | } 154 | } 155 | 156 | /// 157 | /// 公众号信息Container 158 | /// 159 | public class MpInfoContainer: MpInfoContainer 160 | { 161 | 162 | } 163 | 164 | /// 165 | /// 公众号信息Bag 166 | /// 167 | public class MpInfoBag: BaseContainerBag, IBaseContainerBag_AppId 168 | { 169 | /// 170 | /// AppId 171 | /// 172 | public string AppId { get; set; } 173 | 174 | /// 175 | /// AppSecret 176 | /// 177 | public string AppSecret { get; set; } 178 | 179 | /// 180 | /// Token 181 | /// 182 | public string Token { get; set; } 183 | 184 | /// 185 | /// EncodingAESKey 186 | /// 187 | public string EncodingAESKey { get; set; } 188 | } 189 | 190 | class KeyInfo 191 | { 192 | public string Key { get; set; } 193 | 194 | public UserKeyType UserId { get; set; } 195 | 196 | public TenantKeyType TenantId { get; set; } 197 | } 198 | } 199 | -------------------------------------------------------------------------------- /src/Yoyo.Abp.Wechat/YoyoAbpWechatExtensions.cs: -------------------------------------------------------------------------------- 1 | 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | using Senparc.CO2NET.RegisterServices; 6 | using Senparc.CO2NET; 7 | using Microsoft.Extensions.Configuration; 8 | using Microsoft.Extensions.DependencyInjection; 9 | using Senparc.Weixin.Entities; 10 | using Senparc.CO2NET.Cache; 11 | using Microsoft.AspNetCore.Builder; 12 | using Senparc.Weixin.Cache.Redis; 13 | using Senparc.Weixin; 14 | 15 | namespace Yoyo.Abp 16 | { 17 | /// 18 | /// YoYo Soft 对 Senparc.Weixin、CO2NET、Redis 的扩展 19 | /// 20 | public static class YoyoAbpWechatExtensions 21 | { 22 | 23 | #region 写在 Startup.cs ConfigureServices 函数中 24 | 25 | 26 | /// 27 | /// 添加YoYo Senparc CO2NET和Weixin 28 | /// 29 | /// 30 | /// 31 | /// 32 | public static IServiceCollection AddYoYoSenparc(this IServiceCollection serviceCollection, IConfiguration configuration) 33 | { 34 | return serviceCollection.AddYoYoSenparcCo2Net(configuration) 35 | .AddYoYoSenparcWeixin(configuration); 36 | } 37 | 38 | 39 | /// 40 | /// 添加YoYo Senparc CO2NET 41 | /// 42 | /// 43 | /// 44 | /// 45 | public static IServiceCollection AddYoYoSenparcCo2Net(this IServiceCollection serviceCollection, IConfiguration configuration) 46 | { 47 | SenparcDI.GlobalServiceCollection = serviceCollection; 48 | 49 | serviceCollection.Configure(configuration.GetSection("SenparcSetting")); 50 | 51 | /* 52 | * appsettings.json 中添加节点: 53 | //CO2NET 设置 54 | "SenparcSetting": { 55 | "IsDebug": true, 56 | "DefaultCacheNamespace": "DefaultCache" 57 | }, 58 | */ 59 | 60 | return serviceCollection; 61 | } 62 | 63 | /// 64 | /// 添加YoYo Senparc Weixin 65 | /// 66 | /// 67 | /// 68 | /// 69 | public static IServiceCollection AddYoYoSenparcWeixin(this IServiceCollection serviceCollection, IConfiguration configuration) 70 | { 71 | serviceCollection.Configure(configuration.GetSection("SenparcWeixinSetting")); 72 | 73 | /* 74 | * appsettings.json 中添加节点: 75 | //Senparc.Weixin SDK 设置 76 | //Senparc.Weixin SDK 设置 77 | "SenparcWeixinSetting": { 78 | //微信全局 79 | "IsDebug": true, 80 | //公众号 81 | "Token": "weixin", 82 | "EncodingAESKey": "", 83 | "WeixinAppId": "WeixinAppId", 84 | "WeixinAppSecret": "WeixinAppSecret", 85 | //小程序 86 | "WxOpenAppId": "WxOpenAppId", 87 | "WxOpenAppSecret": "WxOpenAppSecret", 88 | //企业微信 89 | "WeixinCorpId": "WeixinCorpId", 90 | "WeixinCorpSecret": "WeixinCorpSecret", 91 | 92 | //微信支付 93 | //微信支付V2(旧版) 94 | "WeixinPay_PartnerId": "WeixinPay_PartnerId", 95 | "WeixinPay_Key": "WeixinPay_Key", 96 | "WeixinPay_AppId": "WeixinPay_AppId", 97 | "WeixinPay_AppKey": "WeixinPay_AppKey", 98 | "WeixinPay_TenpayNotify": "WeixinPay_TenpayNotify", 99 | //微信支付V3(新版) 100 | "TenPayV3_MchId": "TenPayV3_MchId", 101 | "TenPayV3_Key": "TenPayV3_Key", 102 | "TenPayV3_AppId": "TenPayV3_AppId", 103 | "TenPayV3_AppSecret": "TenPayV3_AppId", 104 | "TenPayV3_TenpayNotify": "TenPayV3_TenpayNotify", 105 | 106 | //开放平台 107 | "Component_Appid": "Component_Appid", 108 | "Component_Secret": "Component_Secret", 109 | "Component_Token": "Component_Token", 110 | "Component_EncodingAESKey": "Component_EncodingAESKey", 111 | 112 | //分布式缓存 113 | //"Cache_Redis_Configuration": "localhost:6379", 114 | "Cache_Memcached_Configuration": "Memcached配置" 115 | } 116 | */ 117 | 118 | return serviceCollection; 119 | } 120 | 121 | 122 | #endregion 123 | 124 | 125 | 126 | #region 写在 Startup.cs Configure 函数中 127 | 128 | /// 129 | /// 开始YoYo Senparc.CO2NET SDK 初始化参数流程 130 | /// 131 | /// (关于 UseYoYoSenparc() 的更多用法见 CO2NET Demo 中的 UseSenparcGlobal:https://github.com/Senparc/Senparc.CO2NET/blob/master/Sample/Senparc.CO2NET.Sample.netcore/Startup.cs) 132 | /// 133 | /// 134 | /// 提供网站根目录(env.ContentRootPath,env类型为IHostingEnvironment) 135 | /// 是否自动扫描全局的扩展缓存(会增加系统启动时间) 136 | /// 137 | /// 需要手动注册的扩展缓存策略 138 | /// (LocalContainerCacheStrategy、RedisContainerCacheStrategy、MemcacheContainerCacheStrategy已经自动注册), 139 | /// 如果设置为 null(注意:不是委托返回 null,是整个委托参数为 null),则自动使用反射扫描所有可能存在的扩展缓存策略 140 | /// 141 | /// 142 | public static IRegisterService UseYoYoSenparcCO2NET( 143 | this SenparcSetting senparcSetting, 144 | string contentRootPath = "", 145 | bool autoScanExtensionCacheStrategies = false, 146 | Func> extensionCacheStrategiesFunc = null) 147 | { 148 | var registerService = YoyoAbpWechatRegisterService.Start(senparcSetting, contentRootPath); 149 | 150 | CacheStrategyDomainWarehouse.AutoScanDomainCacheStrategy(autoScanExtensionCacheStrategies, extensionCacheStrategiesFunc); 151 | 152 | return registerService; 153 | } 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | /// 163 | /// YoYo Senparc CO2NET 全局缓存配置(按需) 164 | /// 165 | /// 166 | /// 167 | /// 168 | /// 当同一个分布式缓存同时服务于多个网站(应用程序池)时,可以使用命名空间将其隔离(非必须) 169 | /// 配置全局使用Redis缓存(按需,独立),此函数返回结果为true将启用redis 170 | /// 171 | public static IRegisterService UseYoYoSenparcCO2NETGlobalCache( 172 | this IRegisterService registerService, 173 | IApplicationBuilder applicationBuilder, 174 | SenparcSetting senparcSetting, 175 | string customCacheNamespace = null, 176 | Func configRedisAction = null) 177 | { 178 | // 全局缓存配置(按需) 179 | if (!string.IsNullOrWhiteSpace(customCacheNamespace)) 180 | { 181 | // 当同一个分布式缓存同时服务于多个网站(应用程序池)时,可以使用命名空间将其隔离(非必须) 182 | registerService.ChangeDefaultCacheNamespace(customCacheNamespace); 183 | } 184 | 185 | 186 | // 配置全局使用Redis缓存 187 | if (configRedisAction == null) 188 | { 189 | return registerService; 190 | } 191 | 192 | // 回调函数,返回true表示使用redis 193 | if (configRedisAction(senparcSetting)) 194 | { 195 | applicationBuilder.UseSenparcWeixinCacheRedis(); 196 | } 197 | 198 | return registerService; 199 | } 200 | 201 | 202 | /// 203 | /// YoYo Senparc CO2NET 跟踪日志 204 | /// 205 | /// 206 | /// 207 | /// 208 | public static IRegisterService UseYoYoSenparcCO2NETTraceLog(this IRegisterService registerService, Action action) 209 | { 210 | action(); 211 | return registerService; 212 | } 213 | 214 | 215 | /// 216 | /// 开始 Senparc.Weixin SDK 初始化参数流程 217 | /// 218 | /// 219 | /// 微信全局设置参数,必填 220 | /// 用于提供 SenparcSetting.Cache_Redis_Configuration 和 Cache_Memcached_Configuration 两个参数,如果不使用这两种分布式缓存可传入null 221 | /// 222 | public static IRegisterService UseYoYoSenparcWeixin( 223 | this IRegisterService registerService, 224 | SenparcWeixinSetting senparcWeixinSetting, 225 | SenparcSetting senparcSetting = null) 226 | { 227 | return registerService.UseSenparcWeixin(senparcWeixinSetting, senparcSetting); 228 | } 229 | 230 | #endregion 231 | 232 | 233 | } 234 | } -------------------------------------------------------------------------------- /src/Yoyo.Abp.Wechat.TenPay/Yoyo.Abp.Wechat.TenPay.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Yoyo.Abp.Wechat.TenPay 5 | 6 | 7 | 8 | 9 | V2微信支付注册 10 | 11 | 12 | 13 | 14 | 手动注册微信支付(V2) 15 | 16 | 17 | 18 | ()=>new TenPayInfo() 19 | 20 | 21 | 22 | 23 | V2微信支付注册 24 | 25 | 26 | 27 | 28 | 用户注册微信支付(V2)InfoCollection 29 | 30 | 用户主键类型 31 | 租户主键类型 32 | 33 | 34 | 35 | 注册 36 | 37 | 38 | 39 | 商户Id 40 | 41 | 42 | 43 | 用户注册微信支付(V2)InfoCollection 44 | 45 | 46 | 47 | 48 | V3微信支付注册 49 | 50 | 51 | 52 | 53 | 手动注册微信支付(V3) 54 | 55 | 56 | 57 | ()=>new TenPayV3Info() 58 | 59 | 60 | 61 | 62 | 用户注册微信支付(V3)InfoCollection 63 | 64 | 用户主键类型 65 | 租户主键类型 66 | 67 | 68 | 69 | 注册 70 | 71 | 72 | 73 | 商户Id 74 | 75 | 76 | 77 | 用户注册微信支付(V3)InfoCollection 78 | 79 | 80 | 81 | 82 | YoYo Soft 对 Senparc.Weixin.TenPay 的扩展 83 | 84 | 85 | 86 | 87 | 注册微信支付Tenpay(注意:新注册账号请使用 UseYoYoSenparcTenpayV3! 88 | 89 | RegisterService 90 | 微信支付(旧版本)参数 91 | 公众号唯一标识名称 92 | 93 | 94 | 95 | 96 | 97 | 98 | 注册微信支付Tenpay(注意:新注册账号请使用 UseYoYoSenparcTenpayV3! 99 | 100 | RegisterService 101 | 微信支付(旧版本)参数 102 | 公众号唯一标识名称 103 | 104 | 105 | 106 | 107 | 108 | 109 | 根据 SenparcWeixinSetting 自动注册微信支付Tenpay(注意:新注册账号请使用 UseYoYoSenparcTenpayV3!) 110 | 111 | RegisterService 112 | ISenparcWeixinSetting 113 | 统一标识,如果为null,则使用 weixinSettingForOldTepay.ItemKey 114 | 115 | 116 | 117 | 118 | 119 | 120 | 根据 SenparcWeixinSetting 自动注册微信支付Tenpay(注意:新注册账号请使用 UseYoYoSenparcTenpayV3!) 121 | 122 | RegisterService 123 | ISenparcWeixinSetting 124 | 统一标识,如果为null,则使用 weixinSettingForOldTepay.ItemKey 125 | 126 | 127 | 128 | 129 | 130 | 131 | 注册微信支付TenpayV3 132 | 133 | RegisterService 134 | 微信支付(新版本 V3)参数 135 | 公众号唯一标识名称 136 | 137 | 138 | 139 | 140 | 141 | 142 | 注册微信支付TenpayV3 143 | 144 | RegisterService 145 | 微信支付(新版本 V3)参数 146 | 公众号唯一标识名称 147 | 148 | 149 | 150 | 151 | 152 | 153 | 根据 SenparcWeixinSetting 自动注册微信支付Tenpay(注意:新注册账号请使用 UseYoYoSenparcTenpayV3! 154 | 155 | RegisterService 156 | ISenparcWeixinSetting 157 | 统一标识,如果为null,则使用 SenparcWeixinSetting.ItemKey 158 | 159 | 160 | 161 | 162 | 163 | 164 | 根据 SenparcWeixinSetting 自动注册微信支付Tenpay(注意:新注册账号请使用 UseYoYoSenparcTenpayV3! 165 | 166 | RegisterService 167 | ISenparcWeixinSetting 168 | 统一标识,如果为null,则使用 SenparcWeixinSetting.ItemKey 169 | 170 | 171 | 172 | 173 | 174 | 175 | YoYo Soft Senparc.WeiXin.TenPay Module 176 | 177 | 178 | 179 | 180 | -------------------------------------------------------------------------------- /src/Yoyo.Abp.Wechat.MP/Yoyo.Abp.Wechat.MP.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Yoyo.Abp.Wechat.MP 5 | 6 | 7 | 8 | 9 | 公众号信息Container 10 | 11 | 用户唯一Id类型 12 | 租户唯一Id类型 13 | 14 | 15 | 16 | 存储注册列表的KEY 17 | 18 | 19 | 20 | 21 | 注册公众号信息 22 | 23 | 获取公众号信息Key 24 | 公众号AppId 25 | 公众号AppSecret 26 | 公众号Token 27 | 公众号EncodingAESKey 28 | 公众号名称 29 | 用户Id 30 | 租户Id 31 | 32 | 33 | 34 | 获取指定公众号信息 35 | 36 | 37 | 38 | 39 | 40 | 41 | 获取所有注册信息 42 | 43 | 用户Id 44 | 租户Id 45 | 46 | 47 | 48 | 49 | 从缓存中删除指定项 50 | 51 | 获取公众号信息Key 52 | 用户Id 53 | 租户Id 54 | 55 | 56 | 57 | 从缓存中删除指定项 58 | 59 | 获取公众号信息Key 60 | 61 | 62 | 63 | 公众号信息Container 64 | 65 | 66 | 67 | 68 | 公众号信息Bag 69 | 70 | 71 | 72 | 73 | AppId 74 | 75 | 76 | 77 | 78 | AppSecret 79 | 80 | 81 | 82 | 83 | Token 84 | 85 | 86 | 87 | 88 | EncodingAESKey 89 | 90 | 91 | 92 | 93 | 公众号操作 94 | 95 | 96 | 97 | 98 | 注册公众号 99 | 100 | 用户唯一Id类型 101 | 租户唯一Id类型 102 | 获取公众号信息Key 103 | 公众号AppId 104 | 公众号AppSecret 105 | 公众号Token 106 | 公众号EncodingAESKey 107 | 公众号名称 108 | 用户Id 109 | 租户Id 110 | 111 | 112 | 113 | 注册公众号 114 | 115 | 获取公众号信息Key 116 | 公众号AppId 117 | 公众号AppSecret 118 | 公众号Token 119 | 公众号EncodingAESKey 120 | 公众号名称 121 | 用户Id 122 | 租户Id 123 | 124 | 125 | 126 | 获取AccessToken 127 | 128 | 公众号AppId 129 | 是否强制重新获取新的Token 130 | 131 | 132 | 133 | 134 | 获取AccessToken(异步) 135 | 136 | 公众号AppId 137 | 是否强制重新获取新的Token 138 | 139 | 140 | 141 | 142 | 获取可用JsApiTicket 143 | 144 | 公众号AppId 145 | 是否强制重新获取新的Ticket 146 | 147 | 148 | 149 | 150 | 获取可用JsApiTicket(异步) 151 | 152 | 公众号AppId 153 | 是否强制重新获取新的Ticket 154 | 155 | 156 | 157 | 158 | 获取可用CardApiTicket 159 | 160 | 公众号AppId 161 | 是否强制重新获取新的Ticket 162 | 163 | 164 | 165 | 166 | 获取可用CardApiTicket(异步) 167 | 168 | 公众号AppId 169 | 是否强制重新获取新的Ticket 170 | 171 | 172 | 173 | 174 | YoYo Soft 对 Senparc.Weixin.MP 的扩展 175 | 176 | 177 | 178 | 179 | 注册公众号(或小程序)信息 180 | 181 | 用户唯一Id类型 182 | 租户唯一Id类型 183 | RegisterService 184 | 微信公众号后台的【开发】>【基本配置】中的“AppID(应用ID)” 185 | 微信公众号后台的【开发】>【基本配置】中的“AppSecret(应用密钥)” 186 | 标记AccessToken名称(如微信公众号名称),帮助管理员识别 187 | token 188 | encodingAESKey 189 | 获取公众号信息Key 190 | 用户Id 191 | 租户Id 192 | 193 | 194 | 195 | 196 | 注册公众号(或小程序)信息 197 | 198 | RegisterService 199 | 微信公众号后台的【开发】>【基本配置】中的“AppID(应用ID)” 200 | 微信公众号后台的【开发】>【基本配置】中的“AppSecret(应用密钥)” 201 | 标记AccessToken名称(如微信公众号名称),帮助管理员识别 202 | token 203 | encodingAESKey 204 | 获取公众号信息Key 205 | 用户Id 206 | 租户Id 207 | 208 | 209 | 210 | 211 | 根据 SenparcWeixinSetting 自动注册公众号信息(包括JsApi) 212 | 213 | RegisterService 214 | SenparcWeixinSetting 215 | token 216 | encodingAESKey 217 | 获取公众号信息Key 218 | 统一标识,如果为null,则使用 weixinSettingForMP.ItemKey 219 | 用户Id 220 | 租户Id 221 | 222 | 223 | 224 | 225 | 根据 SenparcWeixinSetting 自动注册公众号信息(包括JsApi) 226 | 227 | RegisterService 228 | SenparcWeixinSetting 229 | token 230 | encodingAESKey 231 | 获取公众号信息Key 232 | 统一标识,如果为null,则使用 weixinSettingForMP.ItemKey 233 | 用户Id 234 | 租户Id 235 | 236 | 237 | 238 | 239 | 注册公众号(或小程序)的JSApi(RegisterMpAccount注册过程中已包含) 240 | 241 | RegisterService 242 | 微信公众号后台的【开发】>【基本配置】中的“AppID(应用ID)” 243 | 微信公众号后台的【开发】>【基本配置】中的“AppSecret(应用密钥)” 244 | 标记AccessToken名称(如微信公众号名称),帮助管理员识别 245 | 246 | 247 | 248 | 249 | YoYo Soft Senparc.WeiXin.MP Module 250 | 251 | 252 | 253 | 254 | -------------------------------------------------------------------------------- /src/Yoyo.Abp.Alipay/DefatultAlipayHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Drawing; 4 | using System.Drawing.Imaging; 5 | using System.IO; 6 | using System.Threading.Tasks; 7 | using Abp.Extensions; 8 | using Alipay.AopSdk.AspnetCore; 9 | using Alipay.AopSdk.Core.Domain; 10 | using Alipay.AopSdk.Core.Request; 11 | using Alipay.AopSdk.Core.Response; 12 | using Alipay.AopSdk.F2FPay.Business; 13 | using Alipay.AopSdk.F2FPay.Domain; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.Extensions.Options; 16 | using QRCoder; 17 | using Yoyo.Abp.FTF; 18 | using Yoyo.Abp.Other; 19 | using Yoyo.Abp.WapPay; 20 | using Yoyo.Abp.WebPay; 21 | using F2FResultEnum = Alipay.AopSdk.F2FPay.Model.ResultEnum; 22 | 23 | namespace Yoyo.Abp 24 | { 25 | /// 26 | /// 支付宝支付默认实现 27 | /// 28 | public class DefatultAlipayHelper : IAlipayHelper 29 | { 30 | private readonly AlipayF2FService _alipayF2FService; 31 | private readonly AlipayService _alipayService; 32 | private readonly FTFConfig _fTFConfig; 33 | 34 | public DefatultAlipayHelper( 35 | AlipayF2FService alipayF2FService, 36 | AlipayService alipayService, 37 | IOptions fTFConfigOptions 38 | ) 39 | { 40 | _alipayF2FService = alipayF2FService; 41 | _alipayService = alipayService; 42 | _fTFConfig = fTFConfigOptions.Value; 43 | } 44 | 45 | 46 | #region 面对面支付 47 | 48 | 49 | /// 50 | /// 面对面支付(异步消息通知),返回生成的图片二维码byte数组 51 | /// 52 | /// 支付信息 53 | /// 异步消息通知地址 54 | /// 面对面支付配置信息(不填则使用全局配置的) 55 | /// 二维码图片字节数组 56 | public async Task FTFPay(AlipayTradePrecreateContentBuilder input, string asyncNotifyUrl, FTFConfig fTFConfig = null) 57 | { 58 | return await this.FTFGenQRCode(input, asyncNotifyUrl, null, fTFConfig); 59 | } 60 | 61 | /// 62 | /// 面对面支付(轮询),返回生成的图片二维码byte数组 63 | /// 64 | /// 支付信息 65 | /// 66 | /// 面对面支付配置信息(不填则使用全局配置的) 67 | /// 68 | public async Task FTFPay(AlipayTradePrecreateContentBuilder input, Action loopQueryAction, FTFConfig fTFConfig = null) 69 | { 70 | return await this.FTFGenQRCode(input, null, loopQueryAction, fTFConfig); 71 | } 72 | 73 | /// 74 | /// 面对面支付结果查询 75 | /// 76 | /// 77 | /// 78 | public async Task FTFQuery(string outTradeNo) 79 | { 80 | return await _alipayF2FService.TradeQueryAsync(outTradeNo); 81 | } 82 | 83 | #endregion 84 | 85 | 86 | #region PC Web 支付 87 | 88 | /// 89 | /// PC Web 支付,返回支付宝支付链接 90 | /// 91 | /// 支付信息和回调通知信息 92 | /// 支付选项,如果为空则使用添加时内置的 93 | /// 返回支付宝支付链接 94 | public async Task WebPay(WebPayInput input, AlipayOptions options = null) 95 | { 96 | await Task.Yield(); 97 | 98 | if (input.Data.ProductCode.IsNullOrWhiteSpace()) 99 | { 100 | input.Data.ProductCode = YoYoAlipayConsts.ProductCode_FAST_INSTANT_TRADE_PAY; 101 | } 102 | 103 | 104 | var request = new AlipayTradePagePayRequest(); 105 | 106 | // 设置同步回调地址 107 | request.SetReturnUrl(input.SynchronizationCallbackUrl); 108 | // 设置异步通知接收地址 109 | request.SetNotifyUrl(input.AsyncNotifyUrl); 110 | // 将业务model载入到request 111 | request.SetBizModel(input.Data); 112 | 113 | // 发起支付 114 | var response = this._alipayService.SdkExecute(request); 115 | 116 | // 返回回调地址 117 | var tmpOptions = options ?? _alipayService.Options; 118 | 119 | return new WebPayOutput() 120 | { 121 | Response = response, 122 | RedirectUrl = $"{tmpOptions.Gatewayurl}?{response.Body}" 123 | }; 124 | } 125 | 126 | #endregion 127 | 128 | 129 | #region Mobile WAP 支付 130 | 131 | public async Task WapPay(WapPayInput input, AlipayOptions options = null) 132 | { 133 | await Task.Yield(); 134 | 135 | // 设置产品代码 136 | if (input.Data.ProductCode.IsNullOrWhiteSpace()) 137 | { 138 | input.Data.ProductCode = YoYoAlipayConsts.ProductCode_QUICK_WAP_WAY; 139 | } 140 | // 设置支付中途退出返回商户网站地址 141 | if (input.Data.QuitUrl.IsNullOrWhiteSpace()) 142 | { 143 | input.Data.QuitUrl = input.QuitUrl; 144 | } 145 | 146 | var request = new AlipayTradeWapPayRequest(); 147 | // 设置同步回调地址 148 | request.SetReturnUrl(input.SynchronizationCallbackUrl); 149 | // 设置异步通知接收地址 150 | request.SetNotifyUrl(input.AsyncNotifyUrl); 151 | // 将业务model载入到request 152 | request.SetBizModel(input.Data); 153 | 154 | // 发起支付 155 | var response = await this._alipayService.PageExecuteAsync(request); 156 | 157 | return new WapPayOutput() 158 | { 159 | Response = response, 160 | Body = response.Body 161 | }; 162 | } 163 | 164 | #endregion 165 | 166 | #region 订单查询 167 | 168 | 169 | /// 170 | /// 订单查询 171 | /// 172 | /// 查询数据 173 | /// 174 | public async Task Query(OrderQueryInput input) 175 | { 176 | return await this.Query(input.Data); 177 | } 178 | 179 | /// 180 | /// 订单查询 181 | /// 182 | /// 查询数据 183 | /// 184 | public async Task Query(AlipayTradeQueryModel input) 185 | { 186 | var request = new AlipayTradeQueryRequest(); 187 | request.SetBizModel(input); 188 | 189 | var response = await _alipayService.ExecuteAsync(request); 190 | 191 | return response; 192 | } 193 | 194 | /// 195 | /// 订单查询 196 | /// 197 | /// 商户系统订单编码 198 | /// 支付宝订单编码 199 | /// 200 | public async Task Query(string tradeNo, string alipayTradeNo) 201 | { 202 | AlipayTradeQueryModel model = new AlipayTradeQueryModel 203 | { 204 | OutTradeNo = tradeNo, 205 | TradeNo = alipayTradeNo 206 | }; 207 | 208 | return await this.Query(model); 209 | } 210 | 211 | #endregion 212 | 213 | 214 | #region 订单退款 215 | 216 | /// 217 | /// 订单退款 218 | /// 219 | /// 退款数据 220 | /// 221 | public async Task Refund(RefundInput input) 222 | { 223 | return await this.Refund(input.Data); 224 | } 225 | 226 | /// 227 | /// 订单退款 228 | /// 229 | /// 退款数据 230 | /// 231 | public async Task Refund(AlipayTradeRefundModel input) 232 | { 233 | AlipayTradeRefundRequest request = new AlipayTradeRefundRequest(); 234 | request.SetBizModel(input); 235 | 236 | var response = await _alipayService.ExecuteAsync(request); 237 | 238 | return response; 239 | } 240 | 241 | /// 242 | /// 订单退款 243 | /// 244 | /// 商户订单号 245 | /// 支付宝交易号 246 | /// 退款金额 247 | /// 退款原因 248 | /// 退款单号 249 | /// 250 | public async Task Refund(string tradeno, string alipayTradeNo, string refundAmount, string refundReason, string refundNo) 251 | { 252 | var model = new AlipayTradeRefundModel(); 253 | model.OutTradeNo = tradeno; 254 | model.TradeNo = alipayTradeNo; 255 | model.RefundAmount = refundAmount; 256 | model.RefundReason = refundReason; 257 | model.OutRequestNo = refundNo; 258 | 259 | return await this.Refund(model); 260 | } 261 | 262 | #endregion 263 | 264 | 265 | #region 订单退款查询 266 | 267 | /// 268 | /// 订单退款查询 269 | /// 270 | /// 查询信息 271 | /// 272 | public async Task RefundQuery(RefundQueryInput input) 273 | { 274 | return await this.RefundQuery(input.Data); 275 | } 276 | 277 | /// 278 | /// 订单退款查询 279 | /// 280 | /// 查询信息 281 | /// 282 | public async Task RefundQuery(AlipayTradeFastpayRefundQueryModel input) 283 | { 284 | if (string.IsNullOrEmpty(input.OutRequestNo)) 285 | { 286 | input.OutRequestNo = input.OutTradeNo; 287 | } 288 | 289 | var request = new AlipayTradeFastpayRefundQueryRequest(); 290 | request.SetBizModel(input); 291 | 292 | AlipayTradeFastpayRefundQueryResponse response = await _alipayService.ExecuteAsync(request); 293 | return response; 294 | } 295 | 296 | /// 297 | /// 订单退款查询 298 | /// 299 | /// 商户订单号 300 | /// 支付宝交易号 301 | /// 退款单号 302 | /// 303 | public async Task RefundQuery(string tradeno, string alipayTradeNo, string refundNo) 304 | { 305 | var model = new AlipayTradeFastpayRefundQueryModel(); 306 | model.OutTradeNo = tradeno; 307 | model.TradeNo = alipayTradeNo; 308 | model.OutRequestNo = refundNo; 309 | 310 | return await this.RefundQuery(model); 311 | } 312 | 313 | #endregion 314 | 315 | 316 | #region 关闭订单 317 | 318 | 319 | /// 320 | /// 关闭订单 321 | /// 322 | /// 关闭订单数据 323 | /// 324 | public async Task OrderClose(OrderCloseInput input) 325 | { 326 | return await this.OrderClose(input.Data); 327 | } 328 | 329 | /// 330 | /// 关闭订单 331 | /// 332 | /// 关闭订单数据 333 | /// 334 | public async Task OrderClose(AlipayTradeCloseModel input) 335 | { 336 | 337 | var request = new AlipayTradeCloseRequest(); 338 | request.SetBizModel(input); 339 | 340 | var response = await _alipayService.ExecuteAsync(request); 341 | 342 | return response; 343 | } 344 | 345 | 346 | /// 347 | /// 关闭订单 348 | /// 349 | /// 商户订单号 350 | /// 支付宝交易号 351 | /// 352 | public async Task OrderClose(string tradeno, string alipayTradeNo) 353 | { 354 | var model = new AlipayTradeCloseModel() 355 | { 356 | OutTradeNo = tradeno, 357 | TradeNo = alipayTradeNo, 358 | }; 359 | 360 | return await this.OrderClose(model); 361 | } 362 | 363 | 364 | 365 | #endregion 366 | 367 | 368 | #region 回调获取请求数据 369 | 370 | public async Task PayRequestCheck(HttpRequest request) 371 | { 372 | await Task.Yield(); 373 | 374 | var result = new PayRequestCheckOutput(); 375 | 376 | if (request.Method.ToLower() == "post") 377 | { 378 | result.SArray = GetRequestPost(request); 379 | } 380 | else 381 | { 382 | result.SArray = GetRequestGet(request); 383 | } 384 | 385 | if (result.SArray.Count != 0) 386 | { 387 | result.IsSuccess = _alipayService.RSACheckV1(result.SArray); 388 | } 389 | 390 | return result; 391 | } 392 | 393 | #endregion 394 | 395 | 396 | #region FTF Pay 私有函数 397 | 398 | /// 399 | /// 面对面支付生成支付二维码 400 | /// 401 | /// 支付数据 402 | /// 异步通知地址,为空则表示为同步轮询模式 403 | /// 同步轮询回调函数 404 | /// 面对面支付其它配置 405 | /// 406 | private async Task FTFGenQRCode(AlipayTradePrecreateContentBuilder input, string asyncNotifyUrl, Action loopQueryAction, FTFConfig fTFConfig) 407 | { 408 | // 参数检测 409 | var isAsyncNotify = !asyncNotifyUrl.IsNullOrWhiteSpace(); 410 | if (!isAsyncNotify && loopQueryAction == null) 411 | { 412 | throw new NullReferenceException("轮询模式下 loopQueryAction 不能为空!"); 413 | } 414 | // 收款账号检测,如果为空则默认填入全局配置的Uid 415 | if (input.seller_id.IsNullOrWhiteSpace()) 416 | { 417 | input.seller_id = this._alipayService.Options.Uid; 418 | } 419 | 420 | 421 | 422 | Bitmap bitmap = null; 423 | MemoryStream memoryStream = null; 424 | var message = string.Empty; 425 | 426 | //推荐使用轮询撤销机制,不推荐使用异步通知,避免单边账问题发生。 427 | AlipayF2FPrecreateResult precreateResult = null; 428 | // 异步通知 429 | if (isAsyncNotify) 430 | { 431 | precreateResult = await _alipayF2FService.TradePrecreateAsync(input, asyncNotifyUrl); 432 | 433 | }// 同步轮询 434 | else 435 | { 436 | precreateResult = await _alipayF2FService.TradePrecreateAsync(input); 437 | } 438 | 439 | switch (precreateResult.Status) 440 | { 441 | case F2FResultEnum.SUCCESS: 442 | // 将链接用二维码工具生成二维码打印出来,顾客可以用支付宝钱包扫码支付。 443 | bitmap = RenderQrCode(precreateResult.response.QrCode); 444 | // 同步轮询模式,触发轮询回调函数 445 | if (!isAsyncNotify) 446 | { 447 | loopQueryAction.Invoke(precreateResult); 448 | } 449 | break; 450 | case F2FResultEnum.FAILED: 451 | message = $"生成二维码失败: {precreateResult.response.Body}"; 452 | break; 453 | 454 | case F2FResultEnum.UNKNOWN: 455 | message = "生成二维码失败:" + (precreateResult.response == null ? "配置或网络异常,请检查后重试" : "系统异常,请更新外部订单后重新发起请求"); 456 | break; 457 | } 458 | 459 | // 如果位图为空,则生成错误提示二维码 460 | if (bitmap == null) 461 | { 462 | bitmap = new Bitmap(fTFConfig == null ? this._fTFConfig?.QRCodeGenErrorImageFullPath : fTFConfig.QRCodeGenErrorImageFullPath); 463 | } 464 | 465 | // 转换成字节数组 466 | memoryStream = new MemoryStream(); 467 | bitmap.Save(memoryStream, ImageFormat.Png); 468 | var imgBuffer = memoryStream.GetBuffer(); 469 | 470 | // 释放资源 471 | memoryStream.Dispose(); 472 | bitmap.Dispose(); 473 | 474 | return new FTFOutput() 475 | { 476 | QRCodeImageBuffer = imgBuffer, 477 | IsSuccess = precreateResult.Status == F2FResultEnum.SUCCESS, 478 | Message = message 479 | }; 480 | } 481 | 482 | 483 | /// 484 | /// FTF渲染二维码 485 | /// 486 | /// 487 | /// 488 | private Bitmap RenderQrCode(string str, FTFConfig fTFConfig = null) 489 | { 490 | var eccLevel = QRCodeGenerator.ECCLevel.L; 491 | using (var qrGenerator = new QRCodeGenerator()) 492 | { 493 | using (var qrCodeData = qrGenerator.CreateQrCode(str, eccLevel)) 494 | { 495 | using (var qrCode = new QRCode(qrCodeData)) 496 | { 497 | 498 | var bp = qrCode.GetGraphic(20, Color.Black, Color.White, 499 | new Bitmap(fTFConfig == null ? this._fTFConfig?.QRCodeIconFullPath : fTFConfig.QRCodeIconFullPath), 500 | 15); 501 | return bp; 502 | } 503 | } 504 | } 505 | 506 | } 507 | 508 | 509 | #endregion 510 | 511 | 512 | #region 解析请求参数 513 | 514 | private Dictionary GetRequestGet(HttpRequest request) 515 | { 516 | Dictionary sArray = new Dictionary(); 517 | 518 | ICollection requestItem = request.Query.Keys; 519 | foreach (var item in requestItem) 520 | { 521 | sArray.Add(item, request.Query[item]); 522 | 523 | } 524 | return sArray; 525 | 526 | } 527 | 528 | private Dictionary GetRequestPost(HttpRequest request) 529 | { 530 | Dictionary sArray = new Dictionary(); 531 | 532 | ICollection requestItem = request.Form.Keys; 533 | foreach (var item in requestItem) 534 | { 535 | sArray.Add(item, request.Form[item]); 536 | 537 | } 538 | return sArray; 539 | 540 | } 541 | 542 | #endregion 543 | } 544 | } 545 | --------------------------------------------------------------------------------