From da68cb2e1439896012dbb5781eee82eaed01b35d Mon Sep 17 00:00:00 2001 From: JeffreySu Date: Thu, 5 Sep 2024 19:22:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=BE=AE=E4=BF=A1=E6=94=AF?= =?UTF-8?q?=E4=BB=98=20V3=20Sample?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/Weixin/TenPay/TenPayApiV3Controller.cs | 8 ++++---- .../Senparc.Weixin.Sample.net8.csproj | 2 +- .../net8-mvc/Senparc.Weixin.Sample.Net8/appsettings.json | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Samples/All/net8-mvc/Senparc.Weixin.Sample.Net8/Controllers/Weixin/TenPay/TenPayApiV3Controller.cs b/Samples/All/net8-mvc/Senparc.Weixin.Sample.Net8/Controllers/Weixin/TenPay/TenPayApiV3Controller.cs index 13b29c22b4..98d2eff4e3 100644 --- a/Samples/All/net8-mvc/Senparc.Weixin.Sample.Net8/Controllers/Weixin/TenPay/TenPayApiV3Controller.cs +++ b/Samples/All/net8-mvc/Senparc.Weixin.Sample.Net8/Controllers/Weixin/TenPay/TenPayApiV3Controller.cs @@ -338,10 +338,10 @@ public async Task PayNotifyUrl() { //获取微信服务器异步发送的支付通知信息 var resHandler = new TenPayNotifyHandler(HttpContext); - var orderReturnJson = await resHandler.AesGcmDecryptGetObjectAsync(); + var orderReturnJson = await resHandler.DecryptGetObjectAsync(); //记录日志 - Senparc.Weixin.WeixinTrace.SendCustomLog("PayNotifyUrl 接收到消息", orderReturnJson.ToJson(true)); + Senparc.Weixin.WeixinTrace.SendCustomLog("PayNotifyUrl 接收到消息(ApiV3)", orderReturnJson.ToJson(true)); //演示记录 transaction_id,实际开发中需要记录到数据库,以便退款和后续跟踪 TradeNumberToTransactionId[orderReturnJson.out_trade_no] = orderReturnJson.transaction_id; @@ -389,13 +389,13 @@ public async Task PayNotifyUrl() #region 记录日志(也可以记录到数据库审计日志中) - var logDir = ServerUtility.ContentRootMapPath(string.Format("~/App_Data/TenPayNotify/{0}", SystemTime.Now.ToString("yyyyMMdd"))); + var logDir = ServerUtility.ContentRootMapPath(string.Format("~/App_Data/TenPayNotify/ApiV3{0}", SystemTime.Now.ToString("yyyyMMdd"))); if (!Directory.Exists(logDir)) { Directory.CreateDirectory(logDir); } - var logPath = Path.Combine(logDir, string.Format("{0}-{1}-{2}.txt", SystemTime.Now.ToString("yyyyMMdd"), SystemTime.Now.ToString("HHmmss"), Guid.NewGuid().ToString("n").Substring(0, 8))); + var logPath = Path.Combine(logDir, string.Format("ApiV3-{0}-{1}-{2}.txt", SystemTime.Now.ToString("yyyyMMdd"), SystemTime.Now.ToString("HHmmss"), Guid.NewGuid().ToString("n").Substring(0, 8))); using (var fileStream = System.IO.File.OpenWrite(logPath)) { diff --git a/Samples/All/net8-mvc/Senparc.Weixin.Sample.Net8/Senparc.Weixin.Sample.net8.csproj b/Samples/All/net8-mvc/Senparc.Weixin.Sample.Net8/Senparc.Weixin.Sample.net8.csproj index b6c5edd4f1..2ce3a57fd3 100644 --- a/Samples/All/net8-mvc/Senparc.Weixin.Sample.Net8/Senparc.Weixin.Sample.net8.csproj +++ b/Samples/All/net8-mvc/Senparc.Weixin.Sample.Net8/Senparc.Weixin.Sample.net8.csproj @@ -2,7 +2,7 @@ net8.0 - 6.11.2 + 6.11.3 enable 35e58786-0820-4cde-b1ff-f4c6198d00f7 false diff --git a/Samples/All/net8-mvc/Senparc.Weixin.Sample.Net8/appsettings.json b/Samples/All/net8-mvc/Senparc.Weixin.Sample.Net8/appsettings.json index c76b6ec281..695698a874 100644 --- a/Samples/All/net8-mvc/Senparc.Weixin.Sample.Net8/appsettings.json +++ b/Samples/All/net8-mvc/Senparc.Weixin.Sample.Net8/appsettings.json @@ -86,7 +86,7 @@ //如果不设置TenPayV3_WxOpenTenpayNotify,默认在 TenPayV3_TenpayNotify 的值最后加上 "WxOpen" "TenPayV3_WxOpenTenpayNotify": "#{TenPayV3_WxOpenTenpayNotify}#", //http://YourDomainName/TenpayV3/PayNotifyUrlWxOpen - "EncryptionType": "#{EncryptionType}#", // 加密类型:RSA / SM + "EncryptionType": "#{EncryptionType}#", // 加密类型:RSA / SM(必填,根据后台申请证书类型选择,大部分情况为 RSA) //开放平台 "Component_Appid": "#{Component_Appid}#",