修改BUG:MenuHelper方法RetrieveAppMenus增加AppId条件
This commit is contained in:
parent
11d4a13dfe
commit
5c23d69f54
|
@ -54,18 +54,9 @@ namespace Bootstrap.Admin.Controllers
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public IEnumerable<BootstrapMenu> RetrieveAppMenus([FromBody]AppMenuArgs args)
|
public IEnumerable<BootstrapMenu> RetrieveAppMenus([FromBody]AppMenuOption args)
|
||||||
{
|
{
|
||||||
return MenuHelper.RetrieveAppMenus(args.Name, args.Url);
|
return MenuHelper.RetrieveAppMenus(args.AppId, args.UserName, args.Url);
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public class AppMenuArgs
|
|
||||||
{
|
|
||||||
public string Name { get; set; }
|
|
||||||
|
|
||||||
public string Url { get; set; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using Bootstrap.Security;
|
using Bootstrap.Security;
|
||||||
|
using Longbow.Configuration;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Bootstrap.Client.DataAccess
|
namespace Bootstrap.Client.DataAccess
|
||||||
|
@ -11,9 +12,9 @@ namespace Bootstrap.Client.DataAccess
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="name"></param>
|
/// <param name="userName"></param>
|
||||||
/// <param name="url"></param>
|
/// <param name="url"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static IEnumerable<BootstrapMenu> RetrieveAppMenus(string name, string url) => BAHelper.RetrieveAppMenus(new { Name = name, Url = url });
|
public static IEnumerable<BootstrapMenu> RetrieveAppMenus(string userName, string url) => BAHelper.RetrieveAppMenus(ConfigurationManager.AppSettings["AppId"], userName, url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ namespace Bootstrap.DataAccess
|
||||||
/// <param name="name"></param>
|
/// <param name="name"></param>
|
||||||
/// <param name="url"></param>
|
/// <param name="url"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static IEnumerable<BootstrapMenu> RetrieveAppMenus(string name, string url) => DbAdapterManager.Create<Menu>().RetrieveAppMenus(name, url);
|
public static IEnumerable<BootstrapMenu> RetrieveAppMenus(string appId, string userName, string url) => DbAdapterManager.Create<Menu>().RetrieveAppMenus(appId, userName, url);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
using Bootstrap.Security;
|
using Bootstrap.Security;
|
||||||
using Longbow;
|
using Longbow;
|
||||||
using Longbow.Cache;
|
using Longbow.Cache;
|
||||||
using Longbow.Configuration;
|
|
||||||
using Longbow.Data;
|
using Longbow.Data;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
@ -161,13 +160,13 @@ namespace Bootstrap.DataAccess
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 通过当前用户名获得前台菜单,层次化后集合
|
/// 通过当前用户名获得前台菜单,层次化后集合
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="appId"></param>
|
||||||
/// <param name="userName">当前登陆的用户名</param>
|
/// <param name="userName">当前登陆的用户名</param>
|
||||||
/// <param name="activeUrl">当前访问菜单</param>
|
/// <param name="activeUrl">当前访问菜单</param>
|
||||||
/// <param name="connName">连接字符串名称,默认为ba</param>
|
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public virtual IEnumerable<BootstrapMenu> RetrieveAppMenus(string userName, string activeUrl = null)
|
public virtual IEnumerable<BootstrapMenu> 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);
|
var root = menus.Where(m => m.ParentId == 0).OrderBy(m => m.ApplicationCode).ThenBy(m => m.Order);
|
||||||
CascadeMenus(menus, root);
|
CascadeMenus(menus, root);
|
||||||
return root;
|
return root;
|
||||||
|
@ -177,11 +176,10 @@ namespace Bootstrap.DataAccess
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="userName">当前登陆的用户名</param>
|
/// <param name="userName">当前登陆的用户名</param>
|
||||||
/// <param name="activeUrl">当前访问菜单</param>
|
/// <param name="activeUrl">当前访问菜单</param>
|
||||||
|
/// <param name="appId"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public virtual IEnumerable<BootstrapMenu> RetrieveMenusByUserName(string userName, string activeUrl = null)
|
public virtual IEnumerable<BootstrapMenu> 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 key = string.Format("{0}-{1}-{2}", RetrieveMenusDataKey, userName, appId);
|
||||||
var navs = CacheManager.GetOrAdd(key, k =>
|
var navs = CacheManager.GetOrAdd(key, k =>
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue