protected void Page_Load(object sender, EventArgs e) { if (!base.IsPostBack) { try { SortedDictionary <string, object> m_values = new SortedDictionary <string, object>(); Stream s = base.Request.InputStream; byte[] buffer = new byte[1024]; StringBuilder builder = new StringBuilder(); int count; while ((count = s.Read(buffer, 0, 1024)) > 0) { builder.Append(Encoding.UTF8.GetString(buffer, 0, count)); } s.Flush(); s.Close(); s.Dispose(); XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(builder.ToString()); XmlNode xmlNode = xmlDoc.FirstChild; XmlNodeList nodes = xmlNode.ChildNodes; foreach (XmlNode xn in nodes) { XmlElement xe = (XmlElement)xn; m_values[xe.Name] = xe.InnerText; } if (!(m_values["return_code"].ToString() != "SUCCESS")) { string out_trade_no = m_values["out_trade_no"].ToString(); string appid = m_values["appid"].ToString(); string mch_id = m_values["mch_id"].ToString(); string transaction_id = m_values["transaction_id"].ToString(); string nonce_str = m_values["nonce_str"].ToString(); string sign = m_values["sign"].ToString(); string time_end = m_values["time_end"].ToString(); string attach = m_values["attach"].ToString(); string[] sz = attach.Split(new char[] { ',' }); string type = sz[0]; string text = type; if (text != null) { if (text == "Membersrecharge") { Chain.BLL.MemRecharge bllMemRecharge = new Chain.BLL.MemRecharge(); DataSet ds = bllMemRecharge.GetList(string.Format(" RechargeAccount='{0}'", out_trade_no)); if (ds.Tables[0].Rows.Count > 0) { base.Response.Write(this.ToXml("SUCCESS", "")); base.Response.End(); } else { CheckOrder checkorder = new CheckOrder(); Sign signss = new Sign(); Chain.Model.SysParameter modelSysParameter = new Chain.BLL.SysParameter().GetModel(1); string ordertrackingsign = signss.OrderTrackingSign(appid, mch_id, nonce_str, out_trade_no, transaction_id, modelSysParameter.Api); XmlNode xmNode = checkorder.GetCheckOrder(appid, mch_id, transaction_id, out_trade_no, nonce_str, ordertrackingsign); string trade_state = xmNode["trade_state"].InnerText.ToUpper(); if (!(trade_state != "SUCCESS")) { int total_fee = Convert.ToInt32(sz[2]); int total_fees = Convert.ToInt32(m_values["total_fee"]); if (total_fee == total_fees) { text = type; if (text != null) { if (!(text == "Membersrecharge")) { if (text == "ShopMembersRecharge") { base.Response.Write(this.ToXml("SUCCESS", "")); base.Response.End(); } } else { this.Membersrecharge(sz[1], sz[2], sz[3], sz[4], out_trade_no, time_end); } } } } } } } } } catch (Exception) { } } }