protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //此处可增加一个日志来记录通知数据,便于调试接口。

                Dictionary <string, string> dict = GetRequestPost();
                // 判断是否有带返回参数
                if (dict.Count > 0)
                {
                    // 验证签名,先获取到签名源字符串和签名字符串后,做签名验证。
                    string srcString = string.Format("apiName={0}&notifyTime={1}&tradeAmt={2}&merchNo={3}&merchParam={4}&orderNo={5}&tradeDate={6}&accNo={7}&accDate={8}&orderStatus={9}",
                                                     dict["apiName"],
                                                     dict["notifyTime"],
                                                     dict["tradeAmt"],
                                                     dict["merchNo"],
                                                     dict["merchParam"],
                                                     dict["orderNo"],
                                                     dict["tradeDate"],
                                                     dict["accNo"],
                                                     dict["accDate"],
                                                     dict["orderStatus"]);
                    string sigString  = dict["signMsg"];
                    string notifyType = dict["notifyType"];
                    //if (Int32.Parse(notifyType) == 1)
                    //{
                    //    sigString = System.Web.HttpUtility.UrlDecode(sigString);
                    //}
                    sigString = sigString.Replace("\r", "").Replace("\n", "");
                    bool verifyResult = MobaopaySignUtil.Instance.verifyData(sigString, srcString);
                    veryfyDesc = verifyResult ? "签名验证通过" : "签名验证失败";

                    // 取出用于显示的各个数据,这里只是为了演示,实际应用中应该不需要把这些数据显示到页面上。
                    apiName     = dict["apiName"];
                    notifyTime  = dict["notifyTime"];
                    tradeAmt    = dict["tradeAmt"];     //交易金额
                    merchNo     = dict["merchNo"];      //商户号
                    merchParam  = dict["merchParam"];   //商户参数,来自支付请求中的商户参数,原物返回,方便商户异步处理需要传递数据
                    orderNo     = dict["orderNo"];      //商户订单号
                    tradeDate   = dict["tradeDate"];    //商户交易日期
                    accNo       = dict["accNo"];        //支付平台订单号
                    accDate     = dict["accDate"];      //支付平台订单日期
                    orderStatus = dict["orderStatus"];  //订单状态:0-未支付,1-成功,2-失败;实际上只有成功才会发送通知

                    if (verifyResult)
                    {
                        /**
                         * 验证通过后,请在这里加上商户自己的业务逻辑处理代码.
                         * 比如:
                         * 1、根据商户订单号取出订单数据
                         * 2、根据订单状态判断该订单是否已处理(因为通知会收到多次),避免重复处理
                         * 3、比对一下订单数据和通知数据是否一致,例如金额等
                         * 4、接下来修改订单状态为已支付或待发货
                         * 5、...
                         */

                        try
                        {
                            //处理订单
                            if (orderStatus == "1") //支付成功
                            {
                                //构建支付链接
                                //根据订单唯一id获取订单信息
                                IRecordTempService recordService = IoC.Resolve <IRecordTempService>();

                                /**
                                 * //处理订单
                                 * item.IsCompled = true;
                                 * item.MY18oid = accNo;
                                 * item.MY18M = tradeAmt;
                                 * item.MY18DT = accDate;
                                 */
                                decimal dmTradeAmt;
                                if (!decimal.TryParse(tradeAmt, out dmTradeAmt))
                                {
                                    Response.Write("非法请求!");
                                    return;
                                }
                                Ytg.Scheduler.Comm.LogManager.Info(string.Format("接受订单请求:{0}", orderNo));
                                int stauts;
                                var item = recordService.Compled_RecordTemp(orderNo, accNo, dmTradeAmt, accDate, out stauts);
                                Ytg.Scheduler.Comm.LogManager.Info(string.Format("查询订单状态:{0}", stauts));
                                if (stauts == -1)
                                {
                                    Response.Write("订单已处理成功!");
                                }
                                else if (stauts == -3)
                                {
                                    Response.Write("订单已过期!");
                                }
                                else if (stauts == -2)
                                {
                                    Response.Write("非法请求!");
                                }
                                else
                                {
                                    //获取当前数据
                                    Ytg.Scheduler.Comm.LogManager.Info(string.Format("处理订单逻辑:{0}", stauts));
                                    //增加用户余额,处理充值逻辑
                                    if (ManagerCallBackLogic(item))
                                    {
                                        recordService.Save();//保存
                                        //逻辑处理完成,跳转

                                        //Response.Write("恭喜您,充值成功!");
                                        //插入充值成功消息
                                        try
                                        {
                                            IMessageService messageService = IoC.Resolve <IMessageService>();
                                            messageService.Create(new Message()
                                            {
                                                FormUserId     = -1,
                                                MessageType    = 8,
                                                OccDate        = DateTime.Now,
                                                Status         = 0,
                                                Title          = "充值成功提示",
                                                MessageContent = string.Format("您通过在线充值{0}元已经成功到账!", item.TradeAmt),
                                                ToUserId       = item.UserId
                                            });
                                            messageService.Save();
                                        }
                                        catch (Exception ex)
                                        {
                                        }
                                        //插入系统消息表
                                        Response.Redirect("notify.aspx", true);     // 回写‘SUCCESS’方式一: 重定向到一个专门用于处理回写‘SUCCESS’的页面,这样可以保证输出内容中只有'SUCCESS'这个字符串。
                                    }
                                    else
                                    {
                                        AppendLog("充值失败:请求参数:" + srcString);
                                        Response.Write("充值失败,请联系在线客服确认是否充值成功!");
                                    }
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            AppendLog("充值处理异常:" + ex.Message + "  请求参数:" + srcString);
                            Response.Write("充值异常,请联系在线客服确认是否充值成功!");
                        }
                    }
                }
                else
                {
                    Response.Write("无通知参数");
                    AppendLog("无通知参数:");
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //获取智付反馈信息
                string merchant_code      = Request.Form["merchant_code"].ToString().Trim();
                string notify_type        = Request.Form["notify_type"].ToString().Trim();
                string notify_id          = Request.Form["notify_id"].ToString().Trim();
                string interface_version  = Request.Form["interface_version"].ToString().Trim();
                string sign_type          = Request.Form["sign_type"].ToString().Trim();
                string dinpaysign         = Request.Form["sign"].ToString().Trim();
                string order_no           = Request.Form["order_no"].ToString().Trim();
                string order_time         = Request.Form["order_time"].ToString().Trim();
                string order_amount       = Request.Form["order_amount"].ToString().Trim();
                string extra_return_param = Request.Form["extra_return_param"];
                string trade_no           = Request.Form["trade_no"].ToString().Trim();
                string trade_time         = Request.Form["trade_time"].ToString().Trim();
                string trade_status       = Request.Form["trade_status"].ToString().Trim();
                string bank_seq_no        = Request.Form["bank_seq_no"];

                /**
                 *签名顺序按照参数名a到z的顺序排序,若遇到相同首字母,则看第二个字母,以此类推,
                 *参数名1=参数值1&参数名2=参数值2&……&参数名n=参数值n
                 **/
                //组织订单信息
                string signStr = "";
                Ytg.Scheduler.Comm.LogManager.Info("signStr\n\t");
                if (null != bank_seq_no && bank_seq_no != "")
                {
                    signStr = signStr + "bank_seq_no=" + bank_seq_no.ToString().Trim() + "&";
                }

                if (null != extra_return_param && extra_return_param != "")
                {
                    signStr = signStr + "extra_return_param=" + extra_return_param + "&";
                }
                signStr = signStr + "interface_version=V3.0" + "&";
                signStr = signStr + "merchant_code=" + merchant_code + "&";


                if (null != notify_id && notify_id != "")
                {
                    signStr = signStr + "notify_id=" + notify_id + "&notify_type=" + notify_type + "&";
                }

                signStr = signStr + "order_amount=" + order_amount + "&";
                signStr = signStr + "order_no=" + order_no + "&";
                signStr = signStr + "order_time=" + order_time + "&";
                signStr = signStr + "trade_no=" + trade_no + "&";
                signStr = signStr + "trade_status=" + trade_status + "&";

                if (null != trade_time && trade_time != "")
                {
                    signStr = signStr + "trade_time=" + trade_time;
                }
                Ytg.Scheduler.Comm.LogManager.Info(signStr + "\n\t");
                if (sign_type == "RSA-S") //RSA-S的验签方法
                {
                    /**
                     *                  1)dinpay_public_key,智付公钥,每个商家对应一个固定的智付公钥(不是使用工具生成的密钥merchant_public_key,不要混淆),
                     *                  即为智付商家后台"公钥管理"->"智付公钥"里的绿色字符串内容
                     *                  2)demo提供的dinpay_public_key是测试商户号1111110166的智付公钥,请自行复制对应商户号的智付公钥进行调整和替换。
                     */

                    string dinpay_public_key = System.Configuration.ConfigurationManager.AppSettings["merchant_public_key"];// "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCKr1fqFErd5gvEJRclnCOqqK55JlCO67JZOOyvijVElMtNhRMDjAHCZWdzdl++L7lAIOxt5l8hmVDBeXj7zNPMZ170LZokL0f7niPa63zn9KF0eV59m+uddzi297GzAqXcdH13hktsVC4EkHNZqSB0I0S9o1D0XGzmvmU64Y7M0QIDAQAB";
                    //将智付公钥转换成C#专用格式
                    dinpay_public_key = testOrder.HttpHelp.RSAPublicKeyJava2DotNet(dinpay_public_key);
                    // Ytg.Scheduler.Comm.LogManager.Info(dinpay_public_key + "\n\t");
                    //验签
                    bool result = testOrder.HttpHelp.ValidateRsaSign(signStr, dinpay_public_key, dinpaysign);
                    Ytg.Scheduler.Comm.LogManager.Info(result + "  " + result + "\n\t");
                    if (result == true)
                    {
                        //如果验签结果为true,则对订单进行更新
                        //订单更新完之后打印SUCCESS
                        IRecordTempService recordService = IoC.Resolve <IRecordTempService>();
                        decimal            dmTradeAmt;
                        Ytg.Scheduler.Comm.LogManager.Info(order_amount + "  " + order_amount + "\n\t");
                        if (!decimal.TryParse(order_amount, out dmTradeAmt))
                        {
                            Response.Write("非法请求!");
                            return;
                        }
                        Ytg.Scheduler.Comm.LogManager.Info(string.Format("接受订单请求:{0}", order_no));
                        int stauts;
                        var item = recordService.Compled_RecordTemp(order_no, trade_no, dmTradeAmt, trade_time, out stauts);
                        Ytg.Scheduler.Comm.LogManager.Info(string.Format("查询订单状态:{0}", stauts));
                        if (stauts == -1)
                        {
                            Response.Write("订单已处理成功!");
                        }
                        else if (stauts == -3)
                        {
                            Response.Write("订单已过期!");
                        }
                        else if (stauts == -2)
                        {
                            Response.Write("非法请求!");
                        }
                        else
                        {
                            //获取当前数据
                            Ytg.Scheduler.Comm.LogManager.Info(string.Format("处理订单逻辑:{0}", stauts));
                            //增加用户余额,处理充值逻辑
                            if (ManagerCallBackLogic(item))
                            {
                                recordService.Save(); //保存
                                                      //逻辑处理完成,跳转

                                //Response.Write("恭喜您,充值成功!");
                                //插入充值成功消息
                                try
                                {
                                    IMessageService messageService = IoC.Resolve <IMessageService>();
                                    messageService.Create(new BasicModel.Message()
                                    {
                                        FormUserId     = -1,
                                        MessageType    = 8,
                                        OccDate        = DateTime.Now,
                                        Status         = 0,
                                        Title          = "充值成功提示",
                                        MessageContent = string.Format("您通过在线充值{0}元已经成功到账!", item.TradeAmt),
                                        ToUserId       = item.UserId
                                    });
                                    messageService.Save();
                                    Response.Write("SUCCESS");
                                }
                                catch (Exception ex)
                                {
                                    Ytg.Scheduler.Comm.LogManager.Info(string.Format("处理订单异常:{0}", ex.Message));
                                }
                            }
                        }
                    }
                    else
                    {
                        //验签失败
                        Response.Write("验签失败");
                    }
                }
                else //RSA验签方法
                {
                    string          merPubKeyDir = "D:/1111110166.pfx";
                    string          password     = "******";
                    RSAWithHardware rsaWithH     = new RSAWithHardware();
                    rsaWithH.Init(merPubKeyDir, password, "D:/dinpayRSAKeyVersion");
                    bool result = rsaWithH.VerifySign("1111110166", signStr, dinpaysign);
                    if (result == true)
                    {
                        //如果验签结果为true,则对订单进行更新
                        //订单更新完之后必须打印SUCCESS来响应智付服务器以示商户已经正常收到智付服务器发送的异步数据通知,否则智付服务器将会在之后的时间内若干次发送同一笔订单的异步数据!!
                        Response.Write("SUCCESS");
                    }
                    else
                    {
                        //验签失败
                        Response.Write("验签失败");
                    }
                }
            }
        }