// // GET: /pay/ public ActionResult success_return() { SortedDictionary <string, string> sPara = GetRequestGet(); WriteLog("success_return:", sPara); if (sPara.Count > 0)//判断是否有带返回参数 { Notify aliNotify = new Notify(); bool verifyResult = aliNotify.Verify(sPara, Request.QueryString["notify_id"], Request.QueryString["sign"]); if (verifyResult)//验证成功 { ViewBag.flag = "0"; //商户订单号 string out_trade_no = Request.QueryString["out_trade_no"]; //支付宝交易号 string trade_no = Request.QueryString["trade_no"]; //交易状态 string trade_status = Request.QueryString["trade_status"]; string buyer_email = Request.QueryString["buyer_email"]; MembershipBll bll = new MembershipBll(); bll.PayReturn(out_trade_no, trade_no, buyer_email, trade_status); if (trade_status == "TRADE_FINISHED" || trade_status == "TRADE_SUCCESS" || trade_status == "9000") { var m = bll.GetMatchByOrderId(out_trade_no); ViewBag.price = Request.QueryString["price"]; ViewBag.title = Request.QueryString["subject"]; ViewBag.no = trade_no; ViewBag.match = m.Match_name; ViewBag.date = m.Date4.Value.ToString("yyyy-MM-dd"); SMSHepler.SendCommonSms(m.Mobile, string.Format("[{0}]报名费用已经成功支付,感谢你的参与!请妥善保管帐号信息,等待查询比赛编组.", m.Match_name)); } } else//验证失败 { //Response.Write("验证失败"); ViewBag.flag = "1"; } } else { //Response.Write("无返回参数"); ViewBag.flag = "1"; } return(View()); }
public ContentResult notify_return() { SortedDictionary <string, string> sPara = GetRequestPost(); WriteLog("notify_return:", sPara); 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"]; string buyer_email = Request.Form["buyer_email"]; if (trade_status == "TRADE_FINISHED" || trade_status == "TRADE_SUCCESS" || trade_status == "9000") { MembershipBll bll = new MembershipBll(); bll.PayReturn(out_trade_no, trade_no, buyer_email, trade_status); var m = bll.GetMatchByOrderId(out_trade_no); //log4net.ILog log = log4net.LogManager.GetLogger(this.GetType()); //log.Fatal(trade_status); SMSHepler.SendCommonSms(m.Mobile, string.Format("[{0}]报名费用已经成功支付,感谢你的参与!请妥善保管帐号信息,等待查询比赛编组.", m.Match_name)); } //——请根据您的业务逻辑来编写程序(以上代码仅作参考)—— //Response.Write("success"); //请不要修改或删除 return(this.Content("success")); ///////////////////////////////////////////////////////////////////////////////////////////////////////////// } //else//验证失败 //{ //Response.Write("fail"); // return this.Content("fail"); //} } else { //Response.Write("无通知参数"); return(this.Content("无通知参数")); } }