Exemple #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["openid"] == null)
        {
            if (string.IsNullOrEmpty(Request.QueryString["code"]))
            {
                Response.Redirect("https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + GetWeiXinInf.appid + "&redirect_uri=http://wx.lvwei8.com/index/bindPhone.aspx&response_type=code&scope=snsapi_base&state=123#wechat_redirect");
            }

            else
            {
                string code = Request.QueryString["code"];
                openid = new WEIxinUserApi().GetUserOpenid(code);

                if (openid.Length < 10)
                {
                    Response.Redirect("https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + GetWeiXinInf.appid + "&redirect_uri=http://wx.lvwei8.com/index/bindPhone.aspx&response_type=code&scope=snsapi_base&state=123#wechat_redirect");
                }
            }
            Session["openid"] = openid;
        }
        else
        {
            openid = Session["openid"].ToString();
        }

        if (IsPostBack)
        {
            string mobile = Request.Form["tel"];
            string code   = Request.Form["code"];

            object codeCache = HttpContext.Current.Cache.Get("code" + mobile);
            if (codeCache == null)
            {
                Jscript.NorefLocation(this.Page, "验证码失效请重新获取!手机号为:" + mobile + "code is:" + code, "bindPhone.aspx");
            }
            else
            {
                if (code != codeCache.ToString())
                {
                    Jscript.NorefLocation(this.Page, "验证码不正确!", "bindPhone.aspx");
                }
                else
                {
                    var member = new LVWEIBA.BLL.MemberInfo().GetModel(openid);
                    if (member != null)
                    {
                        if (member.Tel == "" || member.Tel == null)
                        {
                            //更新用户信息
                            var bll = new LVWEIBA.BLL.MemberInfo();
                            member.Tel = mobile.Trim();
                            bll.Update(member);

                            //发放礼券
                            //0020160508000001D5KI
                            List <LVWEIBA.Model.MemberCoupon> list      = new List <LVWEIBA.Model.MemberCoupon>();
                            LVWEIBA.BLL.MemberCoupon          bllCoupon = new LVWEIBA.BLL.MemberCoupon();
                            LVWEIBA.BLL.Coupon_Info           bllCou    = new LVWEIBA.BLL.Coupon_Info();
                            LVWEIBA.Model.Coupon_Info         cou       = bllCou.GetModel("0020160604000001KBW1");
                            LVWEIBA.Model.MemberCoupon        mdl       = new LVWEIBA.Model.MemberCoupon();
                            mdl.CouponID = "0020160604000001KBW1";
                            mdl.Userid   = openid;
                            mdl.ZT       = "0";
                            mdl.Count    = 1;
                            mdl.Sj       = DateTime.Now;
                            mdl.Order_Id = "";
                            list.Add(mdl);
                            //删除缓存
                            HttpContext.Current.Cache.Remove("code" + mobile);
                            if (bllCoupon.SendCouton(list, "0020160604000001KBW1", 1))
                            {
                                Jscript.NorefLocation(this.Page, "手机验证成功!", "Coupon.aspx");
                            }
                            else
                            {
                                Jscript.NorefLocation(this.Page, "手机验证失败!", "Coupon.aspx");
                            }
                        }
                        else
                        {
                            //删除缓存
                            HttpContext.Current.Cache.Remove("code" + mobile);
                            Jscript.NorefLocation(this.Page, "该手机已经验证过!", "bindPhone.aspx");
                        }
                    }
                }
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        UserAuthorizationModel userInfo = UserAuthorization.userLogin(this.Page);

        if (userInfo.openId == null || userInfo.openId == "")
        {
            openid = userInfo.mobile;
        }
        else
        {
            openid = userInfo.openId;
        }
        Session["openid"] = openid;

        if (IsPostBack)
        {
            string mobile = Request.Form["tel"];
            string code   = Request.Form["code"];

            object codeCache = HttpContext.Current.Cache.Get("code" + mobile);
            if (codeCache == null)
            {
                Jscript.NorefLocation(this.Page, "验证码失效请重新获取!手机号为:" + mobile + "code is:" + code, "CouponForOneThousand.aspx");
            }
            else
            {
                if (code != codeCache.ToString())
                {
                    Jscript.NorefLocation(this.Page, "验证码不正确!", "CouponForOneThousand.aspx");
                }
                else
                {
                    var member = new LVWEIBA.BLL.MemberInfo().GetModel(openid);
                    if (member != null)
                    {
                        if (member.Tel == "" || member.Tel == null)
                        {
                            //更新用户信息
                            var bll = new LVWEIBA.BLL.MemberInfo();
                            member.Tel = mobile.Trim();
                            bll.Update(member);
                            //发放礼券(500一张,300元一张,50元2张,20元5张)
                            LVWEIBA.BLL.MemberCoupon bllCoupon = new LVWEIBA.BLL.MemberCoupon();
                            //20元
                            for (int i = 0; i < 5; i++)
                            {
                                List <LVWEIBA.Model.MemberCoupon> list = new List <LVWEIBA.Model.MemberCoupon>();
                                LVWEIBA.Model.MemberCoupon        mdl  = new LVWEIBA.Model.MemberCoupon();
                                mdl.CouponID = "0020160604000001KBW1";
                                mdl.Userid   = openid;
                                mdl.ZT       = "0";
                                mdl.Count    = 5;
                                mdl.Sj       = DateTime.Now;
                                mdl.Order_Id = "";
                                list.Add(mdl);
                                bllCoupon.SendCouton(list, "0020160604000001KBW1", 1);
                            }
                            //50元
                            for (int i = 0; i < 2; i++)
                            {
                                List <LVWEIBA.Model.MemberCoupon> listForFifty = new List <LVWEIBA.Model.MemberCoupon>();
                                LVWEIBA.Model.MemberCoupon        mdlForFifty  = new LVWEIBA.Model.MemberCoupon();
                                mdlForFifty.CouponID = "0020160604000001L511";
                                mdlForFifty.Userid   = openid;
                                mdlForFifty.ZT       = "0";
                                mdlForFifty.Count    = 2;
                                mdlForFifty.Sj       = DateTime.Now;
                                mdlForFifty.Order_Id = "";
                                listForFifty.Add(mdlForFifty);
                                bllCoupon.SendCouton(listForFifty, "0020160604000001L511", 1);
                            }
                            //300元
                            List <LVWEIBA.Model.MemberCoupon> listForThreeHundred = new List <LVWEIBA.Model.MemberCoupon>();
                            LVWEIBA.Model.MemberCoupon        mdlForThreeHundred  = new LVWEIBA.Model.MemberCoupon();
                            mdlForThreeHundred.CouponID = "002016060400000164Q5";
                            mdlForThreeHundred.Userid   = openid;
                            mdlForThreeHundred.ZT       = "0";
                            mdlForThreeHundred.Count    = 1;
                            mdlForThreeHundred.Sj       = DateTime.Now;
                            mdlForThreeHundred.Order_Id = "";
                            listForThreeHundred.Add(mdlForThreeHundred);
                            bllCoupon.SendCouton(listForThreeHundred, "002016060400000164Q5", 1);
                            //500元
                            List <LVWEIBA.Model.MemberCoupon> listForFiveHundred = new List <LVWEIBA.Model.MemberCoupon>();
                            LVWEIBA.Model.MemberCoupon        mdlForFiveHundred  = new LVWEIBA.Model.MemberCoupon();
                            mdlForFiveHundred.CouponID = "00201606200000011KA9";
                            mdlForFiveHundred.Userid   = openid;
                            mdlForFiveHundred.ZT       = "0";
                            mdlForFiveHundred.Count    = 1;
                            mdlForFiveHundred.Sj       = DateTime.Now;
                            mdlForFiveHundred.Order_Id = "";
                            listForFiveHundred.Add(mdlForFiveHundred);
                            bllCoupon.SendCouton(listForFiveHundred, "00201606200000011KA9", 1);

                            //删除缓存
                            HttpContext.Current.Cache.Remove("code" + mobile);
                            Jscript.NorefLocation(this.Page, "领取成功!", "Coupon.aspx");
                        }
                        else
                        {
                            //删除缓存
                            HttpContext.Current.Cache.Remove("code" + mobile);
                            Jscript.NorefLocation(this.Page, "请先验证手机!", "bindPhone.aspx");
                        }
                    }
                }
            }
        }
    }
Exemple #3
0
    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)//验证成功
            {
                /////////////////////////////////////////////////////////////////////////////////////////////////////////////
                //请在这里加上商户的业务逻辑程序代码

                //——请根据您的业务逻辑来编写程序(以下代码仅作参考)——
                //获取支付宝的通知返回参数,可参考技术文档中服务器异步通知参数列表

                //商户订单号
                openId = Request.Form["body"];
                string out_trade_no = Request.Form["out_trade_no"];

                //支付宝交易号

                string trade_no = Request.Form["trade_no"];

                //交易状态
                string trade_status = Request.Form["trade_status"];
                //总额
                string total_fee = Request.Form["total_fee"];


                if (Request.Form["trade_status"] == "TRADE_FINISHED")
                {
                    //
                }
                else if (Request.Form["trade_status"] == "TRADE_SUCCESS")
                {
                    BaseClass.Dal.ChongzhiLog sl = new BaseClass.Dal.ChongzhiLog();
                    bool isOrderValid            = sl.CZisok(out_trade_no, openId);
                    log4netHelper.WriteDebugLog(typeof(notify_url), "订单notify", "订单号:" + out_trade_no + "处理状态:" + isOrderValid);
                    if (isOrderValid)
                    {
                        string  mid   = openId;
                        decimal money = decimal.Parse(total_fee) / 100;
                        LVWEIBA.DAL.order_list   oodd = new LVWEIBA.DAL.order_list();
                        LVWEIBA.Model.order_list oom  = oodd.GetModel(out_trade_no);
                        if (oom.order_zt != "DCX")
                        {
                            //正式状态
                            oom.order_zt = "DCX";
                            oodd.Update(oom);
                            //发送短信通知用户和商户
                            var orderMx = new LVWEIBA.DAL.order_Mx().GetModel(out_trade_no);
                            var member  = new LVWEIBA.BLL.MemberInfo().GetModel(mid);
                            //发送短信通知用户和商户(判断是门票还是尾单)
                            if (orderMx.ProType != null && (orderMx.ProType.Equals("DZP") || orderMx.ProType.Equals("ZZP")))
                            {
                                var bll = new LVWEIBA.DAL.ProviderSpot();
                                LVWEIBA.Model.ProviderSpot providerSpot = bll.GetModel(int.Parse(orderMx.productNum));
                                LVWEIBA.MessageService.NotifyUsersTicket(member.Tel, providerSpot.MasterTel, orderMx);
                                providerSpot.Num = providerSpot.Num - orderMx.ProCount;
                                bll.Update(providerSpot);
                                log4netHelper.WriteDebugLog(typeof(notify_url), "订单notify", "修改余量: productNum is:" + orderMx.productNum + "TicketCount is:" + providerSpot.Num);
                            }
                            else
                            {
                                LVWEIBA.Model.LvULines lvModel = new LVWEIBA.DAL.LvULines().GetModel(orderMx.productNum);
                                LVWEIBA.MessageService.NotifyUsers(member.Tel, lvModel.LineMasterMoble, orderMx);
                                //修改线路余量
                                LVWEIBA.BLL.LvULines lvubLL = new LVWEIBA.BLL.LvULines();
                                if (lvModel != null)
                                {
                                    lvModel.adultTicketCount = lvModel.adultTicketCount - orderMx.adultCount;
                                    lvModel.puppyTicketCount = lvModel.puppyTicketCount - orderMx.puppyCount;
                                    lvubLL.Update(lvModel);
                                    log4netHelper.WriteDebugLog(typeof(notify_url), "订单notify", "修改余量: productNum is:" + orderMx.productNum);
                                }
                            }
                        }
                    }
                }
                //——请根据您的业务逻辑来编写程序(以上代码仅作参考)——
                Response.Write("success");  //请不要修改或删除
                /////////////////////////////////////////////////////////////////////////////////////////////////////////////
            }
            else//验证失败
            {
                string out_trade_no = Request.Form["out_trade_no"];
                moneyUnFreeze(out_trade_no, openId);
                couponUnUse(out_trade_no);
                Response.Write("fail");
            }
        }
        else
        {
            Response.Write("无通知参数");
        }
    }
