public object Post(ForeVerify request) { ForeVerifyResponse rsp = new ForeVerifyResponse(); _deptStaffService.Verify(request, rsp); return(rsp); }
public override void OnActionExecuting(ActionExecutingContext filterContext) { if (filterContext.HttpContext.Session["StaffNo"] == null) { string strIp = ConfigurationManager.AppSettings["LoginIP"]; if (filterContext.HttpContext.Request.Cookies["strIp"] != null) { strIp = filterContext.HttpContext.Request.Cookies["strIp"].Value; } string script = "window.top.location.href= '/';"; filterContext.HttpContext.Response.Write("<script language=\"javascript\">" + script + "</script>"); return; } if (filterContext.HttpContext.Request.Url != null) { string url = filterContext.HttpContext.Request.Url.AbsolutePath.Substring(1).ToLower(); if (url != "") { ForeVerify request = new ForeVerify() { StaffNo = filterContext.HttpContext.Session["StaffNo"].ToString(), DepartNo = filterContext.HttpContext.Session["DepartNo"].ToString(), Url = url }; ForeVerifyResponse response = WeChatHelper.PostService <ForeVerify, ForeVerifyResponse>("ForeVerify", request); if (response.ResponseStatus.ErrorCode != "OK") { filterContext.Result = new ContentResult { Content = "权限错误" }; } } } }
public void Verify(ForeVerify request, ForeVerifyResponse response) { //验证员工页面权限 response.ResponseStatus.ErrorCode = _deptStaffManager.RolePowerRepository.Verify(request.StaffNo, request.Url.ToUpper()) ? "OK" : "Error"; }