Пример #1
0
        //
        // 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());
        }
Пример #2
0
        /// <summary>
        /// 用户注册时,生成验证码
        /// </summary>
        /// <param name="mobile"></param>
        /// <returns></returns>
        public int GetSMS(string mobile, string ip)
        {
            using (var db = new BFdbContext())
            {
                if (db.tblusers.Any(p => p.Mobile == mobile && p.Status == 0))
                {
                    return(-1);
                }

                DateTime dt   = DateTime.Now.AddDays(-2);
                int      cntt = db.tbluserstime.Count(p => p.RomateIp == ip && p.crtdate >= dt);
                if (cntt >= 10)
                {
                    return(-3);
                }

                int cnt = db.tbluserstime.Count(p => p.Mobile == mobile && p.crtdate >= dt);
                if (cnt >= 10)
                {
                    return(-2);
                }

                tblusers usr = new tblusers();
                usr.Mobile = mobile;
                usr.Passwd = "-";
                usr.mono   = VerifyCode.Get6SzCode();
                //测试注册验证码改成固定数值
                //usr.mono = "123456";
                usr.Status   = 4;
                usr.Playerid = 0;
                usr.userid   = Guid.NewGuid().ToString();
                usr.Isupt    = "0";
                usr.Type     = "8";
                usr.Ismod    = "";

                int res = db.Insert <tblusers>(usr);

                tbluserstime tm = new tbluserstime();
                tm.crtdate  = DateTime.Now;
                tm.Mobile   = mobile;
                tm.tid      = Guid.NewGuid().ToString();
                tm.RomateIp = ip;
                db.Insert <tbluserstime>(tm);

                if (res > 0)
                {
                    SMSHepler.SendRegSms(mobile, usr.mono);
                }

                return(res);
            }
        }
Пример #3
0
        /// <summary>
        /// 忘记密码时,生成验证码
        /// </summary>
        /// <param name="mobile"></param>
        /// <returns></returns>
        public int GetGSMS(string mobile)
        {
            using (var db = new BFdbContext())
            {
                tblusers usr = db.tblusers.FirstOrDefault(p => p.Mobile == mobile && p.Status == 0);
                if (usr == null)
                {
                    return(-1);
                }

                usr.mono = VerifyCode.Get6SzCode();

                int res = db.Update <tblusers>(usr);

                if (res > 0)
                {
                    SMSHepler.SendGetSms(mobile, usr.mono);
                }

                return(res);
            }
        }
Пример #4
0
        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("无通知参数"));
            }
        }