Exemple #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //if (!IsPostBack)
        //{
        //    try
        //    {
        //        UserAuthorizationModel userInfo = UserAuthorization.userLogin(this.Page);
        //        if (userInfo != null)
        //        {
        //            Response.Redirect("Default.aspx");
        //        }
        //    }
        //    catch (Exception)
        //    {
        //        ////不做处理
        //    }
        //}
        if (IsPostBack)
        {
            string tel  = Request.Form["tel"];
            string pass = Request.Form["pass"];
            string code = Request.Form["code"];

            object codeCache = HttpContext.Current.Cache.Get("code" + tel);
            if (codeCache == null)
            {
                Response.Write("<script>alert('验证码失效');window.location='Login.aspx';</script>");
                return;
            }

            if (code != codeCache.ToString())
            {
                Response.Write("<script>alert('验证码不正确');window.location='Login.aspx';</script>");
                return;
            }

            var     bll     = new LVWEIBA.BLL.MemberInfo();
            var     blllist = new LVWEIBA.BLL.MemberList();
            DataSet ds      = bll.GetList(" tel='" + tel + "'");
            if (ds.Tables[0].Rows.Count > 0)
            {
                string openid = ds.Tables[0].Rows[0]["openid"].ToString();

                UserAuthorizationModel userInfoNow = new UserAuthorizationModel();
                userInfoNow.mobile = tel;
                userInfoNow.openId = openid;
                userInfoNow.name   = tel;
                BaseClass.Common.Common.UserLoginSetCookie(userInfoNow.name, this.Page, DateTime.Now.AddDays(30), userInfoNow);
                log4netHelper.WriteDebugLog(typeof(Login), "login", "用户登录成功:" + userInfoNow.mobile + " " + openid);
                Response.Redirect("~/Default.aspx");
            }
            else
            {
                string openid = BaseClass.Common.Common.getSuijiString(30);

                DBCLASSFORWEIXIN.Model.LocalWeixinUser SingleUserInf = new DBCLASSFORWEIXIN.Model.LocalWeixinUser();
                DBCLASSFORWEIXIN.DAL.LocalWeixinUser   ld            = new DBCLASSFORWEIXIN.DAL.LocalWeixinUser();

                SingleUserInf.country        = "";
                SingleUserInf.province       = "";
                SingleUserInf.city           = "";
                SingleUserInf.remark         = "";
                SingleUserInf.openid         = openid;
                SingleUserInf.regtime        = DateTime.Now;
                SingleUserInf.Tel            = tel;
                SingleUserInf.Jifen          = 0;
                SingleUserInf.money          = 0;
                SingleUserInf.vips           = 0;
                SingleUserInf.pid            = 0;
                SingleUserInf.refresh_token  = "";
                SingleUserInf.nickname       = "";
                SingleUserInf.headimgurl     = "";
                SingleUserInf.subscribe      = 1;
                SingleUserInf.subscribe_time = "";
                SingleUserInf.unionid        = "";
                SingleUserInf.groupid        = 0;
                SingleUserInf.sex            = 1;

                LVWEIBA.BLL.MemberList   bllMember = new LVWEIBA.BLL.MemberList();
                LVWEIBA.Model.MemberList model     = new LVWEIBA.Model.MemberList();


                model.MemberId = openid;
                model.UserPwd  = pass;
                model.Tel      = tel;
                if (bllMember.Add(model) && ld.Add(SingleUserInf) > 0)
                {
                    UserAuthorizationModel userInfoNow = new UserAuthorizationModel();
                    userInfoNow.mobile = tel;
                    userInfoNow.openId = openid;
                    userInfoNow.name   = tel;
                    BaseClass.Common.Common.UserLoginSetCookie(userInfoNow.name, this.Page, DateTime.Now.AddDays(30), userInfoNow);
                    log4netHelper.WriteDebugLog(typeof(Login), "login", "用户注册成功:" + userInfoNow.mobile + " " + openid);
                    Response.Redirect("~/Default.aspx");
                }
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        UserAuthorizationModel userInfo = UserAuthorization.userLogin(this.Page);

        if (userInfo.openId == null || userInfo.openId == "")
        {
            openid_db = userInfo.mobile;
        }
        else
        {
            openid_db = userInfo.openId;
        }
        //Session["openid"] = openid;

        if (string.IsNullOrEmpty(Request.QueryString["code"]))
        {
            Response.Redirect("https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + GetWeiXinInf.appid + "&redirect_uri=http://wx.lvwei8.com/index/CouponForNinety.aspx&response_type=code&scope=snsapi_base&state=123#wechat_redirect");
        }

        else
        {
            string code = Request.QueryString["code"];
            openid_wx = new WEIxinUserApi().GetUserOpenid(code);
            //Session["openid"] = openid;

            if (openid_wx.Length < 10)
            {
                Response.Redirect("https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + GetWeiXinInf.appid + "&redirect_uri=http://wx.lvwei8.com/index/CouponForNinety.aspx&response_type=code&scope=snsapi_base&state=123#wechat_redirect");
            }
            else
            {
            }
        }

        if (IsPostBack)
        {
            string mobile = Request.Form["tel"];
            string code   = Request.Form["code"];

            object codeCache = HttpContext.Current.Cache.Get("code" + mobile);
            if (codeCache == null)
            {
                Jscript.NorefLocation(this.Page, "验证码失效请重新获取!手机号为:" + mobile + "code is:" + code, "CouponForNinety.aspx");
            }
            else
            {
                if (code != codeCache.ToString())
                {
                    Jscript.NorefLocation(this.Page, "验证码不正确!", "CouponForNinety.aspx");
                }
                else
                {
                    var member = new LVWEIBA.BLL.MemberInfo().GetModel(openid_db);
                    if (member != null)
                    {
                        if (member.Tel == "" || member.Tel == null || openid_db != openid_wx)
                        {
                            //更新用户信息
                            var bll = new LVWEIBA.BLL.MemberInfo();
                            member.Tel    = mobile.Trim();
                            member.openid = openid_wx;
                            bll.Update(member);
                            //发放礼券(50元一张,20元俩张)
                            LVWEIBA.BLL.MemberCoupon bllCoupon = new LVWEIBA.BLL.MemberCoupon();
                            for (int i = 0; i < 2; i++)
                            {
                                List <LVWEIBA.Model.MemberCoupon> list = new List <LVWEIBA.Model.MemberCoupon>();
                                LVWEIBA.Model.MemberCoupon        mdl  = new LVWEIBA.Model.MemberCoupon();
                                mdl.CouponID = "0020160604000001KBW1";
                                mdl.Userid   = openid_wx;
                                mdl.ZT       = "0";
                                mdl.Count    = 2;
                                mdl.Sj       = DateTime.Now;
                                mdl.Order_Id = "";
                                list.Add(mdl);
                                bllCoupon.SendCouton(list, "0020160604000001KBW1", 1);
                            }
                            //50元
                            List <LVWEIBA.Model.MemberCoupon> listForFifty = new List <LVWEIBA.Model.MemberCoupon>();
                            LVWEIBA.Model.MemberCoupon        mdlForFifty  = new LVWEIBA.Model.MemberCoupon();
                            mdlForFifty.CouponID = "0020160604000001L511";
                            mdlForFifty.Userid   = openid_wx;
                            mdlForFifty.ZT       = "0";
                            mdlForFifty.Count    = 1;
                            mdlForFifty.Sj       = DateTime.Now;
                            mdlForFifty.Order_Id = "";
                            listForFifty.Add(mdlForFifty);
                            bllCoupon.SendCouton(listForFifty, "0020160604000001L511", 1);
                            //删除缓存
                            HttpContext.Current.Cache.Remove("code" + mobile);
                            Jscript.NorefLocation(this.Page, "领取成功!", "Coupon.aspx");
                        }
                        else
                        {
                            //删除缓存
                            HttpContext.Current.Cache.Remove("code" + mobile);
                            Jscript.NorefLocation(this.Page, "该手机号已经验证过!", "CouponForNinety.aspx");
                        }
                    }
                }
            }
        }
    }
Exemple #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        SortedDictionary <string, string> sPara = GetRequestGet();

        if (sPara.Count > 0)//判断是否有带返回参数
        {
            Notify aliNotify = new Notify();
            // bool verifyResult = aliNotify.Verify(sPara, Request.QueryString["notify_id"], Request.QueryString["sign"]);
            bool verifyResult = true;
            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"];
                string openId       = Request.QueryString["body"];
                //总额
                string total_fee = Request.QueryString["total_fee"];
                if (Request.QueryString["trade_status"] == "TRADE_FINISHED" || Request.QueryString["trade_status"] == "TRADE_SUCCESS")
                {
                    //判断该笔订单是否在商户网站中已经做过处理
                    //如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序
                    //如果有做过处理,不执行商户的业务程序
                    try
                    {
                        BaseClass.Dal.ChongzhiLog sl = new BaseClass.Dal.ChongzhiLog();
                        bool isOrderValid            = sl.CZisok(out_trade_no, openId);
                        log4netHelper.WriteDebugLog(typeof(return_url), "订单notify", "订单号:" + out_trade_no + "处理状态:" + isOrderValid);
                        LVWEIBA.DAL.order_list   oodd  = new LVWEIBA.DAL.order_list();
                        LVWEIBA.Model.order_list order = oodd.GetModel(out_trade_no);

                        var isOrder = order != null && order.user_id == openId;
                        if (isOrderValid || isOrder)
                        {
                            string  mid   = openId;
                            decimal money = decimal.Parse(total_fee) / 100;

                            LVWEIBA.Model.order_list oom = oodd.GetModel(out_trade_no);
                            //正式状态
                            oom.order_zt = "DCX";
                            oodd.Update(oom);
                            //发送短信通知用户和商户
                            var orderMx = new LVWEIBA.DAL.order_Mx().GetModel(out_trade_no);
                            var member  = new LVWEIBA.BLL.MemberInfo().GetModel(mid);
                            //发送短信通知用户和商户(判断是门票还是尾单)
                            if (orderMx.ProType != null && (orderMx.ProType.Equals("DZP") || orderMx.ProType.Equals("ZZP")))
                            {
                                var bll = new LVWEIBA.DAL.ProviderSpot();
                                LVWEIBA.Model.ProviderSpot providerSpot = bll.GetModel(int.Parse(orderMx.productNum));
                                LVWEIBA.MessageService.NotifyUsersTicket(member.Tel, providerSpot.MasterTel, orderMx);
                                providerSpot.Num = providerSpot.Num - orderMx.ProCount;
                                bll.Update(providerSpot);
                                log4netHelper.WriteDebugLog(typeof(return_url), "订单return", "修改余量: productNum is:" + orderMx.productNum + "TicketCount is:" + providerSpot.Num);
                            }
                            else
                            {
                                LVWEIBA.Model.LvULines lvModel = new LVWEIBA.DAL.LvULines().GetModel(orderMx.productNum);
                                LVWEIBA.MessageService.NotifyUsers(member.Tel, lvModel.LineMasterMoble, orderMx);
                                //修改线路余量
                                LVWEIBA.BLL.LvULines lvubLL = new LVWEIBA.BLL.LvULines();
                                if (lvModel != null)
                                {
                                    lvModel.adultTicketCount = lvModel.adultTicketCount - orderMx.adultCount;
                                    lvModel.puppyTicketCount = lvModel.puppyTicketCount - orderMx.puppyCount;
                                    lvubLL.Update(lvModel);
                                    log4netHelper.WriteDebugLog(typeof(return_url), "订单return", "修改余量: productNum is:" + orderMx.productNum);
                                }
                            }
                        }
                    }
                    catch (Exception)
                    {
                        moneyUnFreeze(out_trade_no, openId);
                        couponUnUse(out_trade_no);
                    }

                    Response.Redirect("http://wx.lvwei8.com/index/indent_show.aspx?order_id=" + out_trade_no);
                }
                else
                {
                    Response.Write("trade_status=" + Request.QueryString["trade_status"]);
                }
                //——请根据您的业务逻辑来编写程序(以上代码仅作参考)——

                /////////////////////////////////////////////////////////////////////////////////////////////////////////////
            }
            else//验证失败
            {
                Response.Write("验证失败");
            }
        }
        else
        {
            Response.Write("无返回参数");
        }
    }
Exemple #7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string   postStr = "";
        TXT_Help th      = new TXT_Help();

        if (Request.HttpMethod.ToLower() == "post")
        {
            Stream s = System.Web.HttpContext.Current.Request.InputStream;
            byte[] b = new byte[s.Length];
            s.Read(b, 0, (int)s.Length);
            postStr = Encoding.UTF8.GetString(b);

            XmlHelp xh = new XmlHelp();
            SortedDictionary <string, string> sParams = xh.GetInfoFromXml(postStr);
            try
            {
                if (sParams["return_code"].ToString() == "SUCCESS")
                {
                    BaseClass.Dal.ChongzhiLog sl = new BaseClass.Dal.ChongzhiLog();
                    bool isOrderValid            = sl.CZisok(sParams["out_trade_no"].ToString(), sParams["openid"].ToString());
                    BaseClass.Common.LoggerUtil.printLog("订单:" + sParams["out_trade_no"].ToString() + "处理状态:" + isOrderValid);
                    if (isOrderValid)
                    {
                        string  mid   = sParams["openid"].ToString();
                        decimal money = decimal.Parse(sParams["cash_fee"].ToString()) / 100;
                        LVWEIBA.DAL.order_list   oodd = new LVWEIBA.DAL.order_list();
                        LVWEIBA.Model.order_list oom  = oodd.GetModel(sParams["out_trade_no"].ToString());
                        //正式状态
                        oom.order_zt = "DCX";
                        oodd.Update(oom);
                        //发送短信通知用户和商户
                        var orderMx = new LVWEIBA.DAL.order_Mx().GetModel(sParams["out_trade_no"].ToString());
                        var member  = new LVWEIBA.BLL.MemberInfo().GetModel(mid);
                        //发送短信通知用户和商户(判断是门票还是尾单)
                        if (orderMx.ProType != null && (orderMx.ProType.Equals("DZP") || orderMx.ProType.Equals("ZZP")))
                        {
                            var bll = new LVWEIBA.DAL.ProviderSpot();
                            LVWEIBA.Model.ProviderSpot providerSpot = bll.GetModel(int.Parse(orderMx.productNum));
                            LVWEIBA.MessageService.NotifyUsersTicket(member.Tel, providerSpot.MasterTel, orderMx);
                            providerSpot.Num = providerSpot.Num - orderMx.ProCount;
                            bll.Update(providerSpot);
                            BaseClass.Common.LoggerUtil.printLog("修改余量: productNum is:" + orderMx.productNum + "TicketCount is:" + providerSpot.Num);
                        }
                        else
                        {
                            LVWEIBA.Model.LvULines lvModel = new LVWEIBA.DAL.LvULines().GetModel(orderMx.productNum);
                            LVWEIBA.MessageService.NotifyUsers(member.Tel, lvModel.LineMasterMoble, orderMx);
                            //修改线路余量
                            LVWEIBA.BLL.LvULines lvubLL = new LVWEIBA.BLL.LvULines();
                            if (lvModel != null)
                            {
                                lvModel.adultTicketCount = lvModel.adultTicketCount - orderMx.adultCount;
                                lvModel.puppyTicketCount = lvModel.puppyTicketCount - orderMx.puppyCount;
                                lvubLL.Update(lvModel);
                                BaseClass.Common.LoggerUtil.printLog("修改余量: productNum is:" + orderMx.productNum + "adultTicketCount is:" + lvModel.adultTicketCount + "puppyTicketCount is:" + lvModel.puppyTicketCount);
                            }
                        }
                        //返回成功
                        Response.Write(returnOKMessage());
                    }
                    else
                    {
                        th.ReFreshTXT(postStr, "D:\\msg\\zhifuErr\\", "错误CZ" + DateTime.Now.ToString("yyMMddHHmmssff") + ".txt");
                        Response.Write(returnFailMessage());
                    }
                }
                else
                {
                    //一系列还原操作
                    moneyUnFreeze(sParams["out_trade_no"].ToString(), sParams["openid"].ToString());
                    couponUnUse(sParams["out_trade_no"].ToString());
                    Response.Write(returnFailMessage());
                }
            }
            catch (Exception ex)
            {
                BaseClass.Common.LoggerUtil.printLog("订单" + sParams["out_trade_no"].ToString() + "处理错误," + "ex:" + ex.Message + ex.StackTrace);
                //一系列还原操作
                moneyUnFreeze(sParams["out_trade_no"].ToString(), sParams["openid"].ToString());
                couponUnUse(sParams["out_trade_no"].ToString());
                Response.Write(returnFailMessage());
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (IsPostBack)
        {
            string tel = Request.Form["tel"];
            string code = Request.Form["code"];
            string pass = Request.Form["pass"];

            object codeCache = HttpContext.Current.Cache.Get("code" + tel);
            if (codeCache == null)
            {
                Jscript.NorefLocation(this.Page, "验证码失效请重新获取!手机号为:" + tel + "验证码为:" + code, "registration.aspx");
            }
            else
            {
                if (code != codeCache.ToString())
                {
                    Jscript.NorefLocation(this.Page, "验证码不正确!", "registration.aspx");
                }
                else
                {
                    try
                    {

                        var bll = new LVWEIBA.BLL.MemberInfo();
                        DataSet ds = bll.GetList(" tel='" + tel + "'");
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            Jscript.NorefLocation(this.Page, "该手机号已注册!", "registration.aspx");
                        }
                        else
                        {
                            openid = BaseClass.Common.Common.getSuijiString(30);

                            DBCLASSFORWEIXIN.Model.LocalWeixinUser SingleUserInf = new DBCLASSFORWEIXIN.Model.LocalWeixinUser();
                            DBCLASSFORWEIXIN.DAL.LocalWeixinUser ld = new DBCLASSFORWEIXIN.DAL.LocalWeixinUser();

                            SingleUserInf.country = "";
                            SingleUserInf.province = "";
                            SingleUserInf.city = "";
                            SingleUserInf.remark = "";
                            SingleUserInf.openid = openid;
                            SingleUserInf.regtime = DateTime.Now;
                            SingleUserInf.Tel = tel;
                            SingleUserInf.Jifen = 0;
                            SingleUserInf.money = 0;
                            SingleUserInf.vips = 0;
                            SingleUserInf.pid = 0;
                            SingleUserInf.refresh_token = "";
                            SingleUserInf.nickname = "";
                            SingleUserInf.headimgurl = "";
                            SingleUserInf.subscribe = 1;
                            SingleUserInf.subscribe_time = "";
                            SingleUserInf.unionid = "";
                            SingleUserInf.groupid = 0;
                            SingleUserInf.sex = 1;

                            LVWEIBA.BLL.MemberList bllMember = new LVWEIBA.BLL.MemberList();
                            LVWEIBA.Model.MemberList model = new LVWEIBA.Model.MemberList();


                            model.MemberId = openid;
                            model.UserPwd = pass;
                            model.Tel = tel;
                            if (bllMember.Add(model) && ld.Add(SingleUserInf) > 0)
                            {
                                Session["openid"] = openid;
                                Response.Redirect("Default.aspx");
                            }
                        }

                    }
                    catch (Exception EX)
                    {

                        throw;
                    }
                }
            }
        }
    }