From b29b6be734be1ea76d9b0fbdb85b50ff68aecaad Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=A9=99=E5=AD=90?= <454313500@qq.com>
Date: Tue, 26 Oct 2021 00:59:06 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Controllers/AccountController.cs | 4 +-
.../Controllers/MenuController.cs | 1 +
.../Controllers/MouldController.cs | 4 +-
.../Controllers/RoleController.cs | 4 +-
.../Controllers/UserController.cs | 3 +-
.../Yi.Framework.Service/MenuService.cs | 46 ++++++++++++++++---
.../Yi.Framework.Service/MouldService.cs | 8 +++-
.../Yi.Framework.Service/RoleService.cs | 26 ++++++++---
.../Yi.Framework.Service/UserService.cs | 2 +-
Yi.Vue/src/components/ccTreeview.vue | 2 +-
10 files changed, 80 insertions(+), 20 deletions(-)
diff --git a/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/AccountController.cs b/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/AccountController.cs
index d00fab63..81d19655 100644
--- a/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/AccountController.cs
+++ b/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/AccountController.cs
@@ -1,4 +1,5 @@
-using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
@@ -109,6 +110,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers
///
///
[HttpPut]
+ [Authorize]
public async Task ChangePassword(ChangePwdDto pwdDto)
{
var uid= pwdDto.user.id;
diff --git a/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/MenuController.cs b/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/MenuController.cs
index c846a8cf..bbacced2 100644
--- a/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/MenuController.cs
+++ b/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/MenuController.cs
@@ -14,6 +14,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers
{
[Route("api/[controller]/[action]")]
[ApiController]
+ [Authorize]
public class MenuController : ControllerBase
{
private IMenuService _menuService;
diff --git a/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/MouldController.cs b/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/MouldController.cs
index 46c17211..7c0ee94a 100644
--- a/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/MouldController.cs
+++ b/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/MouldController.cs
@@ -1,4 +1,5 @@
-using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
@@ -12,6 +13,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers
{
[Route("api/[controller]/[action]")]
[ApiController]
+ [Authorize]
public class MouldController : ControllerBase
{
private IMouldService _mouldService;
diff --git a/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/RoleController.cs b/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/RoleController.cs
index ecd5cceb..d912f097 100644
--- a/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/RoleController.cs
+++ b/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/RoleController.cs
@@ -1,4 +1,5 @@
-using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
@@ -13,6 +14,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers
{
[Route("api/[controller]/[action]")]
[ApiController]
+ [Authorize]
public class RoleController : ControllerBase
{
private IRoleService _roleService;
diff --git a/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/UserController.cs b/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/UserController.cs
index 1e896694..383151cf 100644
--- a/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/UserController.cs
+++ b/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/UserController.cs
@@ -15,6 +15,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers
{
[ApiController]
[Route("api/[controller]/[action]")]
+ [Authorize]
public class UserController : ControllerBase
{
private readonly ILogger _logger;
@@ -122,7 +123,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers
/// 根据http上下文的用户得到该用户信息,关联角色
///
///
- [Authorize]
+
[HttpGet]
public async Task GetUserInfoById()
{
diff --git a/Yi.Framework/Yi.Framework.Service/MenuService.cs b/Yi.Framework/Yi.Framework.Service/MenuService.cs
index eb0572ed..7b128389 100644
--- a/Yi.Framework/Yi.Framework.Service/MenuService.cs
+++ b/Yi.Framework/Yi.Framework.Service/MenuService.cs
@@ -20,6 +20,11 @@ namespace Yi.Framework.Service
return menu_data;
}
+ ///
+ /// 这个getEntity没有关联子类,怎么能得到子类呢?这是一个错误的接口
+ ///
+ ///
+ ///
public async Task> GetChildrenByMenu(menu _menu)
{
var menu_data = await GetEntity(u=>u.id==_menu.id&& u.is_delete == (short)Common.Enum.DelFlagEnum.Normal);
@@ -27,10 +32,15 @@ namespace Yi.Framework.Service
return childrenList;
}
+ ///
+ /// 不要返回一个新创的变量,直接返回menu.children,只要id,就不要传一个对象
+ ///
+ ///
+ ///
public async Task> GetChildrenMenu(menu _menu)
{
var menu= await _Db.Set