コード例 #1
0
ファイル: call_back_url.aspx.cs プロジェクト: jslpower/jingqu
        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"];

                    if (result == "success")
                    {
                        string tmpOrderId = Request.QueryString["out_trade_no"];
                        var OrderModel = BOrder.GetModel(tmpOrderId);
                        if (OrderModel != null)
                        {
                            OrderModel.id = tmpOrderId;
                            OrderModel.orderstatus = Convert.ToString((int)订单状态.已支付);
                            OrderModel.paytype = 1;
                             BOrder.Update(OrderModel);
                             if (BMemberIntegral.IsExist(Convert.ToInt32(OrderModel.ordertype), tmpOrderId) == false)
                             {
                                 //写会员积分
                                 BMemberIntegral.Add(new global::YCH.DataCenter.DTO.MbmemberintegralchangeDTO
                                 {
                                     id = System.Guid.NewGuid().ToString(),
                                     billtype = Convert.ToInt32(OrderModel.ordertype),
                                     objid = tmpOrderId,
                                     memberid = OrderModel.member_id,
                                     innum = OrderModel.totalamount,
                                     absract = "购买积分,订单编号:" + OrderModel.code,
                                     year_num = DateTime.Now.Year,
                                     currentdate = DateTime.Now,
                                     create_date = DateTime.Now
                                 });
                             }
                        }
                    }

                    Response.Redirect("/");

                    //——请根据您的业务逻辑来编写程序(以上代码仅作参考)——

                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////
                }
                else//验证失败
                {
                    Response.Write("验证失败");
                }
            }
            else
            {
                Response.Write("无返回参数");
            }
        }
コード例 #2
0
ファイル: call_back_url.aspx.cs プロジェクト: uwitec/O2O
        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("无返回参数");
            }
        }