public ActionResult ProductItem(int productId, int hc) { dynamic job = new OrderService().GetOrderByOrderID(productId); if (job == null) { return(Content("商品信息不存在,或非法进入!2003")); } //判断是否正在微信端 //if (BrowserUtility.BrowserUtility.SideInWeixinBrowser(HttpContext)) if (BrowserUtility.SideInWeixinBrowser(HttpContext)) { //正在微信端,直接跳转到微信支付页面 return(RedirectToAction("JsApi", new { productId = productId, hc = hc })); } else { //在PC端打开,提供二维码扫描进行支付 return(View(job)); } }
public ActionResult ProductItem(int productId, int hc) { var products = ProductModel.GetFakeProductList(); var product = products.FirstOrDefault(z => z.Id == productId); if (product == null || product.GetHashCode() != hc) { return(Content("商品信息不存在,或非法进入!2003")); } //判断是否正在微信端 //if (BrowserUtility.BrowserUtility.SideInWeixinBrowser(HttpContext)) if (BrowserUtility.SideInWeixinBrowser(HttpContext)) { //正在微信端,直接跳转到微信支付页面 return(RedirectToAction("JsApi", new { productId = productId, hc = hc })); } else { //在PC端打开,提供二维码扫描进行支付 return(View(product)); } }