public ActionResult Index() { List <AuthMenuModel> menuItemList = AuthMgr.GetUserMenuList(); var topLevelMenuList = menuItemList.Where(item => !menuItemList.Exists(tm => tm.SysNo == item.ParentSysNo) && item.IsDisplay == "1").ToList(); foreach (var mItemL1 in topLevelMenuList) { if (!string.IsNullOrWhiteSpace(mItemL1.LinkPath)) { return(Redirect(mItemL1.LinkPath)); } List <AuthMenuModel> mItemL2List = menuItemList.FindAll(x => x.ParentSysNo == mItemL1.SysNo && x.IsDisplay == "1"); if (mItemL2List.Count == 0 && string.IsNullOrWhiteSpace(mItemL1.LinkPath)) { continue; } AuthMenuModel menu = mItemL2List.FirstOrDefault(f => f.IsDisplay == "1" && !string.IsNullOrWhiteSpace(f.LinkPath)); if (menu != null) { return(Redirect(menu.LinkPath)); } } return(Content("")); /*经测试以下语句无效 * if (CurrUser.MasterSysNo.GetValueOrDefault() > 0) * { * * return Redirect(Url.Action("MapIndex", "Home")); * } * else * { * return Redirect(Url.Action("Index", "Company")); * } */ }