/// <summary> /// 用户实名认证 /// </summary> /// <returns></returns> public ActionResult UserApprove(int?Id) { ViewBag.Title = "实名认证"; //TODO:判断用户是否提交过认证信息 BLL.Members.UsersApprove manage = new BLL.Members.UsersApprove(); Model.Members.UsersApprove model = new Model.Members.UsersApprove(); model = manage.GetModelByUserID(CurrentUser.UserID); if (model != null) { return(Redirect(string.Format("{0}UserCenter/SubmitSucc/{1}", MvcApplication.GetCurrentRoutePath(AreaRoute.Shop), model.Status))); } if (Id.HasValue) { if (Session["USERAPPROVE"] != null) { model = (Model.Members.UsersApprove)Session["USERAPPROVE"]; } ViewBag.UserID = CurrentUser.UserID; return(View(model)); } else { Session["USERAPPROVE"] = null; ViewBag.UserID = CurrentUser.UserID; model = new Model.Members.UsersApprove(); model.UserID = CurrentUser.UserID; return(View(model)); } }
public virtual ActionResult RedirectToLogon(AuthorizationContext filterContext) { if (filterContext == null || filterContext.HttpContext == null || filterContext.HttpContext.Request.IsAjaxRequest()) { return(new HttpStatusCodeResult(STATUSCODE_UNLOGON)); } string basePath = MvcApplication.GetCurrentRoutePath(filterContext.RouteData.DataTokens["area"]); if (filterContext.HttpContext.Request.Url != null) { return(new RedirectResult(string.Concat(basePath + "Account/Login?ReturnUrl=", filterContext.HttpContext.Server.UrlEncode( filterContext.HttpContext.Request.Url.PathAndQuery)) )); } return(new RedirectResult(string.Concat(basePath + "Account/Login"))); }
/// <summary> /// 提示给用户信息 /// </summary> /// <param name="status">支付结果</param> protected override void DisplayMessage(string status) { #region 设置提示信息 //DONE: 采用网关动态参数传递区域, 解决回跳区域问题 BEN ADD 20140114 //当前区域名称 AreaRoute area = this.GetwayDatas.Length > 1 ? YSWL.Common.Globals.SafeEnum(this.GetwayDatas[1], AreaRoute.None) : MvcApplication.MainAreaRoute; string basePath = MvcApplication.GetCurrentRoutePath(area); if (!string.IsNullOrWhiteSpace(this.OrderId)) { HttpContext.Current.Session[KEY_ORDERID] = this.OrderId; } HttpContext.Current.Session[KEY_STATUS] = status; #endregion switch (status) { case "success": //支付成功 #region 跳转到支付成功页面 HttpContext.Current.Response.Redirect(basePath + "PayResult/Success"); #endregion return; case "gatewaynotfound": //支付网关不存在 case "verifyfaild": //签名验证失败 case "fail": //支付失败 default: #region 跳转到支付失败页面 HttpContext.Current.Response.Redirect(basePath + "PayResult/Fail"); #endregion return; } }
public void OnException(ExceptionContext filterContext) { filterContext.Result = new RedirectResult(MvcApplication.GetCurrentRoutePath(filterContext.Controller) + "Error"); }
/// <summary> /// 验证请求是否合法 /// </summary> protected override bool VerifySendPayment(System.Web.HttpContext context) { #region 验证请求是否合法 string[] orderIds = YSWL.Payment.OrderProcessor.GetQueryString4OrderIds(context.Request); if (orderIds == null || orderIds.Length < 1) { return(false); } int orderId = YSWL.Common.Globals.SafeInt(orderIds[0], -1); if (orderId < -1) { return(false); } Model.Pay.Order orderInfo = _orderManage.GetModel(orderId); YSWL.Payment.Model.PaymentModeInfo paymentMode = YSWL.Payment.BLL.PaymentModeManage.GetPaymentModeById(orderInfo.PaymentTypeId); if (paymentMode == null) { Web.LogHelp.AddErrorLog(string.Format(MSG_ERRORLOG, orderId, -1), "非法操作订单", "Shop >> SendPaymentHandler >> Verification >> PaymentModeInfo Is NULL"); context.Response.Redirect("/"); return(false); } #endregion string basePath = "/"; string u = context.Request.ServerVariables["HTTP_USER_AGENT"]; string area = context.Request.QueryString["Area"]; if (!string.IsNullOrWhiteSpace(area)) { basePath = string.Format("/{0}/", area); } //向网关写入请求发起源的Area #pragma warning disable CS0612 // “SendPaymentHandlerBase<Order>.GatewayDatas”已过时 this.GatewayDatas.Add(area); #pragma warning restore CS0612 // “SendPaymentHandlerBase<Order>.GatewayDatas”已过时 #region 支付宝银联 if (paymentMode.Gateway == "alipaybank") { /** * 关于银行编码: * 如: 招商银行【CMB】、中国建设银行【CCB】、中国工商银行【ICBCB2C】 * 注意:优先使用B2C通道 * 混合渠道: https://doc.open.alipay.com/doc2/detail.htm?spm=0.0.0.0.Nz80L8&treeId=63&articleId=103763&docType=1 * 纯借记卡渠道: https://doc.open.alipay.com/doc2/detail.htm?spm=0.0.0.0.1NpxKf&treeId=63&articleId=103764&docType=1 **/ string bankCode = context.Request.QueryString["BankCode"]; if (!string.IsNullOrWhiteSpace(bankCode)) { //向网关写入用户选择的银行编码 #pragma warning disable CS0612 // “SendPaymentHandlerBase<Order>.GatewayDatas”已过时 this.GatewayDatas.Add(bankCode); #pragma warning restore CS0612 // “SendPaymentHandlerBase<Order>.GatewayDatas”已过时 } } #endregion //微信支付 向网关写入 APPID OPENID //if (paymentMode.Gateway.StartsWith("wechat")) //{ // string action = context.Request.QueryString["action"]; // //微信支付电脑端定向到 // if (action != "qr" && !u.ToLower().Contains("android") && !u.ToLower().Contains("mobile")) // { // context.Response.Redirect(MvcApplication.GetCurrentRoutePath(AreaRoute.Shop) + "PayWeChat/Pay/"+ orderId); // return false; // } // //微信支付app端定向 // if (string.IsNullOrWhiteSpace(action) && u.ToLower().Contains("ys56")) // { // context.Response.Redirect($"/pay/certification{orderId}/{area}?action=app"); // return false; // } // string weChatAppId = YSWL.WeChat.BLL.Core.Config.GetValueByCache("WeChat_AppId", -1, "AA"); // if (string.IsNullOrWhiteSpace(weChatAppId)) // { // context.Response.Clear(); // context.Response.Write("NO WECHAT_APPID > WECHAT APPID IS NULL!"); // return false; // } // this.GatewayDatas.Add(weChatAppId); // if (string.IsNullOrWhiteSpace(action) || action == "show") // { // #region 获取微信用户OpenId // //获取微信用户OpenId // string weChatOpenId = YSWL.WeChat.BLL.Core.Config.GetValueByCache("WeChat_OpenId", -1, "AA"); // string weChatAppSercet = YSWL.WeChat.BLL.Core.Config.GetValueByCache("WeChat_AppSercet", -1, "AA"); // if (string.IsNullOrWhiteSpace(weChatOpenId) || string.IsNullOrWhiteSpace(weChatAppSercet)) // { // context.Response.Clear(); // context.Response.Write("NO WECHATINFO > WECHAT WECHAT_OPENID OR WECHAT_APPSERCET IS NULL!"); // return false; // } // string authorizeCode = context.Request.QueryString["code"]; // if (string.IsNullOrWhiteSpace(authorizeCode)) // { // string authorizeUrl = // string.Format("https://open.weixin.qq.com/connect/oauth2/authorize?appid={0}&redirect_uri={1}&response_type=code&scope=snsapi_base&state={2}#wechat_redirect" // , weChatAppId, Common.Globals.UrlEncode(context.Request.Url.ToString()), "YS56BEN"); // context.Response.Redirect(authorizeUrl); // return false; // } // string userOpenId = YSWL.WeChat.BLL.Core.Utils.GetUserOpenId(weChatAppId, weChatAppSercet, authorizeCode); // if (string.IsNullOrWhiteSpace(userOpenId)) // { // context.Response.Clear(); // context.Response.Write("NO USEROPENID > WECHAT USEROPENID IS NULL!"); // return false; // } // this.GatewayDatas.Add(userOpenId); // #endregion // } //} if (u.ToLower().Contains("android") || u.ToLower().Contains("mobile")) //手机访问 { if (!paymentMode.DrivePath.Contains("|2|")) //不能手机支付 { context.Session[KEY_ORDERID] = orderInfo.OrderId.ToString(); context.Response.Redirect("/m/PayResult/MFail"); return(false); } } else//电脑访问 { if (!paymentMode.DrivePath.Contains("|1|")) //不能电脑支付 { context.Session[KEY_ORDERID] = orderInfo.OrderId.ToString(); context.Response.Redirect(MvcApplication.GetCurrentRoutePath(AreaRoute.Shop) + "PayResult/MFail"); return(false); } } return(true); }
protected override void OnActionExecuting(ActionExecutingContext filterContext) { #region 安装检测 if (!MvcApplication.IsInstall) { filterContext.Result = Redirect("/Installer/Default.aspx"); return; //未安装 终止 } #endregion string tagStr = Request.Params["tag"]; #region 设置企业标识 long enterpriseId = 0; if (MvcApplication.IsAutoConn) { #region 读取APP加密企业ID if (enterpriseId == 0) { //手机登录时候做处理 string userAgent = Request.UserAgent; string enterPriseValue = Request.Headers["YSWL_SAAS_EnterpriseID"]; string userValue = Request.Headers["YSWL_SAAS_UserName"]; if (!string.IsNullOrEmpty(userAgent) && userAgent.Contains("ys56") && !string.IsNullOrEmpty(enterPriseValue) && !string.IsNullOrEmpty(userValue)) { enterpriseId = Common.DEncrypt.DEncrypt.ConvertToNumber(enterPriseValue); } } #endregion //优先处理传值过来的 if (!string.IsNullOrWhiteSpace(tagStr)) { enterpriseId = Common.DEncrypt.DEncrypt.ConvertToNumber(tagStr); } if (enterpriseId == 0) { Session.Timeout = 60; enterpriseId = Globals.SafeLong(Session["YSWL_Auto_EnterpriseID"], 0);//保存在session里面 } //Shop域名 if (enterpriseId == 0 && MvcApplication.ProductInfo.Contains("Mall")) { string host = string.Empty; if (filterContext.HttpContext.Request.Url != null) { host = filterContext.HttpContext.Request.Url.Host.ToLower(); } } if (enterpriseId == 0) { //获取cookie中的企业标识 string tag = Common.Cookies.getKeyCookie("YSWL_SAAS_EnterpriseID"); if (!String.IsNullOrWhiteSpace(tag) && Common.DEncrypt.DEncrypt.ConvertToNumber(tag) > 0) { enterpriseId = Common.DEncrypt.DEncrypt.ConvertToNumber(tag); } } if (enterpriseId < 1 && MvcApplication.ProductInfo.Contains("Mall")) { //域名未登记, 返回404 filterContext.Result = new HttpNotFoundResult(); FileManage.WriteText(new System.Text.StringBuilder(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:fff") + " filterContext.HttpContext.Request.Url.Host:" + filterContext.HttpContext.Request.Url.Host)); // FileManage.WriteText(new System.Text.StringBuilder("filterContext.HttpContext.Request.ServerVariables['HTTP_HOST']:" + filterContext.HttpContext.Request.ServerVariables["HTTP_HOST"])); return; } if (enterpriseId > 0) { Common.CallContextHelper.SetAutoTag(enterpriseId); Session["YSWL_Auto_EnterpriseID"] = enterpriseId; } else { string returnUrl = Common.ConfigHelper.GetConfigString("SAASLoginUrl"); filterContext.Result = Redirect(returnUrl); return; //没有企业信息 跳转到SAAS登陆页面 } } #region 个性域名检测 //SaaS域名 if (enterpriseId == 0 && MvcApplication.ProductInfo.Contains("SAAS")) { string host = string.Empty; if (filterContext.HttpContext.Request.Url != null) { host = filterContext.HttpContext.Request.Url.Host.ToLower(); } //启用个性域名访问 int entId = 0;//SAASInfo.GetSAASEnterpriseIdByDomain(host); //FileManage.WriteText(new System.Text.StringBuilder(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:fff") + host + " entId:" + entId)); if (entId < 0) { //域名未登记, 返回404 filterContext.Result = new HttpNotFoundResult(); FileManage.WriteText(new System.Text.StringBuilder(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:fff") + " filterContext.HttpContext.Request.Url.Host:" + filterContext.HttpContext.Request.Url.Host)); // FileManage.WriteText(new System.Text.StringBuilder("filterContext.HttpContext.Request.ServerVariables['HTTP_HOST']:" + filterContext.HttpContext.Request.ServerVariables["HTTP_HOST"])); return; } if (entId > 0) { Common.CallContextHelper.SetAutoTag(entId); Session["YSWL_Auto_EnterpriseID"] = entId; } } #endregion #endregion #region 动态获取当前区域的基础路径 ViewBag.CurrentArea = CurrentArea = MvcApplication.GetCurrentAreaRoute( filterContext.RouteData.DataTokens["area"]); ViewBag.BasePath = MvcApplication.GetCurrentRoutePath(CurrentArea); #endregion #region 静态站域名 ViewBag.CurrentArea = CurrentArea = MvcApplication.GetCurrentAreaRoute( filterContext.RouteData.DataTokens["area"]); ViewBag.BasePath = MvcApplication.GetCurrentRoutePath(CurrentArea); ViewBag.StaticHost = MvcApplication.StaticHost; #endregion #region 获取网站公共设置数据 CurrentThemeName = MvcApplication.GetCurrentThemeName(CurrentArea); //DONE: 更正为动态区域, 模版使用主区域Check是否存在 BEN Modify 2013-05-17 CurrentThemeName = System.IO.Directory.Exists( filterContext.HttpContext.Server.MapPath( "/Areas/" + MvcApplication.MainAreaRoute + "/Themes/" + CurrentThemeName)) ? CurrentThemeName : "Default"; CurrentThemeViewPath = MvcApplication.GetCurrentViewPath(CurrentArea); //TODO: 应更正为一个值去处理 TO: 涂 BEN ADD 2013-05-17 if (CurrentThemeName == "TufenXiang") { IncludeProduct = false; UserAlbumDetailType = 0; } ViewBag.SiteName = MvcApplication.SiteName; #endregion ViewBag.CurrentUserId = -1; #if isFirstProgram //加载已登录用户对象和Style数据, 由子类实现 if (!InitializeComponent(filterContext)) { return; } #else if (InitializeComponent(requestContext.HttpContext)) { base.Initialize(requestContext); } #endif //SingleLogin slogin = new SingleLogin(); //if (slogin.ValidateForceLogin()) //{ // requestContext.HttpContext.Response.Write("<script defer>window.alert('" + Resources.Site.TooltipForceLogin + "');parent.location='" + DefaultLogin + "';</script>"); //} Actions bllAction = new Actions(); ActHashtab = bllAction.GetHashListByCache(); if (ActHashtab != null && UserPrincipal != null) { if (!UserPrincipal.HasPermissionID(GetPermidByActID(Act_DeleteList))) { ViewBag.DeleteAuthority = true; } } base.OnActionExecuting(filterContext); }