UnifiedOrder() public static method

public static UnifiedOrder ( WxPayData inputObj, int timeOut = 6 ) : WxPayData
inputObj WxPayData
timeOut int
return WxPayData
示例#1
0
文件: NativePay.cs 项目: bowena/faka
        /**
         * 生成直接支付url,支付url有效期为2小时,模式二
         * @param productId 商品ID
         * @return 模式二URL
         */
        public string GetPayUrl(string productId, int price, string name, string tradeNo)
        {
            Log.Info(this.GetType().ToString(), "Native pay mode 2 url is producing...");

            WxPayData data = new WxPayData();

            data.SetValue("body", name);                                                          //商品描述
            data.SetValue("attach", name);                                                        //附加数据
            data.SetValue("out_trade_no", tradeNo);                                               //随机字符串
            data.SetValue("total_fee", price);                                                    //总金额
            data.SetValue("time_start", DateTime.Now.ToString("yyyyMMddHHmmss"));                 //交易起始时间
            data.SetValue("time_expire", DateTime.Now.AddMinutes(10).ToString("yyyyMMddHHmmss")); //交易结束时间
            data.SetValue("goods_tag", "jjj");                                                    //商品标记
            data.SetValue("trade_type", "NATIVE");                                                //交易类型
            data.SetValue("product_id", productId);                                               //商品ID

            WxPayData result = WxPayApi.UnifiedOrder(data);                                       //调用统一下单接口
            string    url    = result.GetValue("code_url").ToString();                            //获得统一下单接口返回的二维码链接

            Log.Info(this.GetType().ToString(), "Get native pay mode 2 url : " + url);
            return(url);
        }
示例#2
0
        /**
         * 生成直接支付url,支付url有效期为2小时,模式二
         * @param productId 商品ID
         * @return 模式二URL
         */
        public string GetPayUrl(string productId)
        {
            Log.Info(this.GetType().ToString(), "正在为您进入支付页面...");

            WxPayData data = new WxPayData();

            data.SetValue("body", "锐锋科技自动化产品");                                                   //商品描述
            data.SetValue("attach", "永久激活");                                                      //附加数据
            data.SetValue("out_trade_no", WxPayApi.GenerateOutTradeNo());                         //随机字符串
            data.SetValue("total_fee", 0.1);                                                      //总金额
            data.SetValue("time_start", DateTime.Now.ToString("yyyyMMddHHmmss"));                 //交易起始时间
            data.SetValue("time_expire", DateTime.Now.AddMinutes(10).ToString("yyyyMMddHHmmss")); //交易结束时间
            data.SetValue("goods_tag", "二次开发数字化中心");                                              //商品标记
            data.SetValue("trade_type", "NATIVE");                                                //交易类型
            data.SetValue("product_id", productId);                                               //商品ID

            WxPayData result = WxPayApi.UnifiedOrder(data);                                       //调用统一下单接口
            string    url    = result.GetValue("code_url").ToString();                            //获得统一下单接口返回的二维码链接

            Log.Info(this.GetType().ToString(), "Get native pay mode 2 url : " + url);
            return(url);
        }
示例#3
0
        /**
         * 生成直接支付url,支付url有效期为2小时,模式二
         * @param productId 商品ID
         * @return 模式二URL
         */
        public string GetPayUrl(PaperInfo paperInfo, out string _orderNumber)
        {
            _orderNumber = WxPayApi.GenerateOutTradeNo();
            Log.Info(this.GetType().ToString(), "Native pay mode 2 url is producing...");
            int       price = Convert.ToInt32(paperInfo.Price * 100);
            WxPayData data  = new WxPayData();

            data.SetValue("body", "启源论文网");                                                       //商品描述
            data.SetValue("attach", "QYLW");                                                      //附加数据
            data.SetValue("out_trade_no", _orderNumber);                                          //随机字符串
            data.SetValue("total_fee", price);                                                    //总金额
            data.SetValue("time_start", DateTime.Now.ToString("yyyyMMddHHmmss"));                 //交易起始时间
            data.SetValue("time_expire", DateTime.Now.AddMinutes(10).ToString("yyyyMMddHHmmss")); //交易结束时间
            data.SetValue("goods_tag", "QY");                                                     //商品标记
            data.SetValue("trade_type", "NATIVE");                                                //交易类型
            data.SetValue("product_id", paperInfo.Code);                                          //商品ID
            WxPayData result = WxPayApi.UnifiedOrder(data);                                       //调用统一下单接口
            string    url    = result.GetValue("code_url").ToString();                            //获得统一下单接口返回的二维码链接

            Log.Info(this.GetType().ToString(), "Get native pay mode 2 url : " + url);
            return(url);
        }
