This commit is contained in:
橙子
2021-10-17 18:38:58 +08:00
23 changed files with 343 additions and 18 deletions

View File

@@ -26,7 +26,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers
[HttpGet]
public async Task<Result> GetMenu()
{
return Result.Success().SetData(await _menuService.GetMenuMouldByMenu( new menu()));
return Result.Success().SetData(await _menuService.GetTopMenu());
}
/// <summary>
@@ -62,6 +62,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers
[HttpPost]
public async Task<Result> AddMenu(menu _menu)
{
_menu.is_top = (short)Common.Enum.TopFlagEnum.Top;
await _menuService.AddAsync(_menu);
return Result.Success();
}
@@ -91,6 +92,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers
var _user = this.HttpContext.GetCurrentUserInfo();
var menuList= await _userService.GetMenusByUser(_user);
return Result.Success().SetData(menuList);
}
/// <summary>
@@ -104,7 +106,24 @@ namespace Yi.Framework.ApiMicroservice.Controllers
var _children= await _menuService.AddChildrenMenu(new menu() { id=childrenDto.parentId}, childrenDto.data);
return Result.Success();
}
/// <summary>
/// 获取用户的目录菜单,不包含接口
/// </summary>
/// <returns></returns>
[HttpGet]
public async Task<Result> GeTopMenuByUser()
{
var _user = this.HttpContext.GetCurrentUserInfo();
var menuList =await _userService.GetMenuByUser(_user);
return Result.Success().SetData(menuList);
}
public async Task<Result> GeTopMenuByUser(menu _menu)
{
var _user = this.HttpContext.GetCurrentUserInfo();
var menu_data= await _userService.GetMenuByUser(_user);
var menuList = await _menuService.GetChildrenMenu(_menu);
return Result.Success().SetData(menuList);
}
}
}