protected void Page_Load(object sender, EventArgs e) { SortedDictionary <string, string> sPara = GetRequestPost(); if (sPara.Count > 0)//判断是否有带返回参数 { Notify aliNotify = new Notify(); bool verifyResult = aliNotify.Verify(sPara, Request.QueryString["notify_id"], Request.QueryString["sign"]); if (verifyResult)//验证成功 { ///////////////////////////////////////////////////////////////////////////////////////////////////////////// //请在这里加上商户的业务逻辑程序代码 //——请根据您的业务逻辑来编写程序(以下代码仅作参考)—— //获取支付宝的通知返回参数,可参考技术文档中服务器异步通知参数列表 //商户订单号 string out_trade_no = Request.QueryString["out_trade_no"]; //支付宝交易号 string trade_no = Request.QueryString["trade_no"]; //交易状态 string trade_status = Request.QueryString["trade_status"]; Eyousoft_yhq.BLL.Order OrderType = new Eyousoft_yhq.BLL.Order(); var OrderModel = new Eyousoft_yhq.Model.Order(); string res = string.Empty; if (trade_status == "TRADE_FINISHED") { } else if (Request.QueryString["trade_status"] == "TRADE_SUCCESS") { OrderModel = OrderType.GetModel(out_trade_no); if (OrderModel != null && OrderModel.PayState != Eyousoft_yhq.Model.PaymentState.已支付) { Eyousoft_yhq.Model.MConDetaile jilu = new Eyousoft_yhq.Model.MConDetaile() { HuiYuanID = OrderModel.MemberID, XFway = Eyousoft_yhq.Model.XFfangshi.消费, DingDanBianHao = OrderModel.OrderCode, JiaoYiHao = DateTime.Now.ToString("yyyyMMddHHmm") + Eyousoft_yhq.SQLServerDAL.Utils.GetRandomString(5), JiaoYiShiJian = DateTime.Now, DDCarrtes = Eyousoft_yhq.Model.DDleibie.旅游订单, JinE = OrderModel.OrderPrice }; new Eyousoft_yhq.BLL.BConDetaile().Add(jilu);//消费记录 string Ra = Eyousoft_yhq.SQLServerDAL.Utils.GetRandomString(12); while (OrderType.Exists(Ra)) { Ra = Eyousoft_yhq.SQLServerDAL.Utils.GetRandomString(12); } Eyousoft_yhq.Model.Order OrderInfo = new Eyousoft_yhq.Model.Order() { OrderID = out_trade_no, PayState = Eyousoft_yhq.Model.PaymentState.已支付, ConfirmCode = Ra, OrderState = Eyousoft_yhq.Model.OrderState.已成交 }; int Sum = OrderType.UpdatePayState(OrderInfo); if (Sum > 0) { Eyousoft_yhq.BLL.Member UM = new Eyousoft_yhq.BLL.Member(); bool Mo = UM.GetModel(OrderModel.MemberID).valiUser; if (!Mo) { #region 短信发送 string code = string.Empty; IList <Eyousoft_yhq.Model.SMSChannel> channel = Eyousoft_yhq.Web.BsendMsg.CommonProcess.GetSMSChannels(); code = string.Format("下单成功,确认码:{0}!【惠旅游】", Ra); Eyousoft_yhq.Web.BsendMsg.CommonProcess.SendSMS(OrderModel.MemberTel, code, channel[0], out res);//发送 #endregion #region 短信日志 Eyousoft_yhq.Model.MsgLog MsLog = new Eyousoft_yhq.Model.MsgLog { TelCode = OrderModel.MemberTel, MsgText = code, ReResult = res }; new Eyousoft_yhq.BLL.MsgLog().Add(MsLog); #endregion } } } var chongzhiModel = new Eyousoft_yhq.BLL.BChongZhi().GetModel(out_trade_no); if (chongzhiModel != null && chongzhiModel.PayState == Eyousoft_yhq.Model.PaymentState.未支付) { var member = new Eyousoft_yhq.BLL.Member().GetModel(chongzhiModel.OperatorID); if (member != null) { member.YuE = member.YuE + chongzhiModel.OptMoney; bool result = new Eyousoft_yhq.BLL.Member().Update(member); } new Eyousoft_yhq.BLL.BChongZhi().SheZhiZhiFus(out_trade_no, Eyousoft_yhq.Model.PaymentState.已支付); } } else { } //——请根据您的业务逻辑来编写程序(以上代码仅作参考)—— Response.Write("success"); //请不要修改或删除 Response.Redirect("/Huiyuan/OrderList.aspx"); ///////////////////////////////////////////////////////////////////////////////////////////////////////////// } else//验证失败 { Response.Write("fail"); } } else { Response.Write("无通知参数"); } }
protected void Page_Load(object sender, EventArgs e) { Dictionary <string, string> sPara = GetRequestGet(); if (sPara.Count > 0)//判断是否有带返回参数 { Notify aliNotify = new Notify(); bool verifyResult = aliNotify.VerifyReturn(sPara, Request.QueryString["sign"]); if (verifyResult)//验证成功 { ///////////////////////////////////////////////////////////////////////////////////////////////////////////// //请在这里加上商户的业务逻辑程序代码 //——请根据您的业务逻辑来编写程序(以下代码仅作参考)—— //获取支付宝的通知返回参数,可参考技术文档中页面跳转同步通知参数列表 //商户订单号 string out_trade_no = Request.QueryString["out_trade_no"]; //支付宝交易号 string trade_no = Request.QueryString["trade_no"]; //交易状态 string result = Request.QueryString["result"]; Eyousoft_yhq.BLL.Order OrderType = new Eyousoft_yhq.BLL.Order(); var OrderModel = new Eyousoft_yhq.Model.Order(); string res = string.Empty; if (result == "success") { //纪录充值消费纪录 try { string price = Request.QueryString["price"]; Eyousoft_yhq.BLL.BConDetaile service = new Eyousoft_yhq.BLL.BConDetaile(); Eyousoft_yhq.Model.MConDetaile con = new Eyousoft_yhq.Model.MConDetaile(); con.JiaoYiHao = trade_no; con.DingDanBianHao = out_trade_no; con.JinE = Decimal.Parse(price); con.JiaoYiShiJian = DateTime.Now; con.XFway = Eyousoft_yhq.Model.XFfangshi.消费; EyouSoft.Model.SSOStructure.MUserInfo userInfo = Session["HuiYuanInfo"] as EyouSoft.Model.SSOStructure.MUserInfo; con.HuiYuanID = userInfo.UserID; service.Add(con); } catch (Exception) { } OrderModel = OrderType.GetModel(out_trade_no); if (OrderModel.PayState != Eyousoft_yhq.Model.PaymentState.已支付) { string Ra = Eyousoft_yhq.SQLServerDAL.Utils.GetRandomString(12); while (OrderType.Exists(Ra)) { Ra = Eyousoft_yhq.SQLServerDAL.Utils.GetRandomString(12); } Eyousoft_yhq.Model.Order OrderInfo = new Eyousoft_yhq.Model.Order() { OrderID = out_trade_no, PayState = Eyousoft_yhq.Model.PaymentState.已支付, ConfirmCode = Ra, OrderState = Eyousoft_yhq.Model.OrderState.已成交 }; int Sum = OrderType.UpdatePayState(OrderInfo); if (Sum > 0) { Eyousoft_yhq.BLL.Member UM = new Eyousoft_yhq.BLL.Member(); bool Mo = UM.GetModel(OrderModel.MemberID).valiUser; if (!Mo) { #region 短信发送 string code = string.Empty; IList <Eyousoft_yhq.Model.SMSChannel> channel = Eyousoft_yhq.Web.BsendMsg.CommonProcess.GetSMSChannels(); //code = CreateZxingCode(Ra) + string.Format("下单成功,确认码:{0}!【惠旅游】", Ra);//生成二维码,发送彩信 Eyousoft_yhq.Web.BsendMsg.CommonProcess.SendSMS(OrderModel.MemberTel, code, channel[0], out res);//发送 #endregion #region 短信日志 Eyousoft_yhq.Model.MsgLog MsLog = new Eyousoft_yhq.Model.MsgLog { TelCode = OrderModel.MemberTel, MsgText = code, ReResult = res }; new Eyousoft_yhq.BLL.MsgLog().Add(MsLog); #endregion } } } } Response.Redirect("/AppPage/orderlist.aspx"); //——请根据您的业务逻辑来编写程序(以上代码仅作参考)—— ///////////////////////////////////////////////////////////////////////////////////////////////////////////// } else//验证失败 { Response.Write("验证失败"); } } else { Response.Write("无返回参数"); } }
protected void Page_Load(object sender, EventArgs e) { SortedDictionary<string, string> sPara = GetRequestPost(); if (sPara.Count > 0)//判断是否有带返回参数 { Notify aliNotify = new Notify(); bool verifyResult = aliNotify.Verify(sPara, Request.QueryString["notify_id"], Request.QueryString["sign"]); if (verifyResult)//验证成功 { ///////////////////////////////////////////////////////////////////////////////////////////////////////////// //请在这里加上商户的业务逻辑程序代码 //——请根据您的业务逻辑来编写程序(以下代码仅作参考)—— //获取支付宝的通知返回参数,可参考技术文档中服务器异步通知参数列表 //商户订单号 string out_trade_no = Request.QueryString["out_trade_no"]; //支付宝交易号 string trade_no = Request.QueryString["trade_no"]; //交易状态 string trade_status = Request.QueryString["trade_status"]; Eyousoft_yhq.BLL.Order OrderType = new Eyousoft_yhq.BLL.Order(); var OrderModel = new Eyousoft_yhq.Model.Order(); string res = string.Empty; if (trade_status == "TRADE_FINISHED") { } else if (Request.QueryString["trade_status"] == "TRADE_SUCCESS") { OrderModel = OrderType.GetModel(out_trade_no); if (OrderModel != null && OrderModel.PayState != Eyousoft_yhq.Model.PaymentState.已支付) { Eyousoft_yhq.Model.MConDetaile jilu = new Eyousoft_yhq.Model.MConDetaile() { HuiYuanID = OrderModel.MemberID, XFway = Eyousoft_yhq.Model.XFfangshi.消费, DingDanBianHao = OrderModel.OrderCode, JiaoYiHao = DateTime.Now.ToString("yyyyMMddHHmm") + Eyousoft_yhq.SQLServerDAL.Utils.GetRandomString(5), JiaoYiShiJian = DateTime.Now, DDCarrtes = Eyousoft_yhq.Model.DDleibie.旅游订单, JinE = OrderModel.OrderPrice }; new Eyousoft_yhq.BLL.BConDetaile().Add(jilu);//消费记录 string Ra = Eyousoft_yhq.SQLServerDAL.Utils.GetRandomString(12); while (OrderType.Exists(Ra)) { Ra = Eyousoft_yhq.SQLServerDAL.Utils.GetRandomString(12); } Eyousoft_yhq.Model.Order OrderInfo = new Eyousoft_yhq.Model.Order() { OrderID = out_trade_no, PayState = Eyousoft_yhq.Model.PaymentState.已支付, ConfirmCode = Ra, OrderState = Eyousoft_yhq.Model.OrderState.已成交 }; int Sum = OrderType.UpdatePayState(OrderInfo); if (Sum > 0) { Eyousoft_yhq.BLL.Member UM = new Eyousoft_yhq.BLL.Member(); bool Mo = UM.GetModel(OrderModel.MemberID).valiUser; if (!Mo) { #region 短信发送 string code = string.Empty; IList<Eyousoft_yhq.Model.SMSChannel> channel = Eyousoft_yhq.Web.BsendMsg.CommonProcess.GetSMSChannels(); code = string.Format("下单成功,确认码:{0}!【惠旅游】", Ra); Eyousoft_yhq.Web.BsendMsg.CommonProcess.SendSMS(OrderModel.MemberTel, code, channel[0], out res);//发送 #endregion #region 短信日志 Eyousoft_yhq.Model.MsgLog MsLog = new Eyousoft_yhq.Model.MsgLog { TelCode = OrderModel.MemberTel, MsgText = code, ReResult = res }; new Eyousoft_yhq.BLL.MsgLog().Add(MsLog); #endregion } } } var chongzhiModel = new Eyousoft_yhq.BLL.BChongZhi().GetModel(out_trade_no); if (chongzhiModel != null && chongzhiModel.PayState == Eyousoft_yhq.Model.PaymentState.未支付) { var member = new Eyousoft_yhq.BLL.Member().GetModel(chongzhiModel.OperatorID); if (member != null) { member.YuE = member.YuE + chongzhiModel.OptMoney; bool result = new Eyousoft_yhq.BLL.Member().Update(member); } new Eyousoft_yhq.BLL.BChongZhi().SheZhiZhiFus(out_trade_no, Eyousoft_yhq.Model.PaymentState.已支付); } } else { } //——请根据您的业务逻辑来编写程序(以上代码仅作参考)—— Response.Write("success"); //请不要修改或删除 Response.Redirect("/Huiyuan/OrderList.aspx"); ///////////////////////////////////////////////////////////////////////////////////////////////////////////// } else//验证失败 { Response.Write("fail"); } } else { Response.Write("无通知参数"); } }
protected void Page_Load(object sender, EventArgs e) { Dictionary<string, string> sPara = GetRequestPost(); if (sPara.Count > 0)//判断是否有带返回参数 { Notify aliNotify = new Notify(); bool verifyResult = aliNotify.VerifyNotify(sPara, Request.Form["sign"]); if (verifyResult)//验证成功 { ///////////////////////////////////////////////////////////////////////////////////////////////////////////// //请在这里加上商户的业务逻辑程序代码 //——请根据您的业务逻辑来编写程序(以下代码仅作参考)—— //获取支付宝的通知返回参数,可参考技术文档中服务器异步通知参数列表 //解密(如果是RSA签名需要解密,如果是MD5签名则下面一行清注释掉) sPara = aliNotify.Decrypt(sPara); //XML解析notify_data数据 try { XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(sPara["notify_data"]); //商户订单号 string out_trade_no = xmlDoc.SelectSingleNode("/notify/out_trade_no").InnerText; //支付宝交易号 string trade_no = xmlDoc.SelectSingleNode("/notify/trade_no").InnerText; //交易状态 string trade_status = xmlDoc.SelectSingleNode("/notify/trade_status").InnerText; if (trade_status == "TRADE_FINISHED")//交易成功 { Response.Write("success"); } else if (trade_status == "TRADE_SUCCESS")//支付成功 { Eyousoft_yhq.BLL.Order OrderType = new Eyousoft_yhq.BLL.Order(); var OrderModel = new Eyousoft_yhq.Model.Order(); OrderModel = OrderType.GetModel(out_trade_no); string res = string.Empty; if (OrderModel.PayState != Eyousoft_yhq.Model.PaymentState.已支付) { string Ra = Eyousoft_yhq.SQLServerDAL.Utils.GetRandomString(12); while (OrderType.Exists(Ra)) { Ra = Eyousoft_yhq.SQLServerDAL.Utils.GetRandomString(12); } Eyousoft_yhq.Model.Order OrderInfo = new Eyousoft_yhq.Model.Order() { OrderID = out_trade_no, PayState = Eyousoft_yhq.Model.PaymentState.已支付, ConfirmCode = Ra, OrderState = Eyousoft_yhq.Model.OrderState.已成交, JIESUAN = Eyousoft_yhq.Model.JSfangshi.预付 }; int Sum = OrderType.UpdatePayState(OrderInfo); if (Sum > 0) { Eyousoft_yhq.BLL.Member UM = new Eyousoft_yhq.BLL.Member(); bool Mo = UM.GetModel(OrderModel.MemberID).valiUser; if (!Mo) { #region 短信发送 string code = string.Empty; IList<Eyousoft_yhq.Model.SMSChannel> channel = Eyousoft_yhq.Web.BsendMsg.CommonProcess.GetSMSChannels(); code = string.Format("下单成功,确认码:{0}!【惠旅游】", Ra); Eyousoft_yhq.Web.BsendMsg.CommonProcess.SendSMS(OrderModel.MemberTel, code, channel[0], out res);//发送 #endregion #region 短信日志 Eyousoft_yhq.Model.MsgLog MsLog = new Eyousoft_yhq.Model.MsgLog { TelCode = OrderModel.MemberTel, MsgText = code, ReResult = res }; new Eyousoft_yhq.BLL.MsgLog().Add(MsLog); #endregion } } } Response.Redirect("/AppPage/orderlist.aspx"); } else { Response.Write(trade_status); } } catch (Exception exc) { Response.Write(exc.ToString()); } //——请根据您的业务逻辑来编写程序(以上代码仅作参考)—— ///////////////////////////////////////////////////////////////////////////////////////////////////////////// } else//验证失败 { Response.Write("fail"); } } else { Response.Write("无通知参数"); } }
protected void Page_Load(object sender, EventArgs e) { Dictionary <string, string> sPara = GetRequestPost(); if (sPara.Count > 0)//判断是否有带返回参数 { Notify aliNotify = new Notify(); bool verifyResult = aliNotify.VerifyNotify(sPara, Request.Form["sign"]); if (verifyResult)//验证成功 { ///////////////////////////////////////////////////////////////////////////////////////////////////////////// //请在这里加上商户的业务逻辑程序代码 //——请根据您的业务逻辑来编写程序(以下代码仅作参考)—— //获取支付宝的通知返回参数,可参考技术文档中服务器异步通知参数列表 //解密(如果是RSA签名需要解密,如果是MD5签名则下面一行清注释掉) sPara = aliNotify.Decrypt(sPara); //XML解析notify_data数据 try { XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(sPara["notify_data"]); //商户订单号 string out_trade_no = xmlDoc.SelectSingleNode("/notify/out_trade_no").InnerText; //支付宝交易号 string trade_no = xmlDoc.SelectSingleNode("/notify/trade_no").InnerText; //交易状态 string trade_status = xmlDoc.SelectSingleNode("/notify/trade_status").InnerText; if (trade_status == "TRADE_FINISHED")//交易成功 { Response.Write("success"); } else if (trade_status == "TRADE_SUCCESS")//支付成功 { Eyousoft_yhq.BLL.Order OrderType = new Eyousoft_yhq.BLL.Order(); var OrderModel = new Eyousoft_yhq.Model.Order(); OrderModel = OrderType.GetModel(out_trade_no); string res = string.Empty; if (OrderModel.PayState != Eyousoft_yhq.Model.PaymentState.已支付) { string Ra = Eyousoft_yhq.SQLServerDAL.Utils.GetRandomString(12); while (OrderType.Exists(Ra)) { Ra = Eyousoft_yhq.SQLServerDAL.Utils.GetRandomString(12); } Eyousoft_yhq.Model.Order OrderInfo = new Eyousoft_yhq.Model.Order() { OrderID = out_trade_no, PayState = Eyousoft_yhq.Model.PaymentState.已支付, ConfirmCode = Ra, OrderState = Eyousoft_yhq.Model.OrderState.已成交, JIESUAN = Eyousoft_yhq.Model.JSfangshi.预付 }; int Sum = OrderType.UpdatePayState(OrderInfo); if (Sum > 0) { Eyousoft_yhq.BLL.Member UM = new Eyousoft_yhq.BLL.Member(); bool Mo = UM.GetModel(OrderModel.MemberID).valiUser; if (!Mo) { #region 短信发送 string code = string.Empty; IList <Eyousoft_yhq.Model.SMSChannel> channel = Eyousoft_yhq.Web.BsendMsg.CommonProcess.GetSMSChannels(); code = string.Format("下单成功,确认码:{0}!【惠旅游】", Ra); Eyousoft_yhq.Web.BsendMsg.CommonProcess.SendSMS(OrderModel.MemberTel, code, channel[0], out res);//发送 #endregion #region 短信日志 Eyousoft_yhq.Model.MsgLog MsLog = new Eyousoft_yhq.Model.MsgLog { TelCode = OrderModel.MemberTel, MsgText = code, ReResult = res }; new Eyousoft_yhq.BLL.MsgLog().Add(MsLog); #endregion } } } Response.Redirect("/AppPage/orderlist.aspx"); } else { Response.Write(trade_status); } } catch (Exception exc) { Response.Write(exc.ToString()); } //——请根据您的业务逻辑来编写程序(以上代码仅作参考)—— ///////////////////////////////////////////////////////////////////////////////////////////////////////////// } else//验证失败 { Response.Write("fail"); } } else { Response.Write("无通知参数"); } }
protected void Page_Load(object sender, EventArgs e) { SortedDictionary <string, string> sPara = GetRequestPost(); if (sPara.Count > 0)//判断是否有带返回参数 { Notify aliNotify = new Notify(); bool verifyResult = aliNotify.Verify(sPara, Request.Form["notify_id"], Request.Form["sign"]); if (verifyResult)//验证成功 { ///////////////////////////////////////////////////////////////////////////////////////////////////////////// //请在这里加上商户的业务逻辑程序代码 //——请根据您的业务逻辑来编写程序(以下代码仅作参考)—— //获取支付宝的通知返回参数,可参考技术文档中服务器异步通知参数列表 //商户订单号 string out_trade_no = Request.Form["out_trade_no"]; //支付宝交易号 string trade_no = Request.Form["trade_no"]; //交易状态 string trade_status = Request.Form["trade_status"]; if (Request.Form["trade_status"] == "TRADE_FINISHED") { Response.Write("success"); } else if (Request.Form["trade_status"] == "TRADE_SUCCESS") { var OrderModel = new Eyousoft_yhq.Model.Order(); var OrderBll = new Eyousoft_yhq.BLL.Order(); OrderModel = OrderBll.GetModel(out_trade_no); if (OrderModel != null && OrderModel.PayState == Eyousoft_yhq.Model.PaymentState.未支付) { string result = string.Empty; string Ra = Eyousoft_yhq.SQLServerDAL.Utils.GetRandomString(12); while (OrderBll.Exists(Ra)) { Ra = Eyousoft_yhq.SQLServerDAL.Utils.GetRandomString(12); } OrderModel.OrderID = out_trade_no; OrderModel.PayState = Eyousoft_yhq.Model.PaymentState.已支付; OrderModel.OrderState = Eyousoft_yhq.Model.OrderState.已成交; OrderModel.ConfirmCode = Ra; int Sum = OrderBll.UpdatePayState(OrderModel); if (Sum > 0) { Eyousoft_yhq.BLL.Member UM = new Eyousoft_yhq.BLL.Member(); bool Mo = UM.GetModel(OrderModel.MemberID).valiUser; if (!Mo) { #region 短信发送 string code = string.Empty; IList <Eyousoft_yhq.Model.SMSChannel> channel = Eyousoft_yhq.Web.BsendMsg.CommonProcess.GetSMSChannels(); code = string.Format("下单成功,确认码:{0}!【惠旅游】", Ra); Eyousoft_yhq.Web.BsendMsg.CommonProcess.SendSMS(OrderModel.MemberTel, code, channel[0], out result);//发送 #region 短信日志 Eyousoft_yhq.Model.MsgLog MsLog = new Eyousoft_yhq.Model.MsgLog { TelCode = OrderModel.MemberTel, MsgText = code, ReResult = result }; new Eyousoft_yhq.BLL.MsgLog().Add(MsLog); #endregion #endregion } } } var chongzhiModel = new Eyousoft_yhq.BLL.BChongZhi().GetModel(out_trade_no); if (chongzhiModel != null && chongzhiModel.PayState == Eyousoft_yhq.Model.PaymentState.未支付) { var member = new Eyousoft_yhq.BLL.Member().GetModel(chongzhiModel.OperatorID); if (member != null) { member.YuE = member.YuE + chongzhiModel.OptMoney; bool result = new Eyousoft_yhq.BLL.Member().Update(member); } new Eyousoft_yhq.BLL.BChongZhi().SheZhiZhiFus(out_trade_no, Eyousoft_yhq.Model.PaymentState.已支付); } } else { } //——请根据您的业务逻辑来编写程序(以上代码仅作参考)—— Response.Write("success"); //请不要修改或删除 ///////////////////////////////////////////////////////////////////////////////////////////////////////////// } else//验证失败 { Response.Write("fail"); } } else { Response.Write("无通知参数"); } }
protected void Page_Load(object sender, EventArgs e) { SortedDictionary<string, string> sPara = GetRequestPost(); if (sPara.Count > 0)//判断是否有带返回参数 { Notify aliNotify = new Notify(); bool verifyResult = aliNotify.Verify(sPara, Request.Form["notify_id"], Request.Form["sign"]); if (verifyResult)//验证成功 { ///////////////////////////////////////////////////////////////////////////////////////////////////////////// //请在这里加上商户的业务逻辑程序代码 //——请根据您的业务逻辑来编写程序(以下代码仅作参考)—— //获取支付宝的通知返回参数,可参考技术文档中服务器异步通知参数列表 //商户订单号 string out_trade_no = Request.Form["out_trade_no"]; //支付宝交易号 string trade_no = Request.Form["trade_no"]; //交易状态 string trade_status = Request.Form["trade_status"]; if (Request.Form["trade_status"] == "TRADE_FINISHED") { Response.Write("success"); } else if (Request.Form["trade_status"] == "TRADE_SUCCESS") { var OrderModel = new Eyousoft_yhq.Model.Order(); var OrderBll = new Eyousoft_yhq.BLL.Order(); OrderModel = OrderBll.GetModel(out_trade_no); if (OrderModel != null && OrderModel.PayState == Eyousoft_yhq.Model.PaymentState.未支付) { string result = string.Empty; string Ra = Eyousoft_yhq.SQLServerDAL.Utils.GetRandomString(12); while (OrderBll.Exists(Ra)) { Ra = Eyousoft_yhq.SQLServerDAL.Utils.GetRandomString(12); } OrderModel.OrderID = out_trade_no; OrderModel.PayState = Eyousoft_yhq.Model.PaymentState.已支付; OrderModel.OrderState = Eyousoft_yhq.Model.OrderState.已成交; OrderModel.ConfirmCode = Ra; int Sum = OrderBll.UpdatePayState(OrderModel); if (Sum > 0) { Eyousoft_yhq.BLL.Member UM = new Eyousoft_yhq.BLL.Member(); bool Mo = UM.GetModel(OrderModel.MemberID).valiUser; if (!Mo) { #region 短信发送 string code = string.Empty; IList<Eyousoft_yhq.Model.SMSChannel> channel = Eyousoft_yhq.Web.BsendMsg.CommonProcess.GetSMSChannels(); code = string.Format("下单成功,确认码:{0}!【惠旅游】", Ra); Eyousoft_yhq.Web.BsendMsg.CommonProcess.SendSMS(OrderModel.MemberTel, code, channel[0], out result);//发送 #region 短信日志 Eyousoft_yhq.Model.MsgLog MsLog = new Eyousoft_yhq.Model.MsgLog { TelCode = OrderModel.MemberTel, MsgText = code, ReResult = result }; new Eyousoft_yhq.BLL.MsgLog().Add(MsLog); #endregion #endregion } } } var chongzhiModel = new Eyousoft_yhq.BLL.BChongZhi().GetModel(out_trade_no); if (chongzhiModel != null && chongzhiModel.PayState == Eyousoft_yhq.Model.PaymentState.未支付) { var member = new Eyousoft_yhq.BLL.Member().GetModel(chongzhiModel.OperatorID); if (member != null) { member.YuE = member.YuE + chongzhiModel.OptMoney; bool result = new Eyousoft_yhq.BLL.Member().Update(member); } new Eyousoft_yhq.BLL.BChongZhi().SheZhiZhiFus(out_trade_no, Eyousoft_yhq.Model.PaymentState.已支付); } } else { } //——请根据您的业务逻辑来编写程序(以上代码仅作参考)—— Response.Write("success"); //请不要修改或删除 ///////////////////////////////////////////////////////////////////////////////////////////////////////////// } else//验证失败 { Response.Write("fail"); } } else { Response.Write("无通知参数"); } }
protected void Page_Load(object sender, EventArgs e) { Dictionary<string, string> sPara = GetRequestGet(); if (sPara.Count > 0)//判断是否有带返回参数 { Notify aliNotify = new Notify(); bool verifyResult = aliNotify.VerifyReturn(sPara, Request.QueryString["sign"]); if (verifyResult)//验证成功 { ///////////////////////////////////////////////////////////////////////////////////////////////////////////// //请在这里加上商户的业务逻辑程序代码 //——请根据您的业务逻辑来编写程序(以下代码仅作参考)—— //获取支付宝的通知返回参数,可参考技术文档中页面跳转同步通知参数列表 //商户订单号 string out_trade_no = Request.QueryString["out_trade_no"]; //支付宝交易号 string trade_no = Request.QueryString["trade_no"]; //交易状态 string result = Request.QueryString["result"]; Eyousoft_yhq.BLL.Order OrderType = new Eyousoft_yhq.BLL.Order(); var OrderModel = new Eyousoft_yhq.Model.Order(); string res = string.Empty; if (result == "success") { //纪录充值消费纪录 try { string price = Request.QueryString["price"]; Eyousoft_yhq.BLL.BConDetaile service = new Eyousoft_yhq.BLL.BConDetaile(); Eyousoft_yhq.Model.MConDetaile con = new Eyousoft_yhq.Model.MConDetaile(); con.JiaoYiHao = trade_no; con.DingDanBianHao = out_trade_no; con.JinE = Decimal.Parse(price); con.JiaoYiShiJian = DateTime.Now; con.XFway = Eyousoft_yhq.Model.XFfangshi.消费; EyouSoft.Model.SSOStructure.MUserInfo userInfo = Session["HuiYuanInfo"] as EyouSoft.Model.SSOStructure.MUserInfo; con.HuiYuanID = userInfo.UserID; service.Add(con); } catch (Exception) { } OrderModel = OrderType.GetModel(out_trade_no); if (OrderModel.PayState != Eyousoft_yhq.Model.PaymentState.已支付) { string Ra = Eyousoft_yhq.SQLServerDAL.Utils.GetRandomString(12); while (OrderType.Exists(Ra)) { Ra = Eyousoft_yhq.SQLServerDAL.Utils.GetRandomString(12); } Eyousoft_yhq.Model.Order OrderInfo = new Eyousoft_yhq.Model.Order() { OrderID = out_trade_no, PayState = Eyousoft_yhq.Model.PaymentState.已支付, ConfirmCode = Ra, OrderState = Eyousoft_yhq.Model.OrderState.已成交 }; int Sum = OrderType.UpdatePayState(OrderInfo); if (Sum > 0) { Eyousoft_yhq.BLL.Member UM = new Eyousoft_yhq.BLL.Member(); bool Mo = UM.GetModel(OrderModel.MemberID).valiUser; if (!Mo) { #region 短信发送 string code = string.Empty; IList<Eyousoft_yhq.Model.SMSChannel> channel = Eyousoft_yhq.Web.BsendMsg.CommonProcess.GetSMSChannels(); //code = CreateZxingCode(Ra) + string.Format("下单成功,确认码:{0}!【惠旅游】", Ra);//生成二维码,发送彩信 Eyousoft_yhq.Web.BsendMsg.CommonProcess.SendSMS(OrderModel.MemberTel, code, channel[0], out res);//发送 #endregion #region 短信日志 Eyousoft_yhq.Model.MsgLog MsLog = new Eyousoft_yhq.Model.MsgLog { TelCode = OrderModel.MemberTel, MsgText = code, ReResult = res }; new Eyousoft_yhq.BLL.MsgLog().Add(MsLog); #endregion } } } } Response.Redirect("/AppPage/orderlist.aspx"); //——请根据您的业务逻辑来编写程序(以上代码仅作参考)—— ///////////////////////////////////////////////////////////////////////////////////////////////////////////// } else//验证失败 { Response.Write("验证失败"); } } else { Response.Write("无返回参数"); } }