示例#4
0
        /// <summary>
        /// 生成直接支付url,支付url有效期为2小时,模式二
        /// </summary>
        /// <param name="productId">商品ID</param>
        /// <param name="body">商品描述,此处为平台名称</param>
        /// <param name="out_trade_no">商户订单号</param>
        /// <param name="total_fee">充值金额,单位为分</param>
        /// <param name="appid">公众号id</param>
        /// <param name="mchid">微信商户id</param>
        /// <param name="paykey">微信商户支付密码</param>
        /// <param name="notify_url">回调地址</param>
        /// <param name="buyer">买家信息</param>
        /// <returns></returns>
        public string GetPayUrl(string productId, string body, string out_trade_no, int total_fee, string appid, string mchid, string paykey, string notify_url, string buyer)
        {
            Log.Info(this.GetType().ToString(), "Native pay mode 2 url is producing...");

            WxPayData data = new WxPayData();

            data.SetValue("body", body);                                          //商品描述
            data.SetValue("attach", buyer);                                       //附加数据
            data.SetValue("out_trade_no", out_trade_no);                          //商户订单号
            data.SetValue("total_fee", total_fee);                                //总金额
            data.SetValue("time_start", DateTime.Now.ToString("yyyyMMddHHmmss")); //交易起始时间
            //data.SetValue("time_expire", DateTime.Now.AddMinutes(10).ToString("yyyyMMddHHmmss"));//交易结束时间
            data.SetValue("goods_tag", "null");                                   //商品标记
            data.SetValue("trade_type", "NATIVE");                                //交易类型(JSAPI 公众号支付、NATIVE 扫码支付、APP APP支付)
            data.SetValue("product_id", productId);                               //商品ID

            WxPayData result = WxPayApi.UnifiedOrder(data, appid, mchid, paykey, WeiSha.Common.Server.IP, notify_url);
            string    url    = result.GetValue("code_url").ToString();//获得统一下单接口返回的二维码链接

            Log.Info(this.GetType().ToString(), "Get native pay mode 2 url : " + url);
            return(url);
        }
