diff --git a/DncZeus.Api/Controllers/AccountController.cs b/DncZeus.Api/Controllers/AccountController.cs index 28148f3..edf904c 100644 --- a/DncZeus.Api/Controllers/AccountController.cs +++ b/DncZeus.Api/Controllers/AccountController.cs @@ -150,30 +150,31 @@ public static class MenuItemHelper public static List BuildTree(this List menus, string selectedGuid = null) { var lookup = menus.ToLookup(x => x.ParentId); - Func> build = null; - build = pid => + + List Build(string pid) { return lookup[pid] - .Select(x => new MenuItem() - { - Guid = x.Guid, - ParentId = x.ParentId, - Children = build(x.Guid), - Component = x.Component ?? "Main", - Name = x.Name, - Path = x.Path, - Meta = new MenuMeta - { - BeforeCloseFun = x.Meta.BeforeCloseFun, - HideInMenu = x.Meta.HideInMenu, - Icon = x.Meta.Icon, - NotCache = x.Meta.NotCache, - Title = x.Meta.Title, - Permission = x.Meta.Permission - } - }).ToList(); - }; - var result = build(selectedGuid); + .Select(x => new MenuItem() + { + Guid = x.Guid, + ParentId = x.ParentId, + Children = Build(x.Guid), + Component = x.Component ?? "Main", + Name = x.Name, + Path = x.Path, + Meta = new MenuMeta + { + BeforeCloseFun = x.Meta.BeforeCloseFun, + HideInMenu = x.Meta.HideInMenu, + Icon = x.Meta.Icon, + NotCache = x.Meta.NotCache, + Title = x.Meta.Title, + Permission = x.Meta.Permission + } + }).ToList(); + } + + var result = Build(selectedGuid); return result; }