diff --git a/CoreCms.Net.Core/Config/RedisMessageQueueSetup.cs b/CoreCms.Net.Core/Config/RedisMessageQueueSetup.cs index 1f04a35..b35d2e9 100644 --- a/CoreCms.Net.Core/Config/RedisMessageQueueSetup.cs +++ b/CoreCms.Net.Core/Config/RedisMessageQueueSetup.cs @@ -39,9 +39,9 @@ namespace CoreCms.Net.Core.Config typeof(LogingSubscribe), typeof(UserSubscribe), - +#if DEBUG typeof(WeChatPayNoticeSubscribe), - +#endif typeof(SendWxTemplateMessageSubscribe), typeof(AfterSalesReviewSubscribe), diff --git a/CoreCms.Net.Web.WebApi/Controllers/PayNotify/WeChatPayController.cs b/CoreCms.Net.Web.WebApi/Controllers/PayNotify/WeChatPayController.cs index 80fda98..c178198 100644 --- a/CoreCms.Net.Web.WebApi/Controllers/PayNotify/WeChatPayController.cs +++ b/CoreCms.Net.Web.WebApi/Controllers/PayNotify/WeChatPayController.cs @@ -63,29 +63,25 @@ namespace CoreCms.Net.Web.WebApi.Controllers.PayNotify try { // 先读取原始请求 Body - Request.EnableBuffering(); // 允许多次读取流 - string body = ""; - using (var reader = new StreamReader(Request.Body, Encoding.UTF8, leaveOpen: true)) - { - body = await reader.ReadToEndAsync(); - Request.Body.Position = 0; // 重置流指针,保证后续能再次读取 - } + //Request.EnableBuffering(); // 允许多次读取流 + //string body = ""; + //using (var reader = new StreamReader(Request.Body, Encoding.UTF8, leaveOpen: true)) + //{ + // body = await reader.ReadToEndAsync(); + // Request.Body.Position = 0; // 重置流指针,保证后续能再次读取 + //} // 打印原始请求内容(方便定位问题) - NLogUtil.WriteAll(LogLevel.Trace, LogType.Order, "微信支付成功回调原始请求", body); - NLogUtil.WriteAll(LogLevel.Trace, LogType.Order, "微信支付成功回调解析结果_optionsAccessor", JsonConvert.SerializeObject(_optionsAccessor.Value)); + // NLogUtil.WriteAll(LogLevel.Trace, LogType.Order, "微信支付成功回调原始请求", body); var notify = await _client.ExecuteAsync(Request, _optionsAccessor.Value); // 打印解析后的对象 NLogUtil.WriteAll(LogLevel.Trace, LogType.Order, "微信支付成功回调解析结果", JsonConvert.SerializeObject(notify)); - - if (notify.ReturnCode == WeChatPayCode.Success) { await _redisOperationRepository.ListLeftPushAsync(RedisMessageQueueKey.WeChatPayNotice, JsonConvert.SerializeObject(notify)); return WeChatPayNotifyResult.Success; } NLogUtil.WriteAll(LogLevel.Trace, LogType.Order, "微信支付成功回调", JsonConvert.SerializeObject(notify)); - //Request.Body return NoContent(); }