示例#5
0
        /// <summary>
        ///  调用统一下单,获得下单结果
        /// </summary>
        /// <param name="tracetype">支付方式,(JSAPI 公众号支付、NATIVE 扫码支付、APP APP支付、MWEB H5支付)</param>
        /// <param name="body">平台名称</param>
        /// <param name="out_trade_no">商户订单号</param>
        /// <param name="appid">公众号id</param>
        /// <param name="mchid">商户id</param>
        /// <param name="paykey">商户支付密钥</param>
        /// <param name="notify_url">返回域</param>
        /// <param name="buyer">付款方账号(学习系统账号,非微信账号)</param>
        /// <returns></returns>
        public WxPayData GetUnifiedOrderResult(string tracetype, string body, string out_trade_no, string appid, string mchid, string paykey, string notify_url, string buyer)
        {
            //统一下单
            WxPayData data = new WxPayData();

            //商品简单描述,该字段请按照规范传递,(商家名称-销售商品类目)https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=4_2
            body = !string.IsNullOrWhiteSpace(body) && body.Length > 100 ? body.Substring(0, 100) : body;
            data.SetValue("body", body);
            //附加数据,在查询API和支付通知中原样返回,该字段主要用于商户携带订单的自定义数据
            data.SetValue("attach", buyer);
            //商户系统内部订单号,要求32个字符内,只能是数字、大小写字母_-|*@ ,且在同一个商户号下唯一。
            //data.SetValue("out_trade_no", WxPayApi.GenerateOutTradeNo());
            data.SetValue("out_trade_no", out_trade_no);
            //资金数,以“分”为单位
            data.SetValue("total_fee", total_fee);
            data.SetValue("time_start", DateTime.Now.ToString("yyyyMMddHHmmss"));
            //data.SetValue("time_expire", DateTime.Now.AddMinutes(10).ToString("yyyyMMddHHmmss"));
            //订单优惠标记,使用代金券或立减优惠功能时需要的参数
            data.SetValue("goods_tag", "null");
            //支付方式(JSAPI 公众号支付、NATIVE 扫码支付、APP APP支付)
            data.SetValue("trade_type", tracetype);
            data.SetValue("openid", openid);
            if (!string.IsNullOrWhiteSpace(this.fingerprint))
            {
                data.SetValue("fingerprint", fingerprint);
            }

            WxPayData result = WxPayApi.UnifiedOrder(data, appid, mchid, paykey, WeiSha.Common.Browser.IP, notify_url);

            if (!result.IsSet("appid") || !result.IsSet("prepay_id") || result.GetValue("prepay_id").ToString() == "")
            {
                Log.Error(this, "UnifiedOrder response error!");
                throw new WxPayException("UnifiedOrder response error!");
            }

            unifiedOrderResult = result;
            return(result);
        }
示例#6
0
        /// <summary>
        /// 通過商品ID,生成直接支付url,支付url有效期为2小时,模式二
        /// </summary>
        /// <param name="productId">商品ID</param>
        /// <returns>模式二URL</returns>
        public string GetPayUrl(string productId, out string strBusinessNo)
        {
            Log.Info(this.GetType().ToString(), "Native pay mode 2 url is producing...");

            WxPayData data = new WxPayData();

            data.SetValue("body", "汕頭大學智能儀錶繳費系統");                                                //商品描述
            data.SetValue("attach", "test");                                                      //附加数据
            data.SetValue("out_trade_no", WxPayApi.GenerateOutTradeNo());                         //随机字符串
            data.SetValue("total_fee", 1);                                                        //总金额,單位是:分
            data.SetValue("time_start", DateTime.Now.ToString("yyyyMMddHHmmss"));                 //交易起始时间
            data.SetValue("time_expire", DateTime.Now.AddMinutes(10).ToString("yyyyMMddHHmmss")); //交易结束时间
            data.SetValue("goods_tag", "YADA");                                                   //商品标记
            data.SetValue("trade_type", "NATIVE");                                                //交易类型
            data.SetValue("product_id", productId);                                               //商品ID

            WxPayData result = WxPayApi.UnifiedOrder(data);                                       //调用统一下单接口
            string    url    = result.GetValue("code_url").ToString();                            //获得统一下单接口返回的二维码链接

            strBusinessNo = data.GetValue("out_trade_no").ToString();
            Log.Info(this.GetType().ToString(), "Get native pay mode 2 url : " + url);
            return(url);
        }
