Skip to content

Commit 6b1879a

Browse files
authored
Merge pull request #3066 from JeffreySu/Developer
更新微信支付 V3 Sample
2 parents 45fe075 + da68cb2 commit 6b1879a

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

Samples/All/net8-mvc/Senparc.Weixin.Sample.Net8/Controllers/Weixin/TenPay/TenPayApiV3Controller.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -338,10 +338,10 @@ public async Task<IActionResult> PayNotifyUrl()
338338
{
339339
//获取微信服务器异步发送的支付通知信息
340340
var resHandler = new TenPayNotifyHandler(HttpContext);
341-
var orderReturnJson = await resHandler.AesGcmDecryptGetObjectAsync<OrderReturnJson>();
341+
var orderReturnJson = await resHandler.DecryptGetObjectAsync<OrderReturnJson>();
342342

343343
//记录日志
344-
Senparc.Weixin.WeixinTrace.SendCustomLog("PayNotifyUrl 接收到消息", orderReturnJson.ToJson(true));
344+
Senparc.Weixin.WeixinTrace.SendCustomLog("PayNotifyUrl 接收到消息(ApiV3)", orderReturnJson.ToJson(true));
345345

346346
//演示记录 transaction_id,实际开发中需要记录到数据库,以便退款和后续跟踪
347347
TradeNumberToTransactionId[orderReturnJson.out_trade_no] = orderReturnJson.transaction_id;
@@ -389,13 +389,13 @@ public async Task<IActionResult> PayNotifyUrl()
389389

390390
#region 记录日志(也可以记录到数据库审计日志中)
391391

392-
var logDir = ServerUtility.ContentRootMapPath(string.Format("~/App_Data/TenPayNotify/{0}", SystemTime.Now.ToString("yyyyMMdd")));
392+
var logDir = ServerUtility.ContentRootMapPath(string.Format("~/App_Data/TenPayNotify/ApiV3{0}", SystemTime.Now.ToString("yyyyMMdd")));
393393
if (!Directory.Exists(logDir))
394394
{
395395
Directory.CreateDirectory(logDir);
396396
}
397397

398-
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)));
398+
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)));
399399

400400
using (var fileStream = System.IO.File.OpenWrite(logPath))
401401
{

Samples/All/net8-mvc/Senparc.Weixin.Sample.Net8/Senparc.Weixin.Sample.net8.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<Project Sdk="Microsoft.NET.Sdk.Web">
33
<PropertyGroup>
44
<TargetFramework>net8.0</TargetFramework>
5-
<Version>6.11.2</Version>
5+
<Version>6.11.3</Version>
66
<ImplicitUsings>enable</ImplicitUsings>
77
<UserSecretsId>35e58786-0820-4cde-b1ff-f4c6198d00f7</UserSecretsId>
88
<PublishWithAspNetCoreTargetManifest>false</PublishWithAspNetCoreTargetManifest>

Samples/All/net8-mvc/Senparc.Weixin.Sample.Net8/appsettings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
//如果不设置TenPayV3_WxOpenTenpayNotify,默认在 TenPayV3_TenpayNotify 的值最后加上 "WxOpen"
8787
"TenPayV3_WxOpenTenpayNotify": "#{TenPayV3_WxOpenTenpayNotify}#", //http://YourDomainName/TenpayV3/PayNotifyUrlWxOpen
8888

89-
"EncryptionType": "#{EncryptionType}#", // 加密类型:RSA / SM
89+
"EncryptionType": "#{EncryptionType}#", // 加密类型:RSA / SM(必填,根据后台申请证书类型选择,大部分情况为 RSA)
9090

9191
//开放平台
9292
"Component_Appid": "#{Component_Appid}#",

0 commit comments

Comments
 (0)