public ActionResult Payment(int type, string security, string products) { if (security == null || security.IsEmpty() || security.Length < 5) { return(Json(new HttpResp(1, "请输入支付密码"))); } if (products == null) { return(Json(new HttpResp(1, "商品清单是空的哦~"))); } var session = SessionInfo.GetSession(); var user = UserService.GetUserById(session.Uid); // 1.安全验证 var cause = string.Empty; bool checkResult = PayService.CheckSecurityPassword(user, security, ref cause); if (!checkResult) { return(Json(new HttpResp(1, cause))); } // 2.判断支付类型(0=钱包支付, ^=站外支付平台) if (type == 1) { return(Redirect("/payment/toPay?type=1")); } // 3.生成记录 var productList = products.Split(',').ToList(); IList <Orders> orderses = new List <Orders>(); productList.ForEach(p => { orderses.Add(new Orders() { Pid = Convert.ToInt32(p), Uid = session.Uid, TradeType = type }); }); var placeOrder = OrderFacade.PlaceOrder(orderses); if (placeOrder) { return(Json(new HttpResp("支付成功"))); } return(Json(new HttpResp(1, "支付失败"))); }