diff --git a/Admin.NET/Admin.NET.Core/Service/Wechat/Dto/WechatPayOutput.cs b/Admin.NET/Admin.NET.Core/Service/Wechat/Dto/WechatPayOutput.cs index 5e2bc2e2..d65d1e7b 100644 --- a/Admin.NET/Admin.NET.Core/Service/Wechat/Dto/WechatPayOutput.cs +++ b/Admin.NET/Admin.NET.Core/Service/Wechat/Dto/WechatPayOutput.cs @@ -68,23 +68,23 @@ public class CreatePayTransactionOutput { public string PrepayId { get; set; } public string OutTradeNumber { get; set; } - //public WechatPayParaOutput SingInfo { get; set; } + public WechatPayParaOutput SingInfo { get; set; } } -//public class WechatPayParaOutput -//{ -// public string AppId { get; set; } +public class WechatPayParaOutput +{ + public string AppId { get; set; } -// public string TimeStamp { get; set; } + public string TimeStamp { get; set; } -// public string NonceStr { get; set; } + public string NonceStr { get; set; } -// public string Package { get; set; } + public string Package { get; set; } -// public string SignType { get; set; } + public string SignType { get; set; } -// public string PaySign { get; set; } -//} + public string PaySign { get; set; } +} public class CreatePayTransactionNativeOutput { diff --git a/Admin.NET/Admin.NET.Core/Service/Wechat/SysWechatPayService.cs b/Admin.NET/Admin.NET.Core/Service/Wechat/SysWechatPayService.cs index a7a4fcb5..b7659189 100644 --- a/Admin.NET/Admin.NET.Core/Service/Wechat/SysWechatPayService.cs +++ b/Admin.NET/Admin.NET.Core/Service/Wechat/SysWechatPayService.cs @@ -5,6 +5,7 @@ // 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任! using Furion.Logging.Extensions; +using NewLife; using Newtonsoft.Json; namespace Admin.NET.Core.Service; @@ -15,7 +16,7 @@ namespace Admin.NET.Core.Service; [ApiDescriptionSettings(Order = 210, Description = "微信支付")] public class SysWechatPayService : IDynamicApiController, ITransient { - private static readonly List wechatPayEventHandlers = [new WechatPayEventInterceptor() { Order = int.MaxValue }]; + private static readonly List wechatPayEventHandlers = new List(); /// /// 注册支付记录变化事件处理器 @@ -135,12 +136,12 @@ public class SysWechatPayService : IDynamicApiController, ITransient await _sysWechatPayRep.InsertAsync(wechatPay); } - //var singInfo = GenerateParametersForJsapiPay(new WechatPayParaInput() { PrepayId = response.PrepayId }); + var singInfo = GenerateParametersForJsapiPay(new WechatPayParaInput() { PrepayId = response.PrepayId }); return new CreatePayTransactionOutput { PrepayId = response.PrepayId, OutTradeNumber = request.OutTradeNumber, - //SingInfo = singInfo + SingInfo = singInfo }; } @@ -310,7 +311,8 @@ public class SysWechatPayService : IDynamicApiController, ITransient { try { - if (!await eh.PayInforChanged(wechatPayOld, wechatPayNew)) + //这里一定要用 DeepCopy 来创一个新的对象传进不,不然会被外面的 主线程改变就麻烦了 + if (!await eh.PayInforChanged(wechatPayOld, wechatPayNew.DeepCopy())) break; } catch (Exception ex) @@ -321,7 +323,7 @@ public class SysWechatPayService : IDynamicApiController, ITransient }); } // 下面这里创建一个新的对象,是因为不想把全部字段都返回 - wechatPayNew = new SysWechatPay() + var result = new SysWechatPay() { AppId = _wechatPayOptions.AppId, MerchantId = _wechatPayOptions.MerchantId, @@ -337,7 +339,7 @@ public class SysWechatPayService : IDynamicApiController, ITransient SuccessTime = response.SuccessTime.HasValue ? response.SuccessTime.Value.DateTime : DateTime.Now // 支付完成时间 }; - return wechatPayNew; + return result; } ///