示例#7
0
        private WxPayData UnifiedOrder(string openId, string productId)
        {
            //统一下单
            WxPayData req = new WxPayData();

            req.SetValue("body", "test");
            req.SetValue("attach", "test");
            req.SetValue("out_trade_no", WxPayApi.GenerateOutTradeNo());
            req.SetValue("total_fee", 1);
            req.SetValue("time_start", DateTime.Now.ToString("yyyyMMddHHmmss"));
            req.SetValue("time_expire", DateTime.Now.AddMinutes(10).ToString("yyyyMMddHHmmss"));
            req.SetValue("goods_tag", "test");
            req.SetValue("trade_type", "NATIVE");
            req.SetValue("openid", openId);
            req.SetValue("product_id", productId);

            //set NativePay notify_url
            req.SetValue("notify_url", WxPayConfig.GetConfig().GetNativeNotifyUrl());//异步通知url

            WxPayData result = WxPayApi.UnifiedOrder(req);

            return(result);
        }
        public WxPayData GetPayUrl(int total_fee, string productId, string productName, string flag, string remark)
        {
            Log.Info(this.GetType().ToString(), "Native pay mode 2 url is producing...");

            WxPayData data = new WxPayData();

            out_trade_no = WxPayApi.GenerateOutTradeNo();
            data.SetValue("body", productName);                                                   //商品描述
            data.SetValue("attach", remark);                                                      //附加数据
            data.SetValue("out_trade_no", out_trade_no);                                          //随机字符串
            data.SetValue("total_fee", total_fee);                                                //总金额
            data.SetValue("time_start", DateTime.Now.ToString("yyyyMMddHHmmss"));                 //交易起始时间
            data.SetValue("time_expire", DateTime.Now.AddMinutes(10).ToString("yyyyMMddHHmmss")); //交易结束时间
            data.SetValue("goods_tag", flag);                                                     //商品标记
            data.SetValue("trade_type", "NATIVE");                                                //交易类型
            data.SetValue("product_id", productId);                                               //商品ID

            WxPayData result = WxPayApi.UnifiedOrder(data);                                       //调用统一下单接口

            result.SetValue("out_trade_no", out_trade_no);
            //  string url = result.GetValue("code_url").ToString();//获得统一下单接口返回的二维码链接
            //  Log.Info(this.GetType().ToString(), "Get native pay mode 2 url : " + url);
            return(result);
        }
示例#9
0
文件: H5Pay.cs 项目: wangxiaoyi12/Web
        public string GetPayUrl(string clientip, string orderCode, decimal totalAmount)
        {
            Log.Info(this.GetType().ToString(), "H5 pay url is producing...");
            WxPayData data = new WxPayData();

            data.SetValue("body", "商品描述");                             //这里替换成你的数据
            data.SetValue("attach", "详见我的订单");                         //这里替换成你的数据
            data.SetValue("out_trade_no", orderCode);                  //这里替换成你的数据  "商户订单号"
            data.SetValue("total_fee", ((int)totalAmount).ToString()); //这里替换成你的数据  "总金额"
            data.SetValue("spbill_create_ip", clientip);               //终端IP
            data.SetValue("trade_type", "MWEB");                       //交易类型
            data.SetValue("time_start", DateTime.Now.ToString("yyyyMMddHHmmss"));
            data.SetValue("time_expire", DateTime.Now.AddMinutes(10).ToString("yyyyMMddHHmmss"));
            //data.SetValue("time_start", DateTime.Now.ToString("yyyyMMddHHmmss"));
            //data.SetValue("time_expire", DateTime.Now.AddMinutes(10).ToString("yyyyMMddHHmmss"));
            data.SetValue("scene_info", "{'h5_info':{'type':'Wap','wap_url':'www.jst1314.cn','wap_name':'会员商城'}}"); //场景信息
            WxPayData result = WxPayApi.UnifiedOrder(data);                                                         //调用统一下单接口
            string    url    = result.GetValue("mweb_url").ToString();                                              //获得统一下单接口返回的链接

            Log.Info(this.GetType().ToString(), "Get H5 pay url : " + url);
            Log.Info(this.GetType().ToString(), url + "&redirect_url=http%3A%2F%2Fwww.jst1314.cn/mobile/mobilecenter");
            url = url + "&redirect_url=http%3A%2F%2Fwww.jst1314.cn/mobile/mobilecenter";
            return(url);
        }
