/// <summary> /// 支付中心通知失败重新通知到业务平台 /// </summary> public void PayCenterNotify() { try { var bll = new AppOrderBLL(new JIT.Utility.BasicUserInfo()); //获取未通知的订单信息 var entitys = bll.GetNotNodify(); Loggers.Debug(new DebugLogInfo() { Message = string.Format("找到{0}条待通知记录", entitys.Length) }); foreach (var item in entitys) { string msg; if (Notify(item, out msg)) { item.IsNotified = true; } else { //设定下次通知时间 item.NextNotifyTime = GetNextNotifyTime(item.NotifyCount ?? 0); } //NotifyCount++ item.NotifyCount++; //更新数据 bll.Update(item); } } catch (Exception ex) { Loggers.Exception(new ExceptionLogInfo(ex)); } }
/// <summary> /// 第三方支付通知失败处理 /// </summary> public void SetNotificationFailed() { AppOrderBLL appOrderBLL = new AppOrderBLL(new BasicUserInfo()); PayChannelBLL payChannelBLL = new PayChannelBLL(new BasicUserInfo()); WeiXinOrderQuery orderQuery = new WeiXinOrderQuery(); PayChannelEntity payChannelEntiy = null; WeiXinOrderQuery.OrderQueryPara para = null; try { //获取当天未支付成功的订单 AppOrderEntity[] appOrderList = appOrderBLL.GetUnpaidOrder(); Loggers.Debug(new DebugLogInfo() { Message = string.Format("找到{0}条通知失败或未支付成功数据", appOrderList.Count()) }); foreach (var order in appOrderList) { //读取微信微信配置信息 payChannelEntiy = payChannelBLL.GetByID(order.PayChannelID); if (payChannelEntiy != null) { if (payChannelEntiy.PayType == 6)//微信公众号支付 { para = new WeiXinOrderQuery.OrderQueryPara(); para = payChannelEntiy.ChannelParameters.DeserializeJSONTo <WeiXinOrderQuery.OrderQueryPara>(); para.out_trade_no = order.OrderID.ToString(); WeiXinOrderQuery.OrderQueryInfo result = orderQuery.OrderQuery(para); if (result.return_code == "SUCCESS" && result.result_code == "SUCCESS") { if (result.trade_state == "SUCCESS") //交易状态=支付成功 { order.Status = 2; //付款成功 appOrderBLL.Update(order); } } } } } } catch (Exception ex) { Loggers.Exception(new ExceptionLogInfo(ex)); } }