diff --git a/Bootstrap.Admin/Controllers/Api/InterfaceController.cs b/Bootstrap.Admin/Controllers/Api/InterfaceController.cs index e986a291..d7f18dad 100644 --- a/Bootstrap.Admin/Controllers/Api/InterfaceController.cs +++ b/Bootstrap.Admin/Controllers/Api/InterfaceController.cs @@ -54,18 +54,9 @@ namespace Bootstrap.Admin.Controllers /// /// [HttpPost] - public IEnumerable RetrieveAppMenus([FromBody]AppMenuArgs args) + public IEnumerable RetrieveAppMenus([FromBody]AppMenuOption args) { - return MenuHelper.RetrieveAppMenus(args.Name, args.Url); - } - /// - /// - /// - public class AppMenuArgs - { - public string Name { get; set; } - - public string Url { get; set; } + return MenuHelper.RetrieveAppMenus(args.AppId, args.UserName, args.Url); } } } diff --git a/Bootstrap.Client.DataAccess/MenuHelper.cs b/Bootstrap.Client.DataAccess/MenuHelper.cs index f12b3ed4..690a82e5 100644 --- a/Bootstrap.Client.DataAccess/MenuHelper.cs +++ b/Bootstrap.Client.DataAccess/MenuHelper.cs @@ -1,4 +1,5 @@ using Bootstrap.Security; +using Longbow.Configuration; using System.Collections.Generic; namespace Bootstrap.Client.DataAccess @@ -11,9 +12,9 @@ namespace Bootstrap.Client.DataAccess /// /// /// - /// + /// /// /// - public static IEnumerable RetrieveAppMenus(string name, string url) => BAHelper.RetrieveAppMenus(new { Name = name, Url = url }); + public static IEnumerable RetrieveAppMenus(string userName, string url) => BAHelper.RetrieveAppMenus(ConfigurationManager.AppSettings["AppId"], userName, url); } } diff --git a/Bootstrap.DataAccess/Helper/MenuHelper.cs b/Bootstrap.DataAccess/Helper/MenuHelper.cs index 5ecf07c8..3db2e986 100644 --- a/Bootstrap.DataAccess/Helper/MenuHelper.cs +++ b/Bootstrap.DataAccess/Helper/MenuHelper.cs @@ -46,7 +46,7 @@ namespace Bootstrap.DataAccess /// /// /// - public static IEnumerable RetrieveAppMenus(string name, string url) => DbAdapterManager.Create().RetrieveAppMenus(name, url); + public static IEnumerable RetrieveAppMenus(string appId, string userName, string url) => DbAdapterManager.Create().RetrieveAppMenus(appId, userName, url); /// /// /// diff --git a/Bootstrap.DataAccess/Menu.cs b/Bootstrap.DataAccess/Menu.cs index 6010349f..d049b1ac 100644 --- a/Bootstrap.DataAccess/Menu.cs +++ b/Bootstrap.DataAccess/Menu.cs @@ -1,7 +1,6 @@ using Bootstrap.Security; using Longbow; using Longbow.Cache; -using Longbow.Configuration; using Longbow.Data; using System; using System.Collections.Generic; @@ -161,13 +160,13 @@ namespace Bootstrap.DataAccess /// /// 通过当前用户名获得前台菜单,层次化后集合 /// + /// /// 当前登陆的用户名 /// 当前访问菜单 - /// 连接字符串名称,默认为ba /// - public virtual IEnumerable RetrieveAppMenus(string userName, string activeUrl = null) + public virtual IEnumerable RetrieveAppMenus(string appId, string userName, string activeUrl = null) { - var menus = RetrieveMenusByUserName(userName, activeUrl).Where(m => m.Category == "1" && m.IsResource == 0); + var menus = RetrieveMenusByUserName(userName, activeUrl, appId).Where(m => m.Category == "1" && m.IsResource == 0); var root = menus.Where(m => m.ParentId == 0).OrderBy(m => m.ApplicationCode).ThenBy(m => m.Order); CascadeMenus(menus, root); return root; @@ -177,11 +176,10 @@ namespace Bootstrap.DataAccess /// /// 当前登陆的用户名 /// 当前访问菜单 + /// /// - public virtual IEnumerable RetrieveMenusByUserName(string userName, string activeUrl = null) + public virtual IEnumerable RetrieveMenusByUserName(string userName, string activeUrl = null, string appId = "0") { - // TODO: 考虑第三方应用获取 - var appId = LgbConvert.ReadValue(ConfigurationManager.AppSettings["AppId"], "0"); var key = string.Format("{0}-{1}-{2}", RetrieveMenusDataKey, userName, appId); var navs = CacheManager.GetOrAdd(key, k => {