/// <summary> /// 通知接口 /// </summary> /// <param name="pid"></param> /// <param name="mid"></param> /// <param name="Request"></param> /// <returns></returns> public async Task <NotifyReturn> Notify(int pid, int mid, Microsoft.AspNetCore.Http.HttpRequest Request) { Pay_plat p = OnlinePay.GetPlat(pid); Pay_mch m = OnlinePay.GetMch(mid); OnlinePay onlinepay = (OnlinePay)Activator.CreateInstance(Type.GetType(p.Plat_class), p, m); NotifyReturn r = await onlinepay.Notify(Request); if (r.IsCheck) { if (r.IsPay) { Pay_order order = DB.Context.From <Pay_order>().Where(o => o.Order_id == r.OrderNumber).ToFirstDefault(); if (order != null && !string.IsNullOrEmpty(order.Order_id)) { if (order.Status == 0) { order.Status = 1; order.Finish_time = DateTime.Now.ToTimeStamp(); order.Pay_amount = r.Totalfee; order.Notify_status = 0; order.Notify_times = 0; order.Notify_lasttime = DateTime.Now.ToTimeStamp(); DB.Context.Save(order); } } } return(r); } else { return(r); } }
/// <summary> /// 通知接口 /// </summary> /// <param name="pid"></param> /// <param name="mid"></param> /// <param name="Request"></param> /// <returns></returns> public async Task <NotifyReturnModel> Notify(int pid, int mid, Microsoft.AspNetCore.Http.HttpRequest Request) { NotifyReturnModel r = null; try { PayPlat p = OnlinePay.GetPlat(pid); PayMch m = OnlinePay.GetMch(mid); OnlinePay onlinepay = (OnlinePay)Activator.CreateInstance(Type.GetType(p.Plat_class), p, m); r = await onlinepay.Notify(Request); } catch (Exception ex) { Dos.Common.LogHelper.Debug("第三方回调初始化失败:" + ex.Message); throw ex; } if (r.IsCheck) { if (r.IsPay) { PayOrder order = DbContext._.Db.From <PayOrder>().Where(o => o.Order_id == r.OrderNumber).ToFirstDefault(); if (order != null && !string.IsNullOrEmpty(order.Order_id)) { if (order.Status == 0) { order.Attach(EntityState.Modified); order.Status = 1; order.Finish_time = DateTime.Now.ToTimeStamp(); order.Pay_amount = r.Totalfee; order.Notify_status = 0; order.Notify_times = 0; order.Notify_lasttime = DateTime.Now.ToTimeStamp(); order.Plat_order_id = r.SerialNumber; int res = DbContext._.Db.Save(order); } } } return(r); } else { return(r); } }