diff --git a/CoreCms.Net.Web.WebApi/Controllers/PayNotify/WeChatPayController.cs b/CoreCms.Net.Web.WebApi/Controllers/PayNotify/WeChatPayController.cs index 3bb69af8..ecd2ca60 100644 --- a/CoreCms.Net.Web.WebApi/Controllers/PayNotify/WeChatPayController.cs +++ b/CoreCms.Net.Web.WebApi/Controllers/PayNotify/WeChatPayController.cs @@ -124,15 +124,20 @@ namespace CoreCms.Net.Web.WebApi.Controllers.PayNotify var notify = await _client.ExecuteAsync(Request, payOptions); NLogUtil.WriteAll(LogLevel.Trace, LogType.Refund, "微信退款结果通知", JsonConvert.SerializeObject(notify)); - if (notify.ReturnCode == WeChatPayCode.Success) - if (notify.RefundStatus == WeChatPayCode.Success) - { - //Console.WriteLine("OutTradeNo: " + notify.OutTradeNo); - var memo = JsonConvert.SerializeObject(notify); - await _billRefundServices.UpdateAsync(p => new CoreCmsBillRefund { memo = memo }, p => p.refundId == notify.OutTradeNo); - return WeChatPayNotifyResult.Success; - } - return NoContent(); + if (notify.ReturnCode != WeChatPayCode.Success) return NoContent(); + { + var memo = JsonConvert.SerializeObject(notify); + + var status = notify.RefundStatus == WeChatPayCode.Success + ? (int)GlobalEnumVars.BillRefundStatus.STATUS_REFUND + : (int)GlobalEnumVars.BillRefundStatus.STATUS_FAIL; + + await _billRefundServices.UpdateAsync(p => new CoreCmsBillRefund { memo = memo, updateTime = DateTime.Now, status = status }, p => p.refundId == notify.OutTradeNo); + + //这个返回只是告诉回调这个业务我们接收到了。 + return WeChatPayNotifyResult.Success; + } + } catch (Exception ex) {