321
This commit is contained in:
parent
59279cacc3
commit
c6042b8922
|
|
@ -39,9 +39,9 @@ namespace CoreCms.Net.Core.Config
|
|||
typeof(LogingSubscribe),
|
||||
|
||||
typeof(UserSubscribe),
|
||||
|
||||
#if DEBUG
|
||||
typeof(WeChatPayNoticeSubscribe),
|
||||
|
||||
#endif
|
||||
typeof(SendWxTemplateMessageSubscribe),
|
||||
|
||||
typeof(AfterSalesReviewSubscribe),
|
||||
|
|
|
|||
|
|
@ -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<WeChatPayUnifiedOrderNotify>(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();
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user