!14 升级支付组件。修复调用自定义首页数据排序导致sql报错问题。

* 1、更换支付组件从Payment 到Paylink。2、修复page页面取数据排序问题。
* 调整支付组件
* 代码格式细节微调
* 修改细节
* 修复通过core first生成mysql数据库的两个问题。
* 经过测试,mysql版本需要5.7或以上
* 增加HangFire到单独配置
This commit is contained in:
大灰灰
2021-06-14 18:17:29 +08:00
parent 3b1d26d253
commit 3f784c4374
19 changed files with 76 additions and 86 deletions
@@ -24,7 +24,6 @@ namespace CoreCms.Net.Configuration
public static readonly string AppConfigAppInterFaceUrl = AppSettingsHelper.GetContent("AppConfig", "AppInterFaceUrl");
#endregion
#region 数据库================================================================================
/// <summary>
/// 获取数据库连接字符串
@@ -55,7 +54,6 @@ namespace CoreCms.Net.Configuration
#endregion
#region AOP================================================================================
/// <summary>
/// 事务切面开关
@@ -71,14 +69,12 @@ namespace CoreCms.Net.Configuration
public static readonly string JwtConfigAudience = AppSettingsHelper.GetContent("JwtConfig", "Audience");
#endregion
#region Cors跨域设置================================================================================
public static readonly string CorsPolicyName = AppSettingsHelper.GetContent("Cors", "PolicyName");
public static readonly bool CorsEnableAllIPs = AppSettingsHelper.GetContent("Cors", "EnableAllIPs").ObjToBool();
public static readonly string CorsIPs = AppSettingsHelper.GetContent("Cors", "IPs");
#endregion
#region Middleware中间件================================================================================
/// <summary>
/// Ip限流
@@ -119,7 +115,6 @@ namespace CoreCms.Net.Configuration
public static readonly string PayCallBackAlipayRefundUrl = AppSettingsHelper.GetContent("PayCallBack", "AlipayRefundUrl");
#endregion
#region 易联云打印机================================================================================
/// <summary>
+1 -1
View File
@@ -26,7 +26,7 @@ namespace CoreCms.Net.Core.Config
/// </summary>
public static class HangFireSetup
{
public static void AddHangFireSetupSetup(this IServiceCollection services)
public static void AddHangFireSetup(this IServiceCollection services)
{
if (services == null) throw new ArgumentNullException(nameof(services));
@@ -5,7 +5,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Essensoft.AspNetCore.Payment.WeChatPay" Version="3.3.2" />
<PackageReference Include="Essensoft.Paylink.WeChatPay" Version="4.0.4" />
<PackageReference Include="InitQ" Version="1.0.0.6" />
<PackageReference Include="Qc.YilianyunSdk" Version="1.0.7" />
</ItemGroup>
@@ -7,8 +7,6 @@ using CoreCms.Net.IServices;
using CoreCms.Net.Loging;
using CoreCms.Net.Model.Entities;
using CoreCms.Net.Utility.Helper;
using Essensoft.AspNetCore.Payment.WeChatPay.V2;
using Essensoft.AspNetCore.Payment.WeChatPay.V2.Notify;
using InitQ.Abstractions;
using InitQ.Attributes;
using Microsoft.Extensions.Logging;
@@ -7,8 +7,8 @@ using CoreCms.Net.Model.Entities;
using CoreCms.Net.Model.ViewModels.UI;
using CoreCms.Net.Utility.Extensions;
using CoreCms.Net.Utility.Helper;
using Essensoft.AspNetCore.Payment.WeChatPay.V2;
using Essensoft.AspNetCore.Payment.WeChatPay.V2.Notify;
using Essensoft.Paylink.WeChatPay.V2;
using Essensoft.Paylink.WeChatPay.V2.Notify;
using InitQ.Abstractions;
using InitQ.Attributes;
using Microsoft.Extensions.Logging;
@@ -6,7 +6,7 @@
<ItemGroup>
<PackageReference Include="DotLiquid" Version="2.1.457" />
<PackageReference Include="Essensoft.AspNetCore.Payment.WeChatPay" Version="3.3.2" />
<PackageReference Include="Essensoft.Paylink.WeChatPay" Version="4.0.4" />
<PackageReference Include="Senparc.CO2NET" Version="1.4.400" />
<PackageReference Include="Senparc.Weixin.MP" Version="16.12.400" />
</ItemGroup>
@@ -11,7 +11,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Essensoft.AspNetCore.Payment.WeChatPay" Version="3.3.2" />
<PackageReference Include="Essensoft.Paylink.WeChatPay" Version="4.0.4" />
<PackageReference Include="Flurl.Http" Version="3.2.0" />
<PackageReference Include="MediatR" Version="9.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
@@ -18,10 +18,9 @@ using CoreCms.Net.IServices;
using CoreCms.Net.Model.Entities;
using CoreCms.Net.Model.ViewModels.UI;
using CoreCms.Net.Utility.Extensions;
using Essensoft.AspNetCore.Payment.WeChatPay;
//using Essensoft.AspNetCore.Payment.WeChatPay.Request;
using Essensoft.AspNetCore.Payment.WeChatPay.V2;
using Essensoft.AspNetCore.Payment.WeChatPay.V2.Request;
using Essensoft.Paylink.WeChatPay;
using Essensoft.Paylink.WeChatPay.V2;
using Essensoft.Paylink.WeChatPay.V2.Request;
using Microsoft.Extensions.Options;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
@@ -158,7 +158,14 @@ namespace CoreCms.Net.Services
{
noticeIdsStr = string.Join(",", noticeIdsStr);
//按照固定的序列id进行排序
orderBy = " CHARINDEX(RTRIM(CAST(id as NCHAR)),'" + noticeIdsStr + "') ";
if (AppSettingsConstVars.DbDbType == DbType.SqlServer.ToString())
{
orderBy = " CHARINDEX(RTRIM(CAST(id as NCHAR)),'" + noticeIdsStr + "') ";
}
else if (AppSettingsConstVars.DbDbType == DbType.MySql.ToString())
{
orderBy = " find_in_set(id,'" + noticeIdsStr + "') ";
}
}
}
var notices = await _noticeServices.QueryListByClauseAsync(where, orderBy);
@@ -289,7 +296,15 @@ namespace CoreCms.Net.Services
if (goodids.Any())
{
goodidsStr = string.Join(",", goodids);
orderBy = " CHARINDEX(RTRIM(CAST(id as NCHAR)),'" + goodidsStr + "') ";
//按照id序列打乱后的顺序排序
if (AppSettingsConstVars.DbDbType == DbType.SqlServer.ToString())
{
orderBy = " CHARINDEX(RTRIM(CAST(id as NCHAR)),'" + goodidsStr + "') ";
}
else if (AppSettingsConstVars.DbDbType == DbType.MySql.ToString())
{
orderBy = " find_in_set(id,'" + goodidsStr + "') ";
}
}
}
var goods = await _goodsServices.QueryListByClauseAsync(where, orderBy);
@@ -7,26 +7,12 @@
* CreateTime: 2021/1/31 21:45:10
* Description: 暂无
***********************************************************************/
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using AutoMapper;
using CoreCms.Net.Caching.AutoMate.RedisCache;
using CoreCms.Net.Configuration;
using CoreCms.Net.IServices;
using CoreCms.Net.Model.ViewModels.Api;
using CoreCms.Net.Model.ViewModels.UI;
using CoreCms.Net.Utility.Helper;
using Essensoft.AspNetCore.Payment.Alipay.Domain;
using Flurl;
using Flurl.Http;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using NPOI.HSSF.UserModel;
using SqlSugar;
namespace CoreCms.Net.Web.Admin.Controllers
{
@@ -25,7 +25,6 @@ using CoreCms.Net.Loging;
using CoreCms.Net.IServices;
using CoreCms.Net.Utility.Helper;
using CoreCms.Net.Utility.Extensions;
using Essensoft.AspNetCore.Payment.Alipay.Domain;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
@@ -51,8 +51,8 @@
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="7.1.0" />
<PackageReference Include="Autofac.Extras.DynamicProxy" Version="6.0.0" />
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="8.1.1" />
<PackageReference Include="Essensoft.AspNetCore.Payment.Alipay" Version="3.3.2" />
<PackageReference Include="Essensoft.AspNetCore.Payment.WeChatPay" Version="3.3.2" />
<PackageReference Include="Essensoft.Paylink.Alipay" Version="4.0.4" />
<PackageReference Include="Essensoft.Paylink.WeChatPay" Version="4.0.4" />
<PackageReference Include="IdentityModel" Version="5.1.0" />
<PackageReference Include="MediatR.Extensions.Microsoft.DependencyInjection" Version="9.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="5.0.7" />
+2 -19
View File
@@ -1,33 +1,19 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using Autofac;
using Autofac.Extras.DynamicProxy;
using AutoMapper;
using CoreCms.Net.Auth;
using CoreCms.Net.Configuration;
using CoreCms.Net.Core.AOP;
using CoreCms.Net.Core.AutoFac;
using CoreCms.Net.Core.Config;
using CoreCms.Net.Filter;
using CoreCms.Net.Loging;
using CoreCms.Net.Mapping;
using CoreCms.Net.Middlewares;
using CoreCms.Net.Model.ViewModels.Options;
using CoreCms.Net.Model.ViewModels.Sms;
using CoreCms.Net.Repository.CodeGenerator;
using CoreCms.Net.Services.CodeGenerator;
using CoreCms.Net.Services.Mediator;
using CoreCms.Net.Swagger;
using CoreCms.Net.Task;
using CoreCms.Net.Utility.Extensions;
using CoreCms.Net.WeChatService.CustomMessageHandler;
using CoreCms.Net.WeChatService.MessageHandlers.WebSocket;
using CoreCms.Net.WeChatService.WxOpenMessageHandler;
using Essensoft.AspNetCore.Payment.Alipay;
using Essensoft.AspNetCore.Payment.WeChatPay;
using Essensoft.Paylink.Alipay;
using Essensoft.Paylink.WeChatPay;
using MediatR;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
@@ -42,13 +28,10 @@ using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Options;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using Qc.YilianyunSdk;
using Senparc.CO2NET;
using Senparc.CO2NET.AspNet;
using Senparc.WebSocket;
using Senparc.Weixin;
using Senparc.Weixin.Entities;
using Senparc.Weixin.MP;
using Senparc.Weixin.RegisterServices;
using Senparc.Weixin.WxOpen;
using SqlSugar;
+17 -10
View File
@@ -77,25 +77,33 @@
//打印机设置联系电话
"Phone": ""
},
// 微信支付
// 更多配置,请查看WeChatPayOptions类
"WeChatPay": {
//应用号(公众平台AppId/开放平台AppId/小程序AppId/企业微信CorpId)
// 应用号
// 如:微信公众平台AppId、微信开放平台AppId、微信小程序AppId、企业微信CorpId等
"AppId": "",
//商户号
// 商户号
// 为微信支付商户平台的商户号
"MchId": "",
//API秘钥,不是APIv3密钥
"Key": "",
// API密钥
// 为微信支付商户平台的API密钥,请注意不是APIv3密钥
"APIKey": "",
// APIv3密钥
// 为微信支付商户平台的APIv3密钥,请注意不是API密钥,v3接口必填
"V3Key": "",
//API证书 .p12
"APIv3Key": "",
// API证书(.p12)
// 为微信支付商户平台的API证书(.p12),v3接口必填
// 可为证书文件(.p12)路径 / 证书文件(.p12)的base64字符串
"Certificate": "WxPayCert\\apiclient_cert.p12",
//RSA公钥 (目前仅"企业付款到银行卡API"使用,调用"获取RSA加密公钥API"即可获取)
// RSA公钥
// 目前仅调用"企业付款到银行卡API"时使用,执行本示例中的"获取RSA加密公钥API"即可获取。
"RsaPublicKey": ""
},
// 支付宝(暂未开通)
// 更多配置,请查看AlipayOptions类
"Alipay": {
// 注意:
// 注意:
// 若涉及资金类支出接口(如转账、红包等)接入,必须使用“公钥证书”方式。不涉及到资金类接口,也可以使用“普通公钥”方式进行加签。
// 本示例默认的加签方式为“公钥证书”方式,并调用 CertificateExecuteAsync 方法 执行API。
// 若使用“普通公钥”方式,除了遵守下方注释的规则外,调用 CertificateExecuteAsync 也需改成 ExecuteAsync。
@@ -104,7 +112,6 @@
// 应用Id
// 为支付宝开放平台-APPID
"AppId": "",
// 支付宝公钥 RSA公钥
// 为支付宝开放平台-支付宝公钥
// “公钥证书”方式时,留空
@@ -124,7 +131,7 @@
// 可为证书文件路径 / 证书文件的base64字符串
// “公钥证书”方式时,必填
// “普通公钥”方式时,留空
"AppCert": "",
"AppPublicCert": "",
// 支付宝公钥证书
// 可为证书文件路径 / 证书文件的base64字符串
// “公钥证书”方式时,必填
@@ -11,9 +11,9 @@
using System;
using System.Threading.Tasks;
using System.Xml;
using Essensoft.AspNetCore.Payment.Alipay;
using Essensoft.AspNetCore.Payment.Alipay.Notify;
using Essensoft.AspNetCore.Payment.Alipay.Utility;
using Essensoft.Paylink.Alipay;
using Essensoft.Paylink.Alipay.Notify;
using Essensoft.Paylink.Alipay.Utility;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
@@ -12,7 +12,6 @@ using CoreCms.Net.Configuration;
using CoreCms.Net.IServices;
using CoreCms.Net.Loging;
using CoreCms.Net.Model.Entities;
using Essensoft.AspNetCore.Payment.WeChatPay;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using Newtonsoft.Json;
@@ -20,8 +19,9 @@ using NLog;
using System;
using System.Threading.Tasks;
using CoreCms.Net.Caching.AutoMate.RedisCache;
using Essensoft.AspNetCore.Payment.WeChatPay.V2;
using Essensoft.AspNetCore.Payment.WeChatPay.V2.Notify;
using Essensoft.Paylink.WeChatPay;
using Essensoft.Paylink.WeChatPay.V2;
using Essensoft.Paylink.WeChatPay.V2.Notify;
namespace CoreCms.Net.Web.WebApi.Controllers.PayNotify
{
@@ -42,8 +42,8 @@
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="7.1.0" />
<PackageReference Include="Autofac.Extras.DynamicProxy" Version="6.0.0" />
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="8.1.1" />
<PackageReference Include="Essensoft.AspNetCore.Payment.Alipay" Version="3.3.2" />
<PackageReference Include="Essensoft.AspNetCore.Payment.WeChatPay" Version="3.3.2" />
<PackageReference Include="Essensoft.Paylink.Alipay" Version="4.0.4" />
<PackageReference Include="Essensoft.Paylink.WeChatPay" Version="4.0.4" />
<PackageReference Include="Hangfire" Version="1.7.23" />
<PackageReference Include="Hangfire.AspNetCore" Version="1.7.23" />
<PackageReference Include="Hangfire.Core" Version="1.7.23" />
+4 -3
View File
@@ -13,8 +13,6 @@ using CoreCms.Net.Model.ViewModels.Sms;
using CoreCms.Net.Services.Mediator;
using CoreCms.Net.Swagger;
using CoreCms.Net.Task;
using Essensoft.AspNetCore.Payment.Alipay;
using Essensoft.AspNetCore.Payment.WeChatPay;
using Hangfire;
using Hangfire.Dashboard.BasicAuthorization;
using InitQ;
@@ -43,6 +41,8 @@ using System.Collections.Generic;
using System.Linq;
using CoreCms.Net.RedisMQ.Subscribe;
using CoreCms.Net.Utility.Extensions;
using Essensoft.Paylink.Alipay;
using Essensoft.Paylink.WeChatPay;
namespace CoreCms.Net.Web.WebApi
{
@@ -117,7 +117,8 @@ namespace CoreCms.Net.Web.WebApi
services.AddYiLianYunSetup();
//注册Hangfire定时任务
services.AddHangFireSetupSetup();
services.AddHangFireSetup();
//授权支持注入
services.AddAuthorizationSetupForClient();
+17 -10
View File
@@ -77,25 +77,33 @@
//打印机设置联系电话
"Phone": ""
},
// 微信支付
// 更多配置,请查看WeChatPayOptions类
"WeChatPay": {
//应用号(公众平台AppId/开放平台AppId/小程序AppId/企业微信CorpId)
// 应用号
// 如:微信公众平台AppId、微信开放平台AppId、微信小程序AppId、企业微信CorpId等
"AppId": "",
//商户号
// 商户号
// 为微信支付商户平台的商户号
"MchId": "",
//API秘钥,不是APIv3密钥
"Key": "",
// API密钥
// 为微信支付商户平台的API密钥,请注意不是APIv3密钥
"APIKey": "",
// APIv3密钥
// 为微信支付商户平台的APIv3密钥,请注意不是API密钥,v3接口必填
"V3Key": "",
//API证书 .p12
"APIv3Key": "",
// API证书(.p12)
// 为微信支付商户平台的API证书(.p12),v3接口必填
// 可为证书文件(.p12)路径 / 证书文件(.p12)的base64字符串
"Certificate": "WxPayCert\\apiclient_cert.p12",
//RSA公钥 (目前仅"企业付款到银行卡API"使用,调用"获取RSA加密公钥API"即可获取)
// RSA公钥
// 目前仅调用"企业付款到银行卡API"时使用,执行本示例中的"获取RSA加密公钥API"即可获取。
"RsaPublicKey": ""
},
// 支付宝(暂未开通)
// 更多配置,请查看AlipayOptions类
"Alipay": {
// 注意:
// 注意:
// 若涉及资金类支出接口(如转账、红包等)接入,必须使用“公钥证书”方式。不涉及到资金类接口,也可以使用“普通公钥”方式进行加签。
// 本示例默认的加签方式为“公钥证书”方式,并调用 CertificateExecuteAsync 方法 执行API。
// 若使用“普通公钥”方式,除了遵守下方注释的规则外,调用 CertificateExecuteAsync 也需改成 ExecuteAsync。
@@ -104,7 +112,6 @@
// 应用Id
// 为支付宝开放平台-APPID
"AppId": "",
// 支付宝公钥 RSA公钥
// 为支付宝开放平台-支付宝公钥
// “公钥证书”方式时,留空
@@ -124,7 +131,7 @@
// 可为证书文件路径 / 证书文件的base64字符串
// “公钥证书”方式时,必填
// “普通公钥”方式时,留空
"AppCert": "",
"AppPublicCert": "",
// 支付宝公钥证书
// 可为证书文件路径 / 证书文件的base64字符串
// “公钥证书”方式时,必填