示例#10
0
        /**
         * 生成直接支付url,支付url有效期为2小时,模式二
         * @param productId 商品ID
         * @return 模式二URL
         */
        public string GetPayUrl(string Ordernum, int total_fee)
        {
            Log.Info(this.GetType().ToString(), "Native pay mode 2 url is producing...");
            string    NewOrderNum = WxPayApi.GetOutNewOrder(Ordernum);
            string    Sercond     = DateTime.Now.Millisecond.ToString();
            WxPayData data        = new WxPayData();

            data.SetValue("body", "华体健康");//商品描述
            //data.SetValue("attach", "商品支付");//附加数据
            //data.SetValue("out_trade_no", DateTime.Now.Millisecond + "$" + models.Ordernum + "NA");//随机字符串
            data.SetValue("out_trade_no", NewOrderNum);                                           //随机字符串
            data.SetValue("total_fee", total_fee);                                                //总金额
            data.SetValue("time_start", DateTime.Now.ToString("yyyyMMddHHmmss"));                 //交易起始时间
            data.SetValue("time_expire", DateTime.Now.AddMinutes(10).ToString("yyyyMMddHHmmss")); //交易结束时间
            //data.SetValue("goods_tag", "jjj");//商品标记
            data.SetValue("trade_type", "NATIVE");                                                //交易类型
            data.SetValue("product_id", Ordernum);                                                //商品ID

            WxPayData result = WxPayApi.UnifiedOrder(data);                                       //调用统一下单接口
            string    url    = result.GetValue("code_url").ToString();                            //获得统一下单接口返回的二维码链接

            Log.Info(this.GetType().ToString(), "Get native pay mode 2 url : " + url);
            return(url);
        }
