public ActionResult GenerateQRcode(int Id, decimal Amount, string sign, int memberId)
        {
            try
            {
                FashionData fd = new FashionData();
                fd.SetValue("Id", Id);
                fd.SetValue("Price", Amount);
                fd.SetValue("UserId", memberId);
                fd.SetValue("sign", sign);
                if (fd.CheckSign())
                {
                    var Price = _storeValueRuleContract.StoreValueRules.Where(x => x.Id == Id).ToList().FirstOrDefault();

                    if (Price != null)
                    {
                        if (Amount == Price.Price)
                        {
                            Dictionary <string, object> m_value = new Dictionary <string, object>();
                            string bodyStr = "";
                            //商品信息描述
                            if (Price.RuleType == 0)
                            {
                                bodyStr = "零时尚充值中心-储值充值";
                            }
                            else
                            {
                                bodyStr = "零时尚充值中心-积分充值";
                            }
                            RechargeOrder order = new RechargeOrder();
                            order.Amount       = Convert.ToDecimal(Amount);
                            order.RechargeType = (MemberActivityFlag)Price.RuleType;
                            order.RuleTypeId   = Convert.ToInt32(Price.Id);
                            if (Price.RuleType == 0)
                            {
                                //储值
                                order.TureAmount = Convert.ToDecimal(Price.RewardMoney + Price.Price);
                            }
                            else if (Price.RuleType == 1)
                            {
                                //积分
                                order.TureAmount = Convert.ToDecimal(Price.Score);
                            }
                            order.Pay_Type = Convert.ToInt32(3);
                            order.UserId   = memberId;
                            //订单号生成规则 当前时间+随机5位数
                            string out_trade_no = DateTime.Now.ToString("yyyyMMddHHmmssffff").ToString() + new Random().Next(10000, 99999).ToString();
                            order.order_Uid = out_trade_no;
                            var res = _rechargeOrderContract.Insert(order);
                            if (res.ResultType == OperationResultType.Success)
                            {
                                var product_id = _rechargeOrderContract.RechargeOrders.Where(x => x.order_Uid == out_trade_no)
                                                 .Select(x => x.Id).FirstOrDefault();
                                WxPayData wxdata = new WxPayData();
                                wxdata.SetValue("body", bodyStr);//商品描述
                                wxdata.SetValue("attach", "test");
                                wxdata.SetValue("out_trade_no", out_trade_no);
                                //总金额    订单总金额,只能为整数,详见支付金额   注意:金额不带小数点,最小为分,即1元=100分,传数据即可
                                wxdata.SetValue("total_fee", 1);
                                wxdata.SetValue("time_start", DateTime.Now.ToString("yyyyMMddHHmmss"));
                                wxdata.SetValue("time_expire", DateTime.Now.AddMinutes(10).ToString("yyyyMMddHHmmss"));
                                wxdata.SetValue("trade_type", "NATIVE");
                                wxdata.SetValue("nonce_str", Guid.NewGuid().ToString().Replace("-", ""));
                                wxdata.SetValue("product_id", product_id);
                                wxdata.SetValue("appid", PaymentConfigHelper.Wx_XD_AppId);
                                wxdata.SetValue("mch_id", PaymentConfigHelper.Wx_XD_MCHID);  //商户号
                                wxdata.SetValue("spbill_create_ip", PaymentConfigHelper.Ip); //终端ip
                                WxPayData result = WxPayApi.UnifiedOrder(wxdata, 6, 2, 2);
                                ViewData["out_trade_no"] = out_trade_no;
                                if (result.GetValue("return_code").ToString() == "SUCCESS")
                                {
                                    if (result.GetValue("code_url").ToString() != "")
                                    {
                                        string url = result.GetValue("code_url").ToString();//获得统一下单接口返回的二维码链接
                                        ViewBag.image = ImageHelper.CreateQRCode(url, Guid.NewGuid().ToString().Replace("-", ""));
                                    }
                                    else
                                    {
                                        ViewBag.error = "此次充值异常";
                                    }
                                }
                                else
                                {
                                    ViewBag.error = "此次充值异常";
                                }
                            }
                            else
                            {
                                ViewBag.error = "此次充值异常";
                            }
                        }
                        else
                        {
                            ViewBag.error = "充值金额有误";
                        }
                    }
                    else
                    {
                        ViewBag.error = "此次充值异常";
                    }
                }
                else
                {
                    ViewBag.error = "此次充值异常";
                }
            }
            catch (Exception e)
            {
                ViewBag.error = "此次充值异常";
            }
            return(PartialView());
        }