protected void Page_Load(object sender, EventArgs e) { Tenpay pay = new Tenpay(); var model = pay.GetNotifyAsync(); if (model.IsTradeSuccess) { //Utils.WLog(model.OutTradeNo, "/log/log.txt"); bool rv = false; rv = new Eyousoft_yhq.BLL.BChongZhi().SheZhiZhiFuByOrderCode(model.OutTradeNo, Eyousoft_yhq.Model.PaymentState.已支付); if (rv) { bool IsUpdateState = new Eyousoft_yhq.BLL.BChongZhi().UpdateTradeNO(model.OutTradeNo, model.TradeNo); Response.Clear(); Response.Write("<xml><return_code>SUCCESS</return_code></xml>"); Response.End(); return; } else { //Utils.WLog("验证支付凭据支付失败!!", "/Log/Pay.txt"); return; } } else { //Utils.WLog("支付失败!!", "/Log/Pay1.txt"); return; } }
/// <summary> /// 处理支付信息 /// </summary> /// <param name="OpenId">OpenId</param> /// <param name="Id">支付编号</param> private void InitMember(string OpenId, string Id) { var model = new BWeiXin().GetInfo2(OpenId); if (model != null) { //取得支付信息 var PayModel = new Eyousoft_yhq.BLL.BChongZhi().GetModel(Id); if (PayModel != null) { this.lblAccount.Text = PayModel.OptMoney.ToString("F2"); this.lblCope.Text = PayModel.OptMoney.ToString("F2"); #region 初始化支付信息 Tenpay pay = new Tenpay(); TenPayTradeModel.OPENID = OpenId; TenPayTradeModel.Totalfee = PayModel.OptMoney; TenPayTradeModel.UserIP = Utils.GetRemoteIP(); TenPayTradeModel.OutTradeNo = PayModel.OrderCode; TenPayTradeModel.OrderInfo.Body = "充值金额:" + PayModel.OptMoney.ToString("F2") + "元"; _TenPayTradeModel = pay.Create_url(TenPayTradeModel); #endregion } } }