diff --git a/CoreCms.Net.Services/Bill/CoreCmsBillPaymentsServices.cs b/CoreCms.Net.Services/Bill/CoreCmsBillPaymentsServices.cs index 7b1b3e8..0f08c9d 100644 --- a/CoreCms.Net.Services/Bill/CoreCmsBillPaymentsServices.cs +++ b/CoreCms.Net.Services/Bill/CoreCmsBillPaymentsServices.cs @@ -470,6 +470,7 @@ namespace CoreCms.Net.Services return res; } + //生成支付单,只是单纯的生成了支付单 var result = await ToAdd(sourceStr, paymentCode, userId, type, @params); if (result.status == false) @@ -604,9 +605,13 @@ namespace CoreCms.Net.Services } paymentRelData = paymentRel.data as CheckPayDTO; } - + var paymentId = CommonHelper.GetSerialNumberType((int)GlobalEnumVars.SerialNumberType.支付单编号); + if (string.IsNullOrEmpty(sourceStr) && type == (int)GlobalEnumVars.BillPaymentsType.GeZiFei) + { + sourceStr = paymentId; + } var billPayments = new CoreCmsBillPayments(); - billPayments.paymentId = CommonHelper.GetSerialNumberType((int)GlobalEnumVars.SerialNumberType.支付单编号); + billPayments.paymentId = paymentId; billPayments.sourceId = sourceStr; billPayments.money = paymentRelData.money; billPayments.userId = userId; diff --git a/CoreCms.Net.Web.WebApi/Controllers/PayNotify/WeChatPayController.cs b/CoreCms.Net.Web.WebApi/Controllers/PayNotify/WeChatPayController.cs index c178198..ac29cf5 100644 --- a/CoreCms.Net.Web.WebApi/Controllers/PayNotify/WeChatPayController.cs +++ b/CoreCms.Net.Web.WebApi/Controllers/PayNotify/WeChatPayController.cs @@ -114,8 +114,18 @@ namespace CoreCms.Net.Web.WebApi.Controllers.PayNotify { try { + 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.Refund, "退款收到消息", body); var notify = await _client.ExecuteAsync(Request, _optionsAccessor.Value); - NLogUtil.WriteAll(LogLevel.Trace, LogType.Refund, "微信退款结果通知", JsonConvert.SerializeObject(notify)); + NLogUtil.WriteAll(LogLevel.Trace, LogType.Refund, "订单已全额退款", JsonConvert.SerializeObject(notify)); if (notify.ReturnCode == WeChatPayCode.Success) if (notify.RefundStatus == WeChatPayCode.Success)