示例#11
0
        private WxPayData UnifiedOrder(string openId, string productId)
        {
            WxPayData req = new WxPayData();

            if (productId.Contains("C"))
            {
                var dt = HotelCloud.SqlServer.SQLHelper.Get_DataTable(@"select top 1 * from WeiXin..RechargeUser  where OrderNo=@OrderNo", HotelCloud.SqlServer.SQLHelper.GetCon(), new Dictionary <string, HotelCloud.SqlServer.DBParam> {
                    { "OrderNo", new HotelCloud.SqlServer.DBParam {
                          ParamValue = productId
                      } }
                });
                if (dt.Rows.Count > 0)
                {
                    foreach (System.Data.DataRow dr in dt.Rows)
                    {
                        int total_fee = Convert.ToInt32(Convert.ToDecimal(dr["SPrice"].ToString()) * 100);

                        /** ================Ashbur微信号对应支付金额 0.01元========= */
                        if (openId == "oPfrcjmqyO33T8a8Dn21Kq-QMAcg")
                        {
                            total_fee = 1;
                        }
                        if (openId == "oUM4bwdTr3DXhUkGf43lGiipmxMA")
                        {
                            total_fee = 1;
                        }
                        if (openId == "oZLQzv-cg1KvGmrTnq0xdxhK-4kc")
                        {
                            total_fee = 1;
                        }

                        if (string.IsNullOrEmpty(openId))
                        {
                            WxPayAPI.Log.Error(this.GetType().ToString(), "wxOAuthRedirect|This page have not get params, cannot be inited, exit...");
                        }
                        else
                        {
                            req.SetValue("body", "充值费用");
                            req.SetValue("attach", "presale");
                            req.SetValue("out_trade_no", dr["OrderNo"].ToString().Trim());
                            req.SetValue("total_fee", total_fee);
                            req.SetValue("time_start", DateTime.Now.ToString("yyyyMMddHHmmss"));
                            req.SetValue("time_expire", DateTime.Now.AddMinutes(30).ToString("yyyyMMddHHmmss"));
                            req.SetValue("goods_tag", "充值");
                            req.SetValue("trade_type", "NATIVE");
                            req.SetValue("openid", openId);
                            req.SetValue("product_id", dr["HotelId"].ToString().Trim());
                        }
                    }
                }
                else
                {
                    WxPayAPI.Log.Debug(this.GetType().ToString(), "无效订单或者非预订订单");
                }
            }
            else if (productId.Contains("K"))
            {
                var dt = HotelCloud.SqlServer.SQLHelper.Get_DataTable(@"select top 1 * from WeiXin..MemberCardBuyRecord  where OrderNo=@OrderNo", HotelCloud.SqlServer.SQLHelper.GetCon(), new Dictionary <string, HotelCloud.SqlServer.DBParam> {
                    { "OrderNo", new HotelCloud.SqlServer.DBParam {
                          ParamValue = productId
                      } }
                });
                if (dt.Rows.Count > 0)
                {
                    foreach (System.Data.DataRow dr in dt.Rows)
                    {
                        int total_fee = Convert.ToInt32(Convert.ToDecimal(dr["BuyMoney"].ToString()) * 100);

                        /** ================Ashbur微信号对应支付金额 0.01元========= */
                        if (openId == "oPfrcjmqyO33T8a8Dn21Kq-QMAcg")
                        {
                            total_fee = 1;
                        }
                        if (openId == "oUM4bwdTr3DXhUkGf43lGiipmxMA")
                        {
                            total_fee = 1;
                        }
                        if (openId == "oZLQzv-cg1KvGmrTnq0xdxhK-4kc")
                        {
                            total_fee = 1;
                        }

                        if (string.IsNullOrEmpty(openId))
                        {
                            WxPayAPI.Log.Error(this.GetType().ToString(), "wxOAuthRedirect|This page have not get params, cannot be inited, exit...");
                        }
                        else
                        {
                            req.SetValue("body", "会员卡购买");
                            req.SetValue("attach", "presale");
                            req.SetValue("out_trade_no", dr["OrderNo"].ToString().Trim());
                            req.SetValue("total_fee", total_fee);
                            req.SetValue("time_start", DateTime.Now.ToString("yyyyMMddHHmmss"));
                            req.SetValue("time_expire", DateTime.Now.AddMinutes(30).ToString("yyyyMMddHHmmss"));
                            req.SetValue("goods_tag", "会员卡消费");
                            req.SetValue("trade_type", "NATIVE");
                            req.SetValue("openid", openId);
                            req.SetValue("product_id", dr["HotelId"].ToString().Trim());
                        }
                    }
                }
                else
                {
                    WxPayAPI.Log.Debug(this.GetType().ToString(), "无效订单或者非预订订单");
                }
            }
            else if (productId.IndexOf("D") > -1)
            {
                var dt = HotelCloud.SqlServer.SQLHelper.Get_DataTable(@"select top 1 * from WeiXin..SupermarketOrder_Levi where OrderId=@OrderId", HotelCloud.SqlServer.SQLHelper.GetCon(), new Dictionary <string, HotelCloud.SqlServer.DBParam> {
                    { "OrderId", new HotelCloud.SqlServer.DBParam {
                          ParamValue = productId
                      } }
                });
                if (dt.Rows.Count > 0)
                {
                    foreach (System.Data.DataRow dr in dt.Rows)
                    {
                        int total_fee = Convert.ToInt32(Convert.ToDecimal(dr["Money"].ToString()) * 100);

                        /** ================Ashbur微信号对应支付金额 0.01元========= */
                        if (openId == "oPfrcjmqyO33T8a8Dn21Kq-QMAcg")
                        {
                            total_fee = 1;
                        }
                        if (openId == "oUM4bwdTr3DXhUkGf43lGiipmxMA")
                        {
                            total_fee = 1;
                        }
                        if (openId == "oZLQzv-cg1KvGmrTnq0xdxhK-4kc")
                        {
                            total_fee = 1;
                        }

                        if (string.IsNullOrEmpty(openId))
                        {
                            WxPayAPI.Log.Error(this.GetType().ToString(), "wxOAuthRedirect|This page have not get params, cannot be inited, exit...");
                        }
                        else
                        {
                            req.SetValue("body", "酒店周边超市消费");
                            req.SetValue("attach", "consumption");
                            req.SetValue("out_trade_no", dr["OrderId"].ToString().Trim());
                            req.SetValue("total_fee", total_fee);
                            req.SetValue("time_start", DateTime.Now.ToString("yyyyMMddHHmmss"));
                            req.SetValue("time_expire", DateTime.Now.AddMinutes(30).ToString("yyyyMMddHHmmss"));
                            req.SetValue("goods_tag", "酒店周边超市消费");
                            req.SetValue("trade_type", "NATIVE");
                            req.SetValue("openid", openId);
                            req.SetValue("product_id", dr["HotelId"].ToString().Trim());
                        }
                    }
                }
                else
                {
                    WxPayAPI.Log.Debug(this.GetType().ToString(), "无效订单或者非预订订单");
                }
            }
            else if (productId.Contains("P"))
            {
                var dt = HotelCloud.SqlServer.SQLHelper.Get_DataTable(@"select top 1 * from WeiXin..SaleProducts_Orders where OrderNo=@OrderNo", HotelCloud.SqlServer.SQLHelper.GetCon(), new Dictionary <string, HotelCloud.SqlServer.DBParam> {
                    { "OrderNo", new HotelCloud.SqlServer.DBParam {
                          ParamValue = productId
                      } }
                });
                if (dt.Rows.Count > 0)
                {
                    foreach (System.Data.DataRow dr in dt.Rows)
                    {
                        int total_fee = Convert.ToInt32(Convert.ToDecimal(dr["OrderMoney"].ToString()) * 100);

                        /** ================Ashbur微信号对应支付金额 0.01元========= */
                        if (openId == "oPfrcjmqyO33T8a8Dn21Kq-QMAcg")
                        {
                            total_fee = 1;
                        }
                        if (openId == "oUM4bwdTr3DXhUkGf43lGiipmxMA")
                        {
                            total_fee = 1;
                        }
                        if (openId == "oZLQzv-cg1KvGmrTnq0xdxhK-4kc")
                        {
                            total_fee = 1;
                        }

                        if (string.IsNullOrEmpty(openId))
                        {
                            WxPayAPI.Log.Error(this.GetType().ToString(), "wxOAuthRedirect|This page have not get params, cannot be inited, exit...");
                        }
                        else
                        {
                            req.SetValue("body", dr["ProductName"].ToString().Trim());
                            req.SetValue("attach", "presale");
                            req.SetValue("out_trade_no", dr["OrderNo"].ToString().Trim());
                            req.SetValue("total_fee", total_fee);
                            req.SetValue("time_start", DateTime.Now.ToString("yyyyMMddHHmmss"));
                            req.SetValue("time_expire", DateTime.Now.AddMinutes(30).ToString("yyyyMMddHHmmss"));
                            req.SetValue("goods_tag", dr["ProductName"].ToString().Trim() + "[" + dr["TcName"].ToString().Trim() + "]");
                            req.SetValue("trade_type", "NATIVE");
                            req.SetValue("openid", openId);
                            req.SetValue("product_id", dr["HotelId"].ToString().Trim());
                        }
                    }
                }
                else
                {
                    WxPayAPI.Log.Debug(this.GetType().ToString(), "无效订单或者非预订订单");
                }
            }
            else if (productId.Contains("L"))
            {
                var dt = HotelCloud.SqlServer.SQLHelper.Get_DataTable(@"select top 1 bagging,amount,youhuiamount,ISNULL(CouponMoney,0) as CouponMoney,hotelid,userweixinid,hotelWeixinId,orderCode,(select sum(AliPayAmount) from  WeiXin..wkn_payrecords where OrderNO=orderCode and Channel='微信支付回调') as zhifu  from WeiXin..T_OrderInfo where orderCode=@orderCode", HotelCloud.SqlServer.SQLHelper.GetCon(), new Dictionary <string, HotelCloud.SqlServer.DBParam> {
                    { "orderCode", new HotelCloud.SqlServer.DBParam {
                          ParamValue = productId
                      } }
                });
                if (dt.Rows.Count > 0)
                {
                    foreach (System.Data.DataRow dr in dt.Rows)
                    {
                        string bagging      = dr["bagging"].ToString();
                        string youhuiamount = dr["youhuiamount"].ToString();
                        if (string.IsNullOrEmpty(bagging))
                        {
                            bagging = "0";
                        }
                        if (string.IsNullOrEmpty(youhuiamount))
                        {
                            youhuiamount = "0";
                        }
                        int total_fee = Convert.ToInt32((Convert.ToDecimal(dr["amount"].ToString()) - Convert.ToDecimal(youhuiamount) + Convert.ToDecimal(bagging) - Convert.ToDecimal(dr["CouponMoney"].ToString())) * 100);

                        /** ================Ashbur微信号对应支付金额 0.01元========= */
                        if (openId == "oPfrcjmqyO33T8a8Dn21Kq-QMAcg")
                        {
                            total_fee = 1;
                        }
                        if (openId == "oUM4bwdTr3DXhUkGf43lGiipmxMA")
                        {
                            total_fee = 1;
                        }
                        if (openId == "oZLQzv-cg1KvGmrTnq0xdxhK-4kc")
                        {
                            total_fee = 1;
                        }

                        if (string.IsNullOrEmpty(openId))
                        {
                            WxPayAPI.Log.Error(this.GetType().ToString(), "wxOAuthRedirect|This page have not get params, cannot be inited, exit...");
                        }
                        else
                        {
                            req.SetValue("body", "酒店周边餐饮消费");
                            req.SetValue("attach", "consumption");
                            req.SetValue("out_trade_no", dr["orderCode"].ToString().Trim());
                            req.SetValue("total_fee", total_fee);
                            req.SetValue("time_start", DateTime.Now.ToString("yyyyMMddHHmmss"));
                            req.SetValue("time_expire", DateTime.Now.AddMinutes(30).ToString("yyyyMMddHHmmss"));
                            req.SetValue("goods_tag", "酒店周边餐饮消费");
                            req.SetValue("trade_type", "NATIVE");
                            req.SetValue("openid", openId);
                            req.SetValue("product_id", dr["hotelid"].ToString().Trim());
                        }
                    }
                }
                else
                {
                    WxPayAPI.Log.Debug(this.GetType().ToString(), "无效订单或者非预订订单");
                }
            }
            else
            {
                hotel3g.Repository.Order order = hotel3g.Repository.OrderRepository.GetOrderInfo(productId);
                if (order == null || order.PayType != "0")
                {
                    WxPayAPI.Log.Debug(this.GetType().ToString(), "无效订单或者非预订订单");
                }
                else
                {
                    int total_fee = order.OrderAmount * 100;//Convert.ToInt32(((int)Math.Ceiling(order.OrderAmount * (rate / 10))).ToString()) * 100;

                    /** ================Ashbur微信号对应支付金额 0.01元========= */
                    if (openId == "oPfrcjmqyO33T8a8Dn21Kq-QMAcg")
                    {
                        total_fee = 1;
                    }
                    if (openId == "oUM4bwdTr3DXhUkGf43lGiipmxMA")
                    {
                        total_fee = 1;
                    }
                    if (openId == "oZLQzv-cg1KvGmrTnq0xdxhK-4kc")
                    {
                        total_fee = 1;
                    }

                    if (string.IsNullOrEmpty(openId))
                    {
                        WxPayAPI.Log.Error(this.GetType().ToString(), "wxOAuthRedirect|This page have not get params, cannot be inited, exit...");
                    }
                    else
                    {
                        req.SetValue("body", order.HotelName.Trim());
                        req.SetValue("attach", "weikeniuwx");
                        req.SetValue("out_trade_no", order.OrderNo);
                        req.SetValue("total_fee", total_fee);
                        req.SetValue("time_start", DateTime.Now.ToString("yyyyMMddHHmmss"));
                        req.SetValue("time_expire", DateTime.Now.AddMinutes(30).ToString("yyyyMMddHHmmss"));
                        req.SetValue("goods_tag", order.RoomName + "[" + order.RatePlanName + "]");
                        req.SetValue("trade_type", "NATIVE");
                        req.SetValue("openid", openId);
                        req.SetValue("product_id", order.HotelID.ToString());
                    }
                }
            }
            WxPayData result = WxPayApi.UnifiedOrder(req);

            return(result);
        }