示例#1
0
        /// <summary>
        /// 威富通支付接口,不存数据库,仅做支付用
        /// </summary>
        /// <param name="Row"></param>
        /// <returns></returns>
        private string GenerateWftOrder(DataRow Row)
        {
            string CommunityId = Row["CommunityId"].ToString();
            string FeesIds     = Row["FeesIds"].ToString();
            string txnTime     = DateTime.Now.ToString("yyyyMMddHHmmss");
            string CustID      = Row["CustID"].ToString();

            //2017-06-05添加可选参数openId
            //用于区分是否来自于微信H5支付
            //默认为空
            if (!Row.Table.Columns.Contains("openId"))
            {
                return(JSONHelper.FromString(false, "请通过微信访问!"));
            }
            string openId = Row["openId"].ToString();

            //增加FeesIds重复验证
            if (FeesIds == "")
            {
                return(JSONHelper.FromString(false, "未选择费用!"));
            }
            string[]         FeesStr = FeesIds.Split(',');
            HashSet <string> h       = new HashSet <string>();

            for (int i = 0; i < FeesStr.Length; i++)
            {
                h.Add(FeesStr[i]);
            }
            if (h.Count != FeesStr.Length)
            {
                return(JSONHelper.FromString(false, "费用重复!"));
            }
            DataTable CommunityTable = new DbHelperSQLP(PubConstant.UnifiedContionString.ToString()).Query("SELECT * FROM Tb_Community WHERE Id='" + CommunityId.ToString() + "'").Tables[0];

            if (null == CommunityTable || CommunityTable.Rows.Count <= 0)
            {
                return(JSONHelper.FromString(false, "获取数据库信息失败!"));
            }
            //连接字符串
            string connStr = UnionUtil.GetConnectionString(CommunityTable.Rows[0]);
            double Amount  = 0.00d;

            using (IDbConnection conn = new SqlConnection(connStr))
            {
                Amount = conn.ExecuteScalar <double>("SELECT ISNULL(SUM(DebtsAmount),0)+ISNULL(SUM(DebtsLateAmount),0) AS Amount FROM Tb_HSPR_Fees WHERE FeesID IN (" + FeesIds + ")", null, null, null, CommandType.Text);
            }
            if (Amount <= 0)
            {
                return(JSONHelper.FromString(false, "缴费金额必须大于0!"));
            }
            //把金额转换为分
            int fen = (int)Amount * 100;
            //商户订单号,当前10位时间戳+16位随机字符
            string         out_trade_no = ((DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000000) + Utils.Nmrandom();
            RequestHandler reqHandler   = new RequestHandler(null);

            reqHandler.setGateUrl("https://pay.swiftpass.cn/pay/gateway");
            reqHandler.setKey("9d101c97133837e13dde2d32a5054abb");
            reqHandler.setParameter("out_trade_no", out_trade_no);    //商户订单号
            reqHandler.setParameter("body", "物管费");                   //商品描述
            reqHandler.setParameter("attach", CommunityId);           //附加信息
            reqHandler.setParameter("total_fee", "1");                //总金额
            reqHandler.setParameter("mch_create_ip", "125.64.16.10"); //终端IP
            reqHandler.setParameter("time_start", "");                //订单生成时间
            reqHandler.setParameter("time_expire", "");               //订单超时时间
            reqHandler.setParameter("service", "pay.weixin.jspay");   //接口类型:pay.weixin.jspay
            reqHandler.setParameter("mch_id", "7551000001");          //必填项,商户号,由平台分配
            reqHandler.setParameter("version", "1.0");                //接口版本号
            reqHandler.setParameter("notify_url", "http://125.64.16.10:9999/TwInterface/Service/WeiXinPayCallBack/WeiXinWftPay.ashx");
            //通知地址,必填项,接收平台通知的URL,需给绝对路径,255字符内;此URL要保证外网能访问
            reqHandler.setParameter("nonce_str", Utils.random());     //随机字符串,必填项,不长于 32 位
            reqHandler.setParameter("charset", "UTF-8");              //字符集
            reqHandler.setParameter("sign_type", "MD5");              //签名方式
            reqHandler.setParameter("is_raw", "1");                   //原生JS值
            reqHandler.setParameter("device_info", "");               //终端设备号
            reqHandler.setParameter("sub_openid", "");                //测试账号不传值,此处默认给空值。正式账号必须传openid值,获取openid值指导文档地址:http://www.cnblogs.com/txw1958/p/weixin76-user-info.html
            reqHandler.setParameter("callback_url", "");              //前台地址  交易完成后跳转的 URL,需给绝对路径,255字 符 内 格 式如:http://wap.tenpay.com/callback.asp
            reqHandler.setParameter("goods_tag", "");                 //商品标记
            reqHandler.createSign();                                  //创建签名
                                                                      //以上参数进行签名
            string data = Utils.toXml(reqHandler.getAllParameters()); //生成XML报文
            Dictionary <string, string> reqContent = new Dictionary <string, string>();

            reqContent.Add("url", reqHandler.getGateUrl());
            reqContent.Add("data", data);
            PayHttpClient pay = new PayHttpClient();

            pay.setReqContent(reqContent);
            if (!pay.call())
            {
                return(JSONHelper.FromString(false, pay.getErrInfo()));
            }
            ClientResponseHandler resHandler = new ClientResponseHandler();

            resHandler.setContent(pay.getResContent());
            resHandler.setKey("9d101c97133837e13dde2d32a5054abb");
            Hashtable param = resHandler.getAllParameters();

            if (!resHandler.isTenpaySign())
            {
                return(JSONHelper.FromString(false, param["message"].ToString()));
            }
            //当返回状态与业务结果都为0时才返回,其它结果请查看接口文档
            if (int.Parse(param["status"].ToString()) != 0 || int.Parse(param["result_code"].ToString()) != 0)
            {
                return(JSONHelper.FromString(false, param["err_msg"].ToString()));
            }
            return(JSONHelper.FromJsonString(true, param["pay_info"].ToString()));
        }
示例#2
0
文件: WftAlPay.cs 项目: dmhai/dxpay
        /// <summary>
        /// 威富通支付宝wap支付
        /// </summary>
        /// <param name="tid">应用类型id</param>
        /// <param name="code">订单号</param>
        /// <param name="goodsname">商品名称</param>
        /// <param name="price">支付金额(单位:元)</param>
        /// <param name="orderid">订单id</param>
        /// <param name="appid">应用id</param>
        /// <returns></returns>
        private static InnerResponse WftZfbH5(int apptype, string code, string goodsname, decimal price, int orderid, string ip, int appid)
        {
            // string str = "";
            InnerResponse inn = new InnerResponse();
            Dictionary <string, string> cfg = new Dictionary <string, string>();

            try
            {
                ClientResponseHandler resHandler = new ClientResponseHandler();
                PayHttpClient         pay        = new PayHttpClient();
                RequestHandler        reqHandler = new RequestHandler(null);
                cfg = Utils.loadCfgZfb(apptype, appid);

                if (cfg == null || string.IsNullOrEmpty(cfg["mch_id"]) || string.IsNullOrEmpty(cfg["pay_id"]) || string.IsNullOrEmpty(cfg["key"]))
                {
                    inn = inn.ToResponse(ErrorCode.Code106);
                    return(inn);
                }
                if (!UpdateOrde.OrdeUpdateInfo(orderid, int.Parse(cfg["pay_id"].ToString())))
                {
                    inn = inn.ToResponse(ErrorCode.Code101);
                    return(inn);
                }
                if (!JudgeMoney.JudgeMinimum(price, decimal.Parse(cfg["minmun"].ToString())))
                {
                    inn = inn.ToResponse(ErrorCode.Code8990);
                    return(inn);
                }
                if (!JudgeMoney.JudgeMaximum(price, decimal.Parse(cfg["maximum"].ToString())))
                {
                    inn = inn.ToResponse(ErrorCode.Code8989);
                    return(inn);
                }
                //初始化数据
                reqHandler.setGateUrl(cfg["req_url"].ToString());
                reqHandler.setKey(cfg["key"].ToString());
                reqHandler.setParameter("out_trade_no", code);                                   //我们的订单号
                reqHandler.setParameter("body", goodsname);                                      //商品描述
                reqHandler.setParameter("total_fee", (Convert.ToInt32(price * 100)).ToString()); //价格(已传入的为准,无就从数据库读取)
                reqHandler.setParameter("mch_create_ip", ip);                                    //终端IP
                reqHandler.setParameter("service", "pay.alipay.native");                         //支付类型
                reqHandler.setParameter("mch_id", cfg["mch_id"].ToString());
                reqHandler.setParameter("version", cfg["version"].ToString());
                reqHandler.setParameter("notify_url", ConfigurationManager.AppSettings["WftTokenUrl"].ToString().Replace("{0}", cfg["pay_id"].ToString()));//回掉地址
                reqHandler.setParameter("nonce_str", Utils.random());
                reqHandler.setParameter("charset", "UTF-8");
                reqHandler.setParameter("sign_type", "MD5");
                reqHandler.setParameter("time_start", DateTime.Now.ToString("yyyyMMddHHmmss"));                 //订单生成时间
                reqHandler.setParameter("time_expire", DateTime.Now.AddMinutes(30).ToString("yyyyMMddHHmmss")); //订单超时时间
                reqHandler.createSign();
                string datawft = Utils.toXml(reqHandler.getAllParameters());
                Dictionary <string, string> reqContent = new Dictionary <string, string>();
                reqContent.Add("url", reqHandler.getGateUrl());
                reqContent.Add("data", datawft);
                pay.setReqContent(reqContent);
                if (pay.call())
                {
                    resHandler.setContent(pay.getResContent());
                    resHandler.setKey(cfg["key"].ToString());
                    Hashtable param = resHandler.getAllParameters();
                    if (resHandler.isTenpaySign())
                    {
                        if (int.Parse(param["status"].ToString()) == 0 && int.Parse(param["result_code"].ToString()) == 0)
                        {
                            inn           = inn.ToResponse(ErrorCode.Code100);
                            inn.ExtraData = param["code_url"];//http提交方式;
                            inn.IsJump    = true;
                        }
                        else
                        {
                            string wftzfsbxin = "威富通支付失败信息,错误代码:" + param["err_code"] + ",错误信息:" + param["err_msg"] + ",商户号:" + cfg["mch_id"].ToString();
                            PayApiDetailErrorLogger.UpstreamPaymentErrorLog("报错信息:" + wftzfsbxin, summary: "威富通支付宝扫码接口错误信息", channelId: int.Parse(cfg["pay_id"].ToString()));
                            inn = inn.ToResponse(ErrorCode.Code104);
                        }
                    }
                    else
                    {
                        string mesage = "威富通支付失败信息,错误代码:" + resHandler.getContent() + ",错误信息:" + resHandler.getDebugInfo() + ",商户号:" + cfg["mch_id"].ToString();
                        PayApiDetailErrorLogger.UpstreamPaymentErrorLog("报错信息:" + mesage, summary: "威富通支付宝扫码接口错误信息", channelId: int.Parse(cfg["pay_id"].ToString()));
                        inn = inn.ToResponse(ErrorCode.Code104);
                    }
                }
                else
                {
                    PayApiDetailErrorLogger.UpstreamPaymentErrorLog("报错信息:第一步验证错误", summary: "威富通支付宝接口错误信息", channelId: int.Parse(cfg["pay_id"].ToString()));
                    inn = inn.ToResponse(ErrorCode.Code104);
                }
            }
            catch (Exception E)
            {
                PayApiDetailErrorLogger.UpstreamPaymentErrorLog("报错信息:" + E.ToString(), summary: "威富通支付宝wap接口错误信息", channelId: int.Parse(cfg["pay_id"].ToString()));
                inn = inn.ToResponse(ErrorCode.Code104);
            }
            return(inn);
        }
示例#3
0
文件: WftWxPay.cs 项目: dmhai/dxpay
        /// <summary>
        /// 威富通支付通道安卓调用方式
        /// </summary>
        /// <param name="apptype">风控配置表id</param>
        /// <param name="code">订单编号</param>
        /// <param name="goodsname">商品名称</param>
        /// <param name="price">商品价格</param>
        ///<param name="ooderid">订单表id</param>
        ///<param name="ip">ip地址</param>
        ///<param name="appid">应用id</param>
        /// <returns></returns>
        private InnerResponse PayWftAz(int apptype, string code, string goodsname, decimal price, int oderid, string ip, int appid)
        {
            InnerResponse inn = new InnerResponse();
            Dictionary <string, string> cfg = new Dictionary <string, string>();

            try
            {
                ClientResponseHandler resHandler = new ClientResponseHandler();
                PayHttpClient         pay        = new PayHttpClient();
                RequestHandler        reqHandler = new RequestHandler(null);
                cfg = Utils.loadCfg(apptype, appid);

                if (cfg == null || string.IsNullOrEmpty(cfg["mch_id"]) || string.IsNullOrEmpty(cfg["pay_id"]) || string.IsNullOrEmpty(cfg["key"]))
                {
                    inn = inn.ToResponse(ErrorCode.Code106);
                    return(inn);
                }
                if (!UpdateOrde.OrdeUpdateInfo(oderid, int.Parse(cfg["pay_id"].ToString())))
                {
                    inn = inn.ToResponse(ErrorCode.Code101);
                    return(inn);
                }
                if (!JudgeMoney.JudgeMinimum(price, decimal.Parse(cfg["minmun"].ToString())))
                {
                    inn = inn.ToResponse(ErrorCode.Code8990);
                    return(inn);
                }
                if (!JudgeMoney.JudgeMaximum(price, decimal.Parse(cfg["maximum"].ToString())))
                {
                    inn = inn.ToResponse(ErrorCode.Code8989);
                    return(inn);
                }
                //初始化数据
                reqHandler.setGateUrl(cfg["req_url"].ToString());
                reqHandler.setKey(cfg["key"].ToString());
                reqHandler.setParameter("out_trade_no", code);                                   //我们的订单号
                reqHandler.setParameter("body", goodsname);                                      //商品描述
                                                                                                 //reqHandler.setParameter("attach", privateinfo);//附加信息
                reqHandler.setParameter("total_fee", (Convert.ToInt32(price * 100)).ToString()); //价格(已传入的为准,无就从数据库读取)
                reqHandler.setParameter("mch_create_ip", ip);                                    //终端IP
                reqHandler.setParameter("service", "unified.trade.pay");
                reqHandler.setParameter("mch_id", cfg["mch_id"].ToString());
                reqHandler.setParameter("version", cfg["version"].ToString());
                reqHandler.setParameter("notify_url", ConfigurationManager.AppSettings["WftTokenUrl"].ToString().Replace("{0}", cfg["pay_id"].ToString()));//回掉地址
                reqHandler.setParameter("nonce_str", Utils.random());
                reqHandler.setParameter("charset", "UTF-8");
                reqHandler.setParameter("sign_type", "MD5");
                reqHandler.setParameter("device_info", "AND_WAP");
                reqHandler.setParameter("mch_app_name", "测试");
                reqHandler.setParameter("mch_app_id", "http://www.baidu.com");
                reqHandler.setParameter("time_start", DateTime.Now.ToString("yyyyMMddHHmmss"));                 //订单生成时间
                reqHandler.setParameter("time_expire", DateTime.Now.AddMinutes(30).ToString("yyyyMMddHHmmss")); //订单超时时间
                reqHandler.createSign();
                string datawft = Utils.toXml(reqHandler.getAllParameters());
                Dictionary <string, string> reqContent = new Dictionary <string, string>();
                reqContent.Add("url", reqHandler.getGateUrl());
                reqContent.Add("data", datawft);
                pay.setReqContent(reqContent);
                if (pay.call())
                {
                    resHandler.setContent(pay.getResContent());
                    resHandler.setKey(cfg["key"].ToString());
                    Hashtable param = resHandler.getAllParameters();
                    if (resHandler.isTenpaySign())
                    {
                        if (int.Parse(param["status"].ToString()) == 0)
                        {
                            string wxpay = "{\"token_id\":\"" + param["token_id"].ToString() + "\", \"services\":\"pay.weixin.wappay\", \"sign\":\"" + param["sign"] + "\",\"status\":\"0\", \"charset\":\"UTF-8\", \"version\":\"2.0\", \"sign_type\":\"MD5\",\"PaymentType\":\"2\",\"SubType\":\"1\",\"IsH5\":\"0\"}";
                            // str = "{\"message\":\"成功\",\"result\":100,\"data\":" + wxpay + "}";
                            inn           = inn.ToResponse(ErrorCode.Code100);
                            inn.ExtraData = JMP.TOOL.AesHelper.AesEncrypt(wxpay, ConfigurationManager.AppSettings["encryption"].ToString());
                        }
                        else
                        {
                            string wftzfsbxin = "威富通支付失败信息,错误代码:" + param["err_code"] + ",错误信息:" + param["err_msg"] + ",商户号:" + cfg["mch_id"].ToString();
                            PayApiDetailErrorLogger.UpstreamPaymentErrorLog("报错信息:" + wftzfsbxin, summary: "威富通微信wap接口错误信息", channelId: int.Parse(cfg["pay_id"].ToString()));
                            inn = inn.ToResponse(ErrorCode.Code104);
                        }
                    }
                    else
                    {
                        string mesage = "威富通支付失败信息,错误代码:" + resHandler.getContent() + ",错误信息:" + resHandler.getDebugInfo() + ",商户号:" + cfg["mch_id"].ToString();
                        PayApiDetailErrorLogger.UpstreamPaymentErrorLog("报错信息:" + mesage, summary: "威富通微信wap接口错误信息", channelId: int.Parse(cfg["pay_id"].ToString()));
                        inn = inn.ToResponse(ErrorCode.Code104);
                    }
                }
                else
                {
                    PayApiDetailErrorLogger.UpstreamPaymentErrorLog("报错信息:第一步验证错误", summary: "威富通微信wap接口错误信息", channelId: int.Parse(cfg["pay_id"].ToString()));
                    inn = inn.ToResponse(ErrorCode.Code104);
                }
            }
            catch (Exception E)
            {
                PayApiDetailErrorLogger.UpstreamPaymentErrorLog("报错信息:" + E.ToString(), summary: "威富通微信wap接口错误信息", channelId: int.Parse(cfg["pay_id"].ToString()));
                inn = inn.ToResponse(ErrorCode.Code104);
            }
            return(inn);
        }
示例#4
0
        public bool Check()
        {
            var str        = "";
            var bll        = new JMP.BLL.jmp_order();
            var resHandler = new ClientResponseHandler();
            var pay        = new PayHttpClient();
            var reqHandler = new RequestHandler(null);
            var cfg        = Utils.Load_CfgInterfaceId(Tid);

            //初始化数据
            reqHandler.setGateUrl(cfg["req_url"].ToString());
            reqHandler.setKey(cfg["key"].ToString());

            reqHandler.setParameter("out_trade_no", new Random().Next(111111, 999999).ToString()); //我们的订单号
            reqHandler.setParameter("body", "会员商品");                                               //商品描述
            reqHandler.setParameter("attach", "会员");                                               //附加信息
            reqHandler.setParameter("total_fee", "100");                                           //价格(已传入的为准,无就从数据库读取)

            reqHandler.setParameter("mch_create_ip", "127.0.0.1");                                 //终端IP
            reqHandler.setParameter("service", "pay.weixin.wappay");


            reqHandler.setParameter("mch_id", cfg["mch_id"].ToString());

            reqHandler.setParameter("version", cfg["version"].ToString());
            reqHandler.setParameter("notify_url", "http://baidu.com");   //回掉地址
            reqHandler.setParameter("callback_url", "http://baidu.com"); //同步回掉地址
            reqHandler.setParameter("nonce_str", Utils.random());
            reqHandler.setParameter("charset", "UTF-8");
            reqHandler.setParameter("sign_type", "MD5");
            reqHandler.createSign();
            var datawft    = Utils.toXml(reqHandler.getAllParameters());
            var reqContent = new Dictionary <string, string>
            {
                { "url", reqHandler.getGateUrl() },
                { "data", datawft }
            };

            pay.setReqContent(reqContent);
            var success = false;

            if (pay.call())
            {
                resHandler.setContent(pay.getResContent());
                resHandler.setKey(cfg["key"].ToString());
                var param = resHandler.getAllParameters();
                if (resHandler.isTenpaySign())
                {
                    if (int.Parse(param["status"].ToString()) == 0)
                    {
                        try
                        {
                            var wxpay = param["pay_info"].ToString();
                            if (wxpay.Contains("http"))
                            {
                                success = true;
                            }
                        }
                        catch
                        {
                        }
                    }
                }
            }
            return(success);
        }
示例#5
0
文件: WXGZH.aspx.cs 项目: dmhai/dxpay
        /// <summary>
        /// 威富通微信公众号支付
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            int oid = !string.IsNullOrEmpty(Request["pid"]) ? Convert.ToInt32(Request["pid"].ToString()) : 0;

            if (oid > 0)
            {
                //获取缓存
                try
                {
                    string appid = "";
                    string appms = "";
                    string code  = !string.IsNullOrEmpty(Request["code"]) ? Request["code"] : "";
                    if (!String.IsNullOrEmpty(code))
                    {
                        //第二次
                        JMP.MDL.jmp_order morder = new JMP.BLL.jmp_order().SelectOrderGoodsName(oid, "jmp_order");
                        string            ddjj   = Get_paystr(morder.o_interface_id.ToString());
                        appid = ddjj.ToString().Split(',')[2];
                        appms = ddjj.ToString().Split(',')[3];
                        string         openid   = "";
                        string         URL      = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=" + appid + "&secret=" + appms + "&code=" + code + "&grant_type=authorization_code";
                        Encoding       encoding = Encoding.UTF8;
                        HttpWebRequest request  = (HttpWebRequest)WebRequest.Create(URL);
                        request.Timeout = 3000;
                        HttpWebResponse response = (HttpWebResponse)request.GetResponse();
                        using (StreamReader reader = new StreamReader(response.GetResponseStream(), System.Text.Encoding.UTF8))
                        {
                            string jmpay = reader.ReadToEnd();
                            //解析json对象
                            JavaScriptSerializer        serializer = new JavaScriptSerializer();
                            Dictionary <string, object> json       = (Dictionary <string, object>)serializer.DeserializeObject(jmpay);
                            object value = null;
                            json.TryGetValue("openid", out value);
                            openid = value.ToString();
                        }
                        string str = "";
                        ClientResponseHandler       resHandler = new ClientResponseHandler();
                        PayHttpClient               pay        = new PayHttpClient();
                        RequestHandler              reqHandler = new RequestHandler(null);
                        Dictionary <string, string> cfg        = Utils.Load_CfgInterfaceId(morder.o_interface_id);
                        reqHandler.setGateUrl(cfg["req_url"].ToString());
                        reqHandler.setKey(cfg["key"].ToString());
                        reqHandler.setParameter("out_trade_no", morder.o_code);                                   //我们的订单号
                        reqHandler.setParameter("body", morder.o_goodsname);                                      //商品描述
                        // reqHandler.setParameter("attach", string.IsNullOrEmpty(morder.o_privateinfo) ? "404" : morder.o_privateinfo);//附加信息
                        reqHandler.setParameter("total_fee", (Convert.ToInt32(morder.o_price * 100)).ToString()); //价格
                        reqHandler.setParameter("mch_create_ip", HttpContext.Current.Request.UserHostAddress);    //终端IP
                        reqHandler.setParameter("service", "pay.weixin.jspay");
                        reqHandler.setParameter("mch_id", cfg["mch_id"].ToString());
                        reqHandler.setParameter("version", cfg["version"].ToString());
                        reqHandler.setParameter("notify_url", ConfigurationManager.AppSettings["notifyurl"].ToString().Replace("{0}", morder.o_interface_id.ToString())); //回掉地址
                        reqHandler.setParameter("callback_url", ConfigurationManager.AppSettings["callbackurl"].ToString().Replace("{0}", oid.ToString()));               //同步回掉地址
                        reqHandler.setParameter("sub_openid", openid);                                                                                                    //获取openid
                        reqHandler.setParameter("nonce_str", Utils.random());                                                                                             //随机字符串
                        reqHandler.setParameter("charset", "UTF-8");
                        reqHandler.setParameter("sign_type", "MD5");
                        reqHandler.setParameter("is_raw", "1");//原生JS
                        #region 判断是否需要禁用信用卡
                        //JMP.MDL.jmp_app moapp = new JMP.MDL.jmp_app();
                        //int tid = 0;
                        //string hc = "gzhpdxykjy" + morder.o_app_id;
                        //if (JMP.TOOL.CacheHelper.IsCache(hc))//判读是否存在缓存
                        //{
                        //    moapp = JMP.TOOL.CacheHelper.GetCaChe<JMP.MDL.jmp_app>(hc);//获取缓存
                        //    if (moapp != null)
                        //    {
                        //        tid = moapp.a_apptype_id > 0 ? moapp.a_apptype_id : 0;
                        //        if (tid == 0)
                        //        {
                        //            JMP.BLL.jmp_app blapp = new JMP.BLL.jmp_app();
                        //            moapp = blapp.SelectId(morder.o_app_id);
                        //            JMP.TOOL.CacheHelper.CacheObjectLocak<JMP.MDL.jmp_app>(moapp, hc, 5);//存入缓存
                        //        }
                        //    }
                        //    else
                        //    {
                        //        JMP.BLL.jmp_app blapp = new JMP.BLL.jmp_app();
                        //        moapp = blapp.SelectId(morder.o_app_id);
                        //        tid = moapp.a_apptype_id > 0 ? moapp.a_apptype_id : 0;
                        //        JMP.TOOL.CacheHelper.CacheObjectLocak<JMP.MDL.jmp_app>(moapp, hc, 5);//存入缓存
                        //    }
                        //}
                        //else
                        //{
                        //    JMP.BLL.jmp_app blapp = new JMP.BLL.jmp_app();
                        //    moapp = blapp.SelectId(morder.o_app_id);
                        //    tid = moapp.a_apptype_id > 0 ? moapp.a_apptype_id : 0;
                        //    JMP.TOOL.CacheHelper.CacheObjectLocak<JMP.MDL.jmp_app>(moapp, hc, 5);//存入缓存
                        //}
                        //if (tid == 71)
                        //{
                        //    reqHandler.setParameter("limit_credit_pay", "1");//是否限制信用卡(1:限制,0:不限制)
                        //}
                        #endregion
                        reqHandler.createSign();
                        string datawft = Utils.toXml(reqHandler.getAllParameters());
                        Dictionary <string, string> reqContent = new Dictionary <string, string>();
                        reqContent.Add("url", reqHandler.getGateUrl());
                        reqContent.Add("data", datawft);
                        pay.setReqContent(reqContent);
                        if (pay.call())
                        {
                            resHandler.setContent(pay.getResContent());
                            resHandler.setKey(cfg["key"].ToString());
                            Hashtable param = resHandler.getAllParameters();
                            Dictionary <string, string> dic = JMP.TOOL.UrlStr.hastable(param);
                            string wftmsg = JMP.TOOL.JsonHelper.DictJsonstr(dic);
                            if (resHandler.isTenpaySign())
                            {
                                if (int.Parse(param["status"].ToString()) == 0 && int.Parse(param["result_code"].ToString()) == 0)
                                {
                                    string pay_info = dic["pay_info"];
                                    if (!string.IsNullOrEmpty(pay_info))
                                    {
                                        Dictionary <string, object> List = new Dictionary <string, object>();
                                        List = JMP.TOOL.JsonHelper.DataRowFromJSON(pay_info);
                                        try
                                        {
                                            string chengstr = "<script type=\"text/javascript\">function onBridgeReady(){WeixinJSBridge.invoke( 'getBrandWCPayRequest', {\"appId\": \"" + List["appId"] + "\", \"timeStamp\": \"" + List["timeStamp"] + "\", \"nonceStr\": \"" + List["nonceStr"] + "\",\"package\":\"" + List["package"] + "\",\"signType\": \"MD5\",\"paySign\": \"" + List["paySign"] + "\" },function(res) {if (res.err_msg ==\"get_brand_wcpay_request:ok\") {  window.location.href=\"" + List["callback_url"] + "\" }else{ alert(res.err_msg) } });}if (typeof WeixinJSBridge == \"undefined\"){if (document.addEventListener){document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);}else if (document.attachEvent){document.attachEvent('WeixinJSBridgeReady', onBridgeReady); document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);} }else{onBridgeReady();}</script> ";
                                            Response.Write(chengstr);
                                        }
                                        catch
                                        {
                                            string wftzfsbxin = "威富通公众号支付失败信息,错误信息:" + wftmsg;
                                            PayApiDetailErrorLogger.UpstreamPaymentErrorLog("报错信息openid:" + openid + ":" + wftzfsbxin, summary: "威富通公众号接口错误信息2", channelId: oid);
                                            str = "{\"Message\":\"支付通道异常\",\"ErrorCode\":104}";
                                        }
                                    }
                                    else
                                    {
                                        string wftzfsbxin = "威富通公众号支付失败信息,错误信息:" + wftmsg;
                                        PayApiDetailErrorLogger.UpstreamPaymentErrorLog("报错信息openid:" + openid + ":" + wftzfsbxin, summary: "威富通公众号接口错误信息4", channelId: oid);
                                        str = "{\"Message\":\"支付通道异常\",\"ErrorCode\":104}";
                                    }
                                }
                                else
                                {
                                    string wftzfsbxin = "威富通公众号支付失败信息,错误信息:" + wftmsg;
                                    PayApiDetailErrorLogger.UpstreamPaymentErrorLog("报错信息openid:" + openid + ":" + wftzfsbxin, summary: "威富公众号通接口错误信息3", channelId: oid);
                                    str = "{\"Message\":\"支付通道异常\",\"ErrorCode\":104}";
                                }
                            }
                            else
                            {
                                str = "{\"Message\":\"支付通道异常\",\"ErrorCode\":104}";
                                PayApiDetailErrorLogger.UpstreamPaymentErrorLog("报错信息openid:" + openid, summary: "威富公众号通接口错误信息4", channelId: oid);
                            }
                        }
                        else
                        {
                            str = "{\"Message\":\"支付通道异常\",\"ErrorCode\":104}";
                            PayApiDetailErrorLogger.UpstreamPaymentErrorLog("报错信息openid:" + openid, summary: "威富公众号通接口错误信息5", channelId: oid);
                        }
                        Response.Write(str);
                    }
                    else
                    {
                        JMP.MDL.jmp_app mo   = new JMP.MDL.jmp_app();
                        JMP.BLL.jmp_app blls = new JMP.BLL.jmp_app();
                        mo = JMP.TOOL.MdlList.ToModel <JMP.MDL.jmp_app>(blls.GetList(" a_id=(SELECT o_app_id FROM jmp_order WHERE o_id=" + oid + ")  ").Tables[0]);
                        if (mo != null)
                        {
                            Dictionary <string, string> cfg = Utils.loadCfgWxgzh(mo.a_rid, mo.a_id);
                            JMP.BLL.jmp_order           bll = new JMP.BLL.jmp_order();
                            if (bll.UpdatePay(oid, int.Parse(cfg["pay_id"].ToString())))
                            {
                                string ddjj = Get_paystr(cfg["pay_id"].ToString());
                                appid = ddjj.ToString().Split(',')[2];
                                appms = ddjj.ToString().Split(',')[3];
                                string url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + appid + "&redirect_uri=" + ConfigurationManager.AppSettings["redirecturi"].ToString() + oid + ".html&response_type=code&scope=snsapi_base#wechat_redirect";
                                Response.Redirect(url, false);
                            }
                        }
                        else
                        {
                            string str = "{\"Message\":\"支付接口异常\",\"ErrorCode\":102}";
                            Response.Write(str);
                        }
                    }
                }
                catch (Exception ex)
                {
                    PayApiDetailErrorLogger.UpstreamPaymentErrorLog("报错信息:" + ex.ToString() + "订单表id:" + oid, summary: "威富公众号通接口错误信息", channelId: oid);
                    Response.Write("非法访问!");
                }
            }
            else
            {
                PayApiDetailErrorLogger.UpstreamPaymentErrorLog("报错信息:第一步判断,订单表id:" + oid, summary: "威富公众号通接口错误信息", channelId: oid);
                Response.Write("非法访问!");
            }
        }