/// <summary> /// 封装加密字符串 /// </summary> /// <returns></returns> private static string EncryptionStr(CheckoutJsonModel mode, int PayType) { string jsonStr = ""; mode.paytype = PayType.ToString(); string encrypt = JMP.TOOL.JsonHelper.Serialize(mode); jsonStr = JMP.TOOL.Encrypt.IndexEncrypt(encrypt); return(jsonStr); }
/// <summary> /// H5收银台界面 /// </summary> /// <returns></returns> public ActionResult checkout() { string code = string.IsNullOrEmpty(Request["code"]) ? "" : Request["code"]; if (!string.IsNullOrEmpty(code)) { string json = JMP.TOOL.Encrypt.IndexDecrypt(code); CheckoutJsonModel mdoe = JMP.TOOL.JsonHelper.Deserialize <CheckoutJsonModel>(json); if (mdoe != null) { ViewBag.mode = mdoe; var paymodes = mdoe.paytype.Split(',').Select(x => Convert.ToInt32(x)).ToList(); H5ViewModel H5ViewModel = new H5ViewModel { Price = mdoe.price, code = mdoe.code, goodsname = mdoe.goodsname, Parameter = json }; var lst = PaymentModeLoader.PaymentModeSource.Where(x => paymodes.Any(p => p == x.PayType)).ToList(); foreach (var t in lst) { t.Price = H5ViewModel.Price; t.Enabled = t.PaymentEnableDetect(IsWx, IsMobile); t.encryption = EncryptionStr(mdoe, t.PayType); } H5ViewModel.PaymentModes = lst.OrderByDescending(x => x.Enabled).ThenBy(x => x.Category).ToList(); ViewBag.H5ViewModel = H5ViewModel; } else { Response.Redirect("/H5/Error"); } } else { Response.Redirect("/H5/Error"); } return(View()); }