From 7fe07b104c788ca6ee2b0c3a048bd3275c9586cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=8D=E5=81=9A=E7=A0=81=E5=86=9C?= <599854767@qq.com> Date: Sun, 6 Mar 2022 14:26:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=87=E7=BA=A7=E5=88=B0net6.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Infrastructure/Helper/FileUtil.cs | 2 +- Infrastructure/Infrastructure.csproj | 6 +- Infrastructure/InternalApp.cs | 6 +- README.md | 6 +- ZR.Admin.WebApi/.config/dotnet-tools.json | 2 +- ZR.Admin.WebApi/Controllers/BaseController.cs | 2 +- .../System/CodeGeneratorController.cs | 10 +- .../Controllers/System/SysConfigController.cs | 1 + .../System/SysDictDataController.cs | 5 - .../System/SysDictTypeController.cs | 2 - .../Controllers/System/SysNoticeController.cs | 19 +- .../Controllers/System/TasksController.cs | 2 +- .../System/monitor/SysLogininforController.cs | 1 - .../System/monitor/SysOperlogController.cs | 7 - ZR.Admin.WebApi/Dockerfile | 19 -- ZR.Admin.WebApi/Extensions/EntityExtension.cs | 8 +- .../Extensions/HttpContextExtension.cs | 8 +- .../Extensions/SwaggerExtension.cs | 8 +- .../Filters/ActionPermissionFilter.cs | 5 - .../Filters/GlobalActionMonitor.cs | 12 +- ZR.Admin.WebApi/Framework/CookieUtil.cs | 17 -- ZR.Admin.WebApi/Framework/JwtUtil.cs | 12 +- ZR.Admin.WebApi/Hubs/MessageHub.cs | 9 +- ZR.Admin.WebApi/Hubs/OnlineUsers.cs | 4 +- .../Middleware/GlobalExceptionMiddleware.cs | 9 +- .../Middleware/RequestIPMiddleware.cs | 2 +- ZR.Admin.WebApi/Program.cs | 145 +++++++++++++--- .../PublishProfiles/FolderProfile.pubxml | 16 +- .../Properties/launchSettings.json | 25 ++- ZR.Admin.WebApi/Startup.cs | 163 ------------------ ZR.Admin.WebApi/ZR.Admin.WebApi.csproj | 112 +++++------- ZR.Admin.WebApi/build.bat | 8 - ZR.CodeGenerator/ZR.CodeGenerator.csproj | 2 +- ZR.Common/ZR.Common.csproj | 4 +- ZR.Model/System/Dto/SysConfigDto.cs | 4 +- ZR.Model/System/Dto/SysNoticeDto.cs | 5 +- ZR.Model/System/SysNotice.cs | 5 +- ZR.Model/System/Vo/TreeSelectVo.cs | 2 +- ZR.Repository/System/SysNoticeRepository.cs | 1 + ZR.Repository/ZR.Repository.csproj | 3 +- ZR.Service/System/IService/ISysDeptService.cs | 2 +- ZR.Service/System/IService/ISysMenuService.cs | 1 - .../System/IService/ISysNoticeService.cs | 2 +- ZR.Service/System/SysDeptService.cs | 2 +- ZR.Service/System/SysFileService.cs | 2 +- ZR.Service/System/SysMenuService.cs | 1 - ZR.Service/System/SysNoticeService.cs | 1 + ZR.Service/ZR.Service.csproj | 2 +- ZR.Tasks/ZR.Tasks.csproj | 5 +- ZRAdmin.sln | 104 +++++------ 50 files changed, 306 insertions(+), 495 deletions(-) delete mode 100644 ZR.Admin.WebApi/Dockerfile delete mode 100644 ZR.Admin.WebApi/Framework/CookieUtil.cs delete mode 100644 ZR.Admin.WebApi/Startup.cs delete mode 100644 ZR.Admin.WebApi/build.bat diff --git a/Infrastructure/Helper/FileUtil.cs b/Infrastructure/Helper/FileUtil.cs index d9bbb0a..44e4e77 100644 --- a/Infrastructure/Helper/FileUtil.cs +++ b/Infrastructure/Helper/FileUtil.cs @@ -41,7 +41,7 @@ namespace Infrastructure { str = Guid.NewGuid().ToString(); } - MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider(); + MD5 md5 = MD5.Create(); return BitConverter.ToString(md5.ComputeHash(Encoding.Default.GetBytes(str)), 4, 8).Replace("-", ""); } } diff --git a/Infrastructure/Infrastructure.csproj b/Infrastructure/Infrastructure.csproj index c696460..a577cb4 100644 --- a/Infrastructure/Infrastructure.csproj +++ b/Infrastructure/Infrastructure.csproj @@ -1,7 +1,7 @@ - + - net5.0 + net6.0 @@ -11,7 +11,7 @@ - + diff --git a/Infrastructure/InternalApp.cs b/Infrastructure/InternalApp.cs index 302f855..f0d116e 100644 --- a/Infrastructure/InternalApp.cs +++ b/Infrastructure/InternalApp.cs @@ -9,12 +9,12 @@ namespace Infrastructure /// /// 应用服务 /// - internal static IServiceCollection InternalServices; + public static IServiceCollection InternalServices; /// /// 全局配置构建器 /// - internal static IConfigurationBuilder ConfigurationBuilder; + public static IConfigurationBuilder ConfigurationBuilder; /// /// 获取Web主机环境 @@ -24,6 +24,6 @@ namespace Infrastructure /// /// 获取泛型主机环境 /// - internal static IHostEnvironment HostEnvironment; + public static IHostEnvironment HostEnvironment; } } diff --git a/README.md b/README.md index 38b8388..409bedf 100644 --- a/README.md +++ b/README.md @@ -2,10 +2,10 @@ ## 🍟概述 * 本项目适合有一定NetCore和 vue基础的开发人员 -* 基于.NET 5实现的通用权限管理平台(RBAC模式)。整合最新技术高效快速开发,前后端分离模式,开箱即用。 +* 基于.NET5/.NET6实现的通用权限管理平台(RBAC模式)。整合最新技术高效快速开发,前后端分离模式,开箱即用。 * 代码量少、学习简单、通俗易懂、功能强大、易扩展、轻量级,让web开发更快速、简单高效(从此告别996),解决70%的重复工作,专注您的业务,轻松开发从现在开始! * 前端采用Vue2.0、Element UI。 -* 后端采用Net5、Sqlsugar、MySQL。 +* 后端采用Net5/Net6、Sqlsugar、MySQL。 * 权限认证使用Jwt,支持多终端认证系统。 * 支持加载动态权限菜单,多方式轻松权限控制 * 七牛云通用云产品优惠券:[点我进入](https://s.qiniu.com/FzEfay)。 @@ -29,7 +29,7 @@ Vue版前端技术栈 :基于vue、vuex、vue-router 、vue-cli 、axios 和 element-ui,前端采用vscode工具开发 ## 🍀后端技术 -核心框架:.Net5.0 + Web API + sqlsugar + swagger + signalR +核心框架:.Net5.0/.Net6 + Web API + sqlsugar + swagger + signalR 定时计划任务:Quartz.Net组件 diff --git a/ZR.Admin.WebApi/.config/dotnet-tools.json b/ZR.Admin.WebApi/.config/dotnet-tools.json index c735fef..82e7e22 100644 --- a/ZR.Admin.WebApi/.config/dotnet-tools.json +++ b/ZR.Admin.WebApi/.config/dotnet-tools.json @@ -3,7 +3,7 @@ "isRoot": true, "tools": { "dotnet-ef": { - "version": "5.0.0", + "version": "6.0.2", "commands": [ "dotnet-ef" ] diff --git a/ZR.Admin.WebApi/Controllers/BaseController.cs b/ZR.Admin.WebApi/Controllers/BaseController.cs index 43e2710..db2d24d 100644 --- a/ZR.Admin.WebApi/Controllers/BaseController.cs +++ b/ZR.Admin.WebApi/Controllers/BaseController.cs @@ -75,7 +75,7 @@ namespace ZR.Admin.WebApi.Controllers /// /// /// - protected ApiResult GetApiResult(ResultCode resultCode, object data = null) + protected ApiResult GetApiResult(ResultCode resultCode, object? data = null) { var apiResult = new ApiResult((int)resultCode, resultCode.ToString()) { diff --git a/ZR.Admin.WebApi/Controllers/System/CodeGeneratorController.cs b/ZR.Admin.WebApi/Controllers/System/CodeGeneratorController.cs index 09d397e..ced2b1f 100644 --- a/ZR.Admin.WebApi/Controllers/System/CodeGeneratorController.cs +++ b/ZR.Admin.WebApi/Controllers/System/CodeGeneratorController.cs @@ -67,7 +67,7 @@ namespace ZR.Admin.WebApi.Controllers /// [HttpGet("getTableList")] [ActionPermissionFilter(Permission = "tool:gen:list")] - public IActionResult FindListTable(string dbName, string tableName, PagerInfo pager) + public IActionResult FindListTable(string dbName, string? tableName, PagerInfo pager) { List list = _CodeGeneraterService.GetAllTables(dbName, tableName, pager); var page = new PagedInfo @@ -89,7 +89,7 @@ namespace ZR.Admin.WebApi.Controllers /// [HttpGet("list")] [ActionPermissionFilter(Permission = "tool:gen:list")] - public IActionResult GetGenTable(string tableName, PagerInfo pagerInfo) + public IActionResult GetGenTable(string? tableName, PagerInfo pagerInfo) { //查询原表数据,部分字段映射到代码生成表字段 var rows = GenTableService.GetGenTables(new GenTable() { TableName = tableName }, pagerInfo); @@ -160,7 +160,7 @@ namespace ZR.Admin.WebApi.Controllers throw new CustomException("表不能为空"); } string[] tableNames = tables.Split(',', StringSplitOptions.RemoveEmptyEntries); - string userName = User.Identity.Name; + var userName = HttpContext.GetName(); foreach (var tableName in tableNames) { @@ -269,9 +269,9 @@ namespace ZR.Admin.WebApi.Controllers if (genTableInfo.GenType == "1") { string tempPath = WebHostEnvironment.ContentRootPath; - + var parentPath = Directory.GetParent(tempPath)?.Parent?.FullName; //代码生成文件夹路径 - dto.GenCodePath = genTableInfo.GenPath.IsEmpty() ? Directory.GetParent(tempPath).FullName : genTableInfo.GenPath; + dto.GenCodePath = genTableInfo.GenPath.IsEmpty() ? parentPath : genTableInfo.GenPath; } else { diff --git a/ZR.Admin.WebApi/Controllers/System/SysConfigController.cs b/ZR.Admin.WebApi/Controllers/System/SysConfigController.cs index 5e47b9d..580b467 100644 --- a/ZR.Admin.WebApi/Controllers/System/SysConfigController.cs +++ b/ZR.Admin.WebApi/Controllers/System/SysConfigController.cs @@ -16,6 +16,7 @@ using ZR.Service.System; using ZR.Model.System; using Infrastructure.Extensions; using Microsoft.AspNetCore.Authorization; +using ZR.Model.System.Dto; namespace ZR.Admin.WebApi.Controllers { diff --git a/ZR.Admin.WebApi/Controllers/System/SysDictDataController.cs b/ZR.Admin.WebApi/Controllers/System/SysDictDataController.cs index 9ec9fd1..60e69a8 100644 --- a/ZR.Admin.WebApi/Controllers/System/SysDictDataController.cs +++ b/ZR.Admin.WebApi/Controllers/System/SysDictDataController.cs @@ -2,15 +2,10 @@ using Infrastructure.Enums; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; -using System; -using System.Collections.Generic; -using System.Linq; using ZR.Admin.WebApi.Filters; -using ZR.Common; using ZR.Model; using ZR.Model.System; using ZR.Model.System.Dto; -using ZR.Model.Vo; using ZR.Service.System.IService; namespace ZR.Admin.WebApi.Controllers.System diff --git a/ZR.Admin.WebApi/Controllers/System/SysDictTypeController.cs b/ZR.Admin.WebApi/Controllers/System/SysDictTypeController.cs index f3b3ecc..01189f4 100644 --- a/ZR.Admin.WebApi/Controllers/System/SysDictTypeController.cs +++ b/ZR.Admin.WebApi/Controllers/System/SysDictTypeController.cs @@ -2,13 +2,11 @@ using Infrastructure.Enums; using Infrastructure.Model; using Microsoft.AspNetCore.Mvc; -using System; using ZR.Admin.WebApi.Extensions; using ZR.Admin.WebApi.Filters; using ZR.Common; using ZR.Model; using ZR.Model.System; -using ZR.Model.Vo; using ZR.Service.System.IService; namespace ZR.Admin.WebApi.Controllers.System diff --git a/ZR.Admin.WebApi/Controllers/System/SysNoticeController.cs b/ZR.Admin.WebApi/Controllers/System/SysNoticeController.cs index 2d6d2af..5a2cfd0 100644 --- a/ZR.Admin.WebApi/Controllers/System/SysNoticeController.cs +++ b/ZR.Admin.WebApi/Controllers/System/SysNoticeController.cs @@ -1,20 +1,19 @@ -using Microsoft.AspNetCore.Mvc; -using System; -using Infrastructure; +using Infrastructure; using Infrastructure.Attribute; +using Infrastructure.Constant; using Infrastructure.Enums; using Infrastructure.Model; using Mapster; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.SignalR; using SqlSugar; using ZR.Admin.WebApi.Extensions; using ZR.Admin.WebApi.Filters; -using ZR.Common; -using ZR.Model.Dto; -using ZR.Model.Models; -using ZR.Service.System.IService; using ZR.Admin.WebApi.Hubs; -using Microsoft.AspNetCore.SignalR; -using Infrastructure.Constant; +using ZR.Common; +using ZR.Model.System; +using ZR.Model.System.Dto; +using ZR.Service.System.IService; namespace ZR.Admin.WebApi.Controllers.System { @@ -99,7 +98,7 @@ namespace ZR.Admin.WebApi.Controllers.System } //从 Dto 映射到 实体 var modal = parm.Adapt().ToCreate(HttpContext); - modal.Create_by = User.Identity.Name; + modal.Create_by = HttpContext.GetName(); modal.Create_time = DateTime.Now; int result = _SysNoticeService.Insert(modal, it => new diff --git a/ZR.Admin.WebApi/Controllers/System/TasksController.cs b/ZR.Admin.WebApi/Controllers/System/TasksController.cs index e2675a4..c7895a6 100644 --- a/ZR.Admin.WebApi/Controllers/System/TasksController.cs +++ b/ZR.Admin.WebApi/Controllers/System/TasksController.cs @@ -97,7 +97,7 @@ namespace ZR.Admin.WebApi.Controllers tasksQz.ID = worker.NextId().ToString(); tasksQz.IsStart = false; - tasksQz.Create_by = User.Identity.Name; + tasksQz.Create_by = HttpContext.GetName(); return SUCCESS(_tasksQzService.Add(tasksQz)); } diff --git a/ZR.Admin.WebApi/Controllers/System/monitor/SysLogininforController.cs b/ZR.Admin.WebApi/Controllers/System/monitor/SysLogininforController.cs index 0df0ade..1c12531 100644 --- a/ZR.Admin.WebApi/Controllers/System/monitor/SysLogininforController.cs +++ b/ZR.Admin.WebApi/Controllers/System/monitor/SysLogininforController.cs @@ -8,7 +8,6 @@ using ZR.Admin.WebApi.Filters; using ZR.Common; using ZR.Model; using ZR.Model.System; -using ZR.Model.Vo; using ZR.Service.System.IService; namespace ZR.Admin.WebApi.Controllers.monitor diff --git a/ZR.Admin.WebApi/Controllers/System/monitor/SysOperlogController.cs b/ZR.Admin.WebApi/Controllers/System/monitor/SysOperlogController.cs index c71ef7d..4904744 100644 --- a/ZR.Admin.WebApi/Controllers/System/monitor/SysOperlogController.cs +++ b/ZR.Admin.WebApi/Controllers/System/monitor/SysOperlogController.cs @@ -6,14 +6,7 @@ using ZR.Admin.WebApi.Filters; using ZR.Common; using ZR.Model; using ZR.Model.System.Dto; -using ZR.Model.System; -using ZR.Model.Vo; using ZR.Service.System.IService; -using System; -using System.IO; -using OfficeOpenXml; -using Microsoft.AspNetCore.Hosting; -using System.Collections.Generic; namespace ZR.Admin.WebApi.Controllers.monitor { diff --git a/ZR.Admin.WebApi/Dockerfile b/ZR.Admin.WebApi/Dockerfile deleted file mode 100644 index 91f4597..0000000 --- a/ZR.Admin.WebApi/Dockerfile +++ /dev/null @@ -1,19 +0,0 @@ -FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base -# /appļ -WORKDIR /app -#Ŀ¼,ڽڷ -#VOLUME /app -#dockerⱩ¶˿ -EXPOSE 5000 -VOLUME /app/logs -#COPY bin/Release/net5.0/publish/ app/ -COPY . app/ - -#ڵʱãĬʱDZ׼ʱȱʱ8Сʱ -RUN echo "Asia/shanghai" > /etc/timezone -RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime - -# ƷļĿ¼ -#COPY . app/ - -ENTRYPOINT ["dotnet", "ZR.Admin.WebApi.dll"] \ No newline at end of file diff --git a/ZR.Admin.WebApi/Extensions/EntityExtension.cs b/ZR.Admin.WebApi/Extensions/EntityExtension.cs index fe5c4a8..4abe625 100644 --- a/ZR.Admin.WebApi/Extensions/EntityExtension.cs +++ b/ZR.Admin.WebApi/Extensions/EntityExtension.cs @@ -1,14 +1,14 @@ -using Microsoft.AspNetCore.Http; -using Snowflake.Core; +//using Microsoft.AspNetCore.Http; +//using Snowflake.Core; using System; namespace ZR.Admin.WebApi.Extensions { public static class EntityExtension { - public static TSource ToCreate(this TSource source, HttpContext context = null) + public static TSource ToCreate(this TSource source, HttpContext? context = null) { - var types = source.GetType(); + var types = source?.GetType(); //var worker = new IdWorker(1, 1); //if (types.GetProperty("ID") != null) diff --git a/ZR.Admin.WebApi/Extensions/HttpContextExtension.cs b/ZR.Admin.WebApi/Extensions/HttpContextExtension.cs index 535d9d8..1417c34 100644 --- a/ZR.Admin.WebApi/Extensions/HttpContextExtension.cs +++ b/ZR.Admin.WebApi/Extensions/HttpContextExtension.cs @@ -51,7 +51,7 @@ namespace ZR.Admin.WebApi.Extensions var result = context.Request.Headers["X-Forwarded-For"].FirstOrDefault(); if (string.IsNullOrEmpty(result)) { - result = context.Connection.RemoteIpAddress.ToString(); + result = context.Connection.RemoteIpAddress?.ToString(); } if (string.IsNullOrEmpty(result) || result.Contains("::1")) result = "127.0.0.1"; @@ -72,7 +72,7 @@ namespace ZR.Admin.WebApi.Extensions return !string.IsNullOrEmpty(uid) ? long.Parse(uid) : 0; } - public static string GetName(this HttpContext context) + public static string? GetName(this HttpContext context) { var uid = context.User?.Identity?.Name; @@ -84,7 +84,7 @@ namespace ZR.Admin.WebApi.Extensions /// /// /// - public static IEnumerable GetClaims(this HttpContext context) + public static IEnumerable? GetClaims(this HttpContext context) { return context.User?.Identities; } @@ -119,7 +119,7 @@ namespace ZR.Admin.WebApi.Extensions return c; } - public static string GetRequestUrl(this HttpContext context) + public static string? GetRequestUrl(this HttpContext context) { return context != null ? context.Request.Path.Value : ""; } diff --git a/ZR.Admin.WebApi/Extensions/SwaggerExtension.cs b/ZR.Admin.WebApi/Extensions/SwaggerExtension.cs index 13598a4..94cf9f0 100644 --- a/ZR.Admin.WebApi/Extensions/SwaggerExtension.cs +++ b/ZR.Admin.WebApi/Extensions/SwaggerExtension.cs @@ -1,13 +1,7 @@ using Infrastructure; using Microsoft.AspNetCore.Authentication.JwtBearer; -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Hosting; -using Microsoft.Extensions.DependencyInjection; using Microsoft.OpenApi.Models; using Swashbuckle.AspNetCore.Filters; -using System; -using System.Collections.Generic; -using System.IO; namespace ZR.Admin.WebApi.Extensions { @@ -51,7 +45,7 @@ namespace ZR.Admin.WebApi.Extensions { c.SwaggerDoc("v1", new OpenApiInfo { - Title = "ZrAdmin.NET Api - .NET5", + Title = "ZrAdmin.NET Api - .NET6", Version = "v1", Description = "", }); diff --git a/ZR.Admin.WebApi/Filters/ActionPermissionFilter.cs b/ZR.Admin.WebApi/Filters/ActionPermissionFilter.cs index 3c596c1..67761d3 100644 --- a/ZR.Admin.WebApi/Filters/ActionPermissionFilter.cs +++ b/ZR.Admin.WebApi/Filters/ActionPermissionFilter.cs @@ -2,9 +2,6 @@ using Infrastructure.Model; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Filters; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using ZR.Model.System; namespace ZR.Admin.WebApi.Filters @@ -22,9 +19,7 @@ namespace ZR.Admin.WebApi.Filters public string Permission { get; set; } private bool HasPermi { get; set; } private bool HasRole { get; set; } - public ActionPermissionFilter() { } - public ActionPermissionFilter(string permission) { Permission = permission; diff --git a/ZR.Admin.WebApi/Filters/GlobalActionMonitor.cs b/ZR.Admin.WebApi/Filters/GlobalActionMonitor.cs index 19efe96..7f699c7 100644 --- a/ZR.Admin.WebApi/Filters/GlobalActionMonitor.cs +++ b/ZR.Admin.WebApi/Filters/GlobalActionMonitor.cs @@ -2,16 +2,10 @@ using Infrastructure.Attribute; using Infrastructure.Model; using IPTools.Core; -using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Controllers; using Microsoft.AspNetCore.Mvc.Filters; using NLog; -using System; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using ZR.Admin.WebApi.Extensions; using ZR.Model.System; using ZR.Service.System.IService; @@ -122,7 +116,7 @@ namespace ZR.Admin.WebApi.Filters sysOperLog.jsonResult = logAttribute.IsSaveResponseData ? sysOperLog.jsonResult : ""; } - LogEventInfo ei = new(LogLevel.Info, "GlobalActionMonitor", ""); + LogEventInfo ei = new(NLog.LogLevel.Info, "GlobalActionMonitor", ""); ei.Properties["jsonResult"] = !HttpMethods.IsGet(method) ? jsonResult : ""; ei.Properties["requestParam"] = sysOperLog.operParam; @@ -137,12 +131,12 @@ namespace ZR.Admin.WebApi.Filters } } - private LogAttribute GetLogAttribute(ControllerActionDescriptor controllerActionDescriptor) + private LogAttribute? GetLogAttribute(ControllerActionDescriptor controllerActionDescriptor) { var attribute = controllerActionDescriptor.MethodInfo.GetCustomAttributes(inherit: true) .FirstOrDefault(a => a.GetType().Equals(typeof(LogAttribute))); - return (LogAttribute)attribute; + return attribute as LogAttribute; } } } diff --git a/ZR.Admin.WebApi/Framework/CookieUtil.cs b/ZR.Admin.WebApi/Framework/CookieUtil.cs deleted file mode 100644 index eeb7e26..0000000 --- a/ZR.Admin.WebApi/Framework/CookieUtil.cs +++ /dev/null @@ -1,17 +0,0 @@ -using Microsoft.AspNetCore.Authentication; -using Microsoft.AspNetCore.Authentication.Cookies; -using Microsoft.AspNetCore.Http; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Security.Claims; -using System.Threading.Tasks; - -namespace ZR.Admin.WebApi.Framework -{ - public class CookieUtil - { - - - } -} diff --git a/ZR.Admin.WebApi/Framework/JwtUtil.cs b/ZR.Admin.WebApi/Framework/JwtUtil.cs index 3af5a6f..a7a1b01 100644 --- a/ZR.Admin.WebApi/Framework/JwtUtil.cs +++ b/ZR.Admin.WebApi/Framework/JwtUtil.cs @@ -1,12 +1,8 @@ using Infrastructure; using Infrastructure.Extensions; -using Microsoft.AspNetCore.Http; using Microsoft.IdentityModel.Tokens; using Newtonsoft.Json; -using System; -using System.Collections.Generic; using System.IdentityModel.Tokens.Jwt; -using System.Linq; using System.Security.Claims; using System.Text; using ZR.Admin.WebApi.Extensions; @@ -99,7 +95,7 @@ namespace ZR.Admin.WebApi.Framework /// /// 令牌 /// - public static IEnumerable ParseToken(string token) + public static IEnumerable? ParseToken(string token) { var tokenHandler = new JwtSecurityTokenHandler(); var validateParameter = ValidParameters(); @@ -124,13 +120,13 @@ namespace ZR.Admin.WebApi.Framework /// /// /// - public static LoginUser ValidateJwtToken(IEnumerable jwtToken) + public static LoginUser? ValidateJwtToken(IEnumerable jwtToken) { try { - var userData = jwtToken.FirstOrDefault(x => x.Type == ClaimTypes.UserData).Value; + var userData = jwtToken.FirstOrDefault(x => x.Type == ClaimTypes.UserData); - LoginUser loginUser = JsonConvert.DeserializeObject(userData); + LoginUser loginUser = JsonConvert.DeserializeObject(value: userData?.Value); return loginUser; } catch (Exception ex) diff --git a/ZR.Admin.WebApi/Hubs/MessageHub.cs b/ZR.Admin.WebApi/Hubs/MessageHub.cs index 64ef549..049cd8a 100644 --- a/ZR.Admin.WebApi/Hubs/MessageHub.cs +++ b/ZR.Admin.WebApi/Hubs/MessageHub.cs @@ -1,11 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Infrastructure.Constant; +using Infrastructure.Constant; using Infrastructure.Model; using Microsoft.AspNetCore.SignalR; -using ZR.Model; using ZR.Service.System.IService; namespace ZR.Admin.WebApi.Hubs @@ -37,7 +32,7 @@ namespace ZR.Admin.WebApi.Hubs /// public override Task OnConnectedAsync() { - var name = Context.User.Identity.Name; + var name = Context.User?.Identity?.Name; var user = clientUsers.Any(u => u.ConnnectionId == Context.ConnectionId); //判断用户是否存在,否则添加集合 diff --git a/ZR.Admin.WebApi/Hubs/OnlineUsers.cs b/ZR.Admin.WebApi/Hubs/OnlineUsers.cs index 78aefe2..be59e99 100644 --- a/ZR.Admin.WebApi/Hubs/OnlineUsers.cs +++ b/ZR.Admin.WebApi/Hubs/OnlineUsers.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Text; -namespace ZR.Model +namespace ZR.Admin.WebApi.Hubs { public class OnlineUsers { @@ -16,7 +16,7 @@ namespace ZR.Model public int Userid { get; set; } public string Name { get; set; } public DateTime LoginTime { get; set; } - + public OnlineUsers(string clientid, string name) { ConnnectionId = clientid; diff --git a/ZR.Admin.WebApi/Middleware/GlobalExceptionMiddleware.cs b/ZR.Admin.WebApi/Middleware/GlobalExceptionMiddleware.cs index e02c999..1e91d9e 100644 --- a/ZR.Admin.WebApi/Middleware/GlobalExceptionMiddleware.cs +++ b/ZR.Admin.WebApi/Middleware/GlobalExceptionMiddleware.cs @@ -7,7 +7,6 @@ using NLog; using System; using System.Threading.Tasks; using ZR.Admin.WebApi.Extensions; -using ZR.Admin.WebApi.Filters; using ZR.Model.System; using ZR.Service.System.IService; @@ -44,7 +43,7 @@ namespace ZR.Admin.WebApi.Middleware private async Task HandleExceptionAsync(HttpContext context, Exception ex) { - LogLevel logLevel = LogLevel.Info; + NLog.LogLevel logLevel = NLog.LogLevel.Info; int code = (int)ResultCode.GLOBAL_ERROR; string msg; string error = string.Empty; @@ -64,7 +63,7 @@ namespace ZR.Admin.WebApi.Middleware { msg = "服务器好像出了点问题......"; error = $"{ex.Message}"; - logLevel = LogLevel.Error; + logLevel = NLog.LogLevel.Error; context.Response.StatusCode = 500; } @@ -80,7 +79,7 @@ namespace ZR.Admin.WebApi.Middleware requestMethod = context.Request.Method, jsonResult = responseResult, errorMsg = string.IsNullOrEmpty(error) ? msg : error, - operName = context.User.Identity.Name, + operName = HttpContextExtension.GetName(context) , operLocation = ip_info.Province + " " + ip_info.City, operTime = DateTime.Now }; @@ -92,7 +91,7 @@ namespace ZR.Admin.WebApi.Middleware ei.Properties["status"] = 1;//走正常返回都是通过走GlobalExceptionFilter不通过 ei.Properties["jsonResult"] = responseResult; ei.Properties["requestParam"] = sysOperLog.operParam; - ei.Properties["user"] = context.User.Identity.Name; + ei.Properties["user"] = context.User.Identity?.Name; Logger.Log(ei); await context.Response.WriteAsync(responseResult); diff --git a/ZR.Admin.WebApi/Middleware/RequestIPMiddleware.cs b/ZR.Admin.WebApi/Middleware/RequestIPMiddleware.cs index 0baa7b8..14218c0 100644 --- a/ZR.Admin.WebApi/Middleware/RequestIPMiddleware.cs +++ b/ZR.Admin.WebApi/Middleware/RequestIPMiddleware.cs @@ -9,7 +9,7 @@ using System.Linq; using System.Text.RegularExpressions; using System.Threading.Tasks; -namespace ZRAdmin.Middleware +namespace ZR.Admin.WebApi.Middleware { public class RequestIPMiddleware { diff --git a/ZR.Admin.WebApi/Program.cs b/ZR.Admin.WebApi/Program.cs index 07633fb..978b705 100644 --- a/ZR.Admin.WebApi/Program.cs +++ b/ZR.Admin.WebApi/Program.cs @@ -1,29 +1,128 @@ -using Infrastructure.Startups; -using Microsoft.AspNetCore.Hosting; -using Microsoft.Extensions.Hosting; -using NLog.Web; +using Infrastructure; +using Microsoft.AspNetCore.Authentication.JwtBearer; +using Microsoft.AspNetCore.DataProtection; +using ZR.Admin.WebApi.Framework; +using Hei.Captcha; +using Infrastructure.Extensions; +using ZR.Admin.WebApi.Extensions; +using ZR.Admin.WebApi.Filters; +using ZR.Admin.WebApi.Middleware; +using ZR.Admin.WebApi.Hubs; -namespace ZR.Admin.WebApi +var builder = WebApplication.CreateBuilder(args); + +// Add services to the container. + +builder.Services.AddControllers(); +// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle +builder.Services.AddEndpointsApiExplorer(); +builder.Services.AddSwaggerGen(); +//עHttpContextAccessor +builder.Services.AddSingleton(); + +//ÿ +builder.Services.AddCors(c => { - public class Program + c.AddPolicy("Policy", policy => { - public static void Main(string[] args) - { - CreateHostBuilder(args).Build().Run(); - } + policy.WithOrigins(builder.Configuration["corsUrls"].Split(',', StringSplitOptions.RemoveEmptyEntries)) + .AllowAnyHeader()//ͷ + .AllowCredentials()//cookie + .AllowAnyMethod();//ⷽ + }); +}); - public static IHostBuilder CreateHostBuilder(string[] args) - { - var builder = Host.CreateDefaultBuilder(args) - .ConfigureWebHostDefaults(webBuilder => - { - webBuilder - .Init("Infrastructure") - .UseNLog() - .UseStartup(); - }); +//עSignalRʵʱͨѶĬjson +builder.Services.AddSignalR(); +//Error unprotecting the session cookie +builder.Services.AddDataProtection() + .PersistKeysToFileSystem(new DirectoryInfo(Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar + "DataProtection")); +//֤ͨ +builder.Services.AddHeiCaptcha(); +//builder.Services.AddSession(); +builder.Services.AddHttpContextAccessor(); +//Model +builder.Services.Configure(builder.Configuration); - return builder; - } - } +//jwt ֤ +builder.Services.AddAuthentication(options => +{ + options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme; + options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme; +}).AddCookie() +.AddJwtBearer(o => +{ + o.TokenValidationParameters = JwtUtil.ValidParameters(); +}); + +InternalApp.InternalServices = builder.Services; +builder.Services.AddAppService(); +builder.Services.AddSingleton(new AppSettings(builder.Configuration)); +//ƻ +builder.Services.AddTaskSchedulers(); +//ʼdb +DbExtension.AddDb(builder.Configuration); + +//עREDIS +Task.Run(() => +{ + //RedisServer.Initalize(); +}); +builder.Services.AddMvc(options => +{ + options.Filters.Add(typeof(GlobalActionMonitor));//ȫע +}) +.AddJsonOptions(options => +{ + options.JsonSerializerOptions.Converters.Add(new JsonConverterUtil.DateTimeConverter()); + options.JsonSerializerOptions.Converters.Add(new JsonConverterUtil.DateTimeNullConverter()); +}); + +builder.Services.AddSwaggerConfig(); + +var app = builder.Build(); + +if (app.Environment.IsDevelopment()) +{ + app.UseSwagger(); + app.UseSwaggerUI(); } +//ʹԶζȥbody +app.Use((context, next) => +{ + context.Request.EnableBuffering(); + if (context.Request.Query.TryGetValue("access_token", out var token)) + { + context.Request.Headers.Add("Authorization", $"Bearer {token}"); + } + return next(); +}); +//ʾ̬ļ/wwwrootĿ¼ļҪUseRoutingǰ +app.UseStaticFiles(); +//·ɷ +app.UseRouting(); +app.UseCors("Policy");//Ҫapp.UseEndpointsǰ +//app.UseHttpsRedirection(); + +app.UseAuthentication(); +app.UseAuthorization(); + +// +app.UseResponseCaching(); +//ָ/ +app.UseAddTaskSchedulers(); +//ʹȫ쳣м +app.UseMiddleware(); + +app.UseEndpoints(endpoints => +{ + //socket + endpoints.MapHub("/msgHub"); + + endpoints.MapControllerRoute( + name: "default", + pattern: "{controller=Home}/{action=Index}/{id?}"); +}); +app.MapControllers(); + +app.Run(); \ No newline at end of file diff --git a/ZR.Admin.WebApi/Properties/PublishProfiles/FolderProfile.pubxml b/ZR.Admin.WebApi/Properties/PublishProfiles/FolderProfile.pubxml index 48bf8f3..5dc798d 100644 --- a/ZR.Admin.WebApi/Properties/PublishProfiles/FolderProfile.pubxml +++ b/ZR.Admin.WebApi/Properties/PublishProfiles/FolderProfile.pubxml @@ -1,20 +1,20 @@  - + - True - False - True + true + false + true Release Any CPU FileSystem - bin\Release\net5.0\publish\ + bin\Release\net6.0\publish\ FileSystem - net5.0 - ba176987-aabb-406a-b4a8-6b63b422b703 + net6.0 + e5497bb4-b0c1-4794-9fae-163f626ec399 false \ No newline at end of file diff --git a/ZR.Admin.WebApi/Properties/launchSettings.json b/ZR.Admin.WebApi/Properties/launchSettings.json index 7fb9b62..c9bec37 100644 --- a/ZR.Admin.WebApi/Properties/launchSettings.json +++ b/ZR.Admin.WebApi/Properties/launchSettings.json @@ -1,12 +1,23 @@ -{ +{ + "$schema": "https://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:63521", + "sslPort": 44395 + } + }, "profiles": { - "ZRAdmin": { + "ZR.Admin.WebApi": { "commandName": "Project", - "launchBrowser": false, + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "http://localhost:8888", "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Stage" - }, - "applicationUrl": "http://localhost:8888" + "ASPNETCORE_ENVIRONMENT": "Development" + } } } -} \ No newline at end of file +} diff --git a/ZR.Admin.WebApi/Startup.cs b/ZR.Admin.WebApi/Startup.cs deleted file mode 100644 index c57fc79..0000000 --- a/ZR.Admin.WebApi/Startup.cs +++ /dev/null @@ -1,163 +0,0 @@ -using Hei.Captcha; -using Infrastructure; -using Infrastructure.Extensions; -using Microsoft.AspNetCore.Authentication.JwtBearer; -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.DataProtection; -using Microsoft.AspNetCore.Hosting; -using Microsoft.AspNetCore.Http; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; -using System; -using System.IO; -using System.Threading.Tasks; -using ZR.Admin.WebApi.Extensions; -using ZR.Admin.WebApi.Filters; -using ZR.Admin.WebApi.Framework; -using ZR.Admin.WebApi.Hubs; -using ZR.Admin.WebApi.Middleware; - -namespace ZR.Admin.WebApi -{ - public class Startup - { - public Startup(IConfiguration configuration) - { - Configuration = configuration; - } - private NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger(); - public IConfiguration Configuration { get; } - public void ConfigureServices(IServiceCollection services) - { - string corsUrls = Configuration["corsUrls"]; - - //ÿ - services.AddCors(c => - { - c.AddPolicy("Policy", policy => - { - policy.WithOrigins(corsUrls.Split(',', StringSplitOptions.RemoveEmptyEntries)) - .AllowAnyHeader()//ͷ - .AllowCredentials()//cookie - .AllowAnyMethod();//ⷽ - }); - }); - //עSignalRʵʱͨѶĬjson - services.AddSignalR(options => - { - //ͻ˷󵽷Ĭ30룬ij4ӣҳconnection.keepAliveIntervalInMilliseconds = 12e4;2 - //options.ClientTimeoutInterval = TimeSpan.FromMinutes(4); - //˷󵽿ͻ˼Ĭ15룬ij2ӣҳconnection.serverTimeoutInMilliseconds = 24e4;4 - //options.KeepAliveInterval = TimeSpan.FromMinutes(2); - }); - //Error unprotecting the session cookie - services.AddDataProtection() - .PersistKeysToFileSystem(new DirectoryInfo(Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar + "DataProtection")); - //֤ͨ - services.AddHeiCaptcha(); - services.AddSession(); - services.AddHttpContextAccessor(); - - //Model - services.Configure(Configuration); - - //jwt ֤ - services.AddAuthentication(options => - { - options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme; - options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme; - }).AddCookie() - .AddJwtBearer(o => - { - o.TokenValidationParameters = JwtUtil.ValidParameters(); - }); - - InjectServices(services, Configuration); - - services.AddMvc(options => - { - options.Filters.Add(typeof(GlobalActionMonitor));//ȫע - }) - .AddJsonOptions(options => - { - options.JsonSerializerOptions.Converters.Add(new JsonConverterUtil.DateTimeConverter()); - options.JsonSerializerOptions.Converters.Add(new JsonConverterUtil.DateTimeNullConverter()); - }); - - services.AddSwaggerConfig(); - } - - // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. - public void Configure(IApplicationBuilder app, IWebHostEnvironment env) - { - if (env.IsDevelopment()) - { - app.UseDeveloperExceptionPage(); - } - app.UseSwagger(); - //ʹԶζȥbody - app.Use((context, next) => - { - context.Request.EnableBuffering(); - if (context.Request.Query.TryGetValue("access_token", out var token)) - { - context.Request.Headers.Add("Authorization", $"Bearer {token}"); - } - return next(); - }); - //ʾ̬ļ/wwwrootĿ¼ļҪUseRoutingǰ - app.UseStaticFiles(); - //·ɷ - app.UseRouting(); - app.UseCors("Policy");//Ҫapp.UseEndpointsǰ - - //app.UseAuthenticationAuthenticationммݵǰHttpеCookieϢHttpContext.Userԣõ - //ֻapp.UseAuthentication֮עмܹHttpContext.Userжȡֵ - //ҲΪʲôǿapp.UseAuthenticationһҪapp.UseMvcǰ棬ΪֻASP.NET CoreMVCмвܶȡHttpContext.Userֵ - //1.ȿ֤ - app.UseAuthentication(); - //2.ٿȨ - app.UseAuthorization(); - //session - app.UseSession(); - // - app.UseResponseCaching(); - //ָ/ - app.UseAddTaskSchedulers(); - //ʹȫ쳣м - app.UseMiddleware(); - - app.UseEndpoints(endpoints => - { - //socket - endpoints.MapHub("/msgHub"); - - endpoints.MapControllerRoute( - name: "default", - pattern: "{controller=Home}/{action=Index}/{id?}"); - }); - } - - /// - /// עServices - /// - /// - /// - private void InjectServices(IServiceCollection services, IConfiguration configuration) - { - services.AddAppService(); - services.AddSingleton(new AppSettings(configuration)); - //ƻ - services.AddTaskSchedulers(); - //ʼdb - DbExtension.AddDb(configuration); - - //עREDIS - Task.Run(() => - { - //RedisServer.Initalize(); - }); - } - } -} diff --git a/ZR.Admin.WebApi/ZR.Admin.WebApi.csproj b/ZR.Admin.WebApi/ZR.Admin.WebApi.csproj index 5e1729e..a81c54c 100644 --- a/ZR.Admin.WebApi/ZR.Admin.WebApi.csproj +++ b/ZR.Admin.WebApi/ZR.Admin.WebApi.csproj @@ -1,78 +1,48 @@  + + net6.0 + enable + enable + - - net5.0 - bc51af00-60b6-4e2a-935e-267c368c890a - false - zh-Hans - + + + + + + - - ZRAdmin.xml - 1701;1702;1591;1570 - + + + + + + + + + + + + + + + + + + + + + + - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Always - - - - - - Always - - - Always - - - Always - - - PreserveNewest - - - - - - - - - - - - + + + PreserveNewest + + diff --git a/ZR.Admin.WebApi/build.bat b/ZR.Admin.WebApi/build.bat deleted file mode 100644 index 5aa4fb6..0000000 --- a/ZR.Admin.WebApi/build.bat +++ /dev/null @@ -1,8 +0,0 @@ -@echo off - -docker build -t ZRAdmin.NET:latest -f ./Dockerfile . - -echo "==============鿴===========" -docker images - -pause \ No newline at end of file diff --git a/ZR.CodeGenerator/ZR.CodeGenerator.csproj b/ZR.CodeGenerator/ZR.CodeGenerator.csproj index bb23768..3d03ff0 100644 --- a/ZR.CodeGenerator/ZR.CodeGenerator.csproj +++ b/ZR.CodeGenerator/ZR.CodeGenerator.csproj @@ -1,7 +1,7 @@  - net5.0 + net6.0 diff --git a/ZR.Common/ZR.Common.csproj b/ZR.Common/ZR.Common.csproj index eaeea2f..d156f53 100644 --- a/ZR.Common/ZR.Common.csproj +++ b/ZR.Common/ZR.Common.csproj @@ -1,7 +1,7 @@  - net5.0 + net6.0 @@ -9,7 +9,7 @@ - + diff --git a/ZR.Model/System/Dto/SysConfigDto.cs b/ZR.Model/System/Dto/SysConfigDto.cs index 6547982..8a57b53 100644 --- a/ZR.Model/System/Dto/SysConfigDto.cs +++ b/ZR.Model/System/Dto/SysConfigDto.cs @@ -1,6 +1,6 @@ using System; -namespace ZR.Model.Dto +namespace ZR.Model.System.Dto { /// /// 参数配置输入对象模型 @@ -18,7 +18,7 @@ namespace ZR.Model.Dto /// /// 参数配置查询对象模型 /// - public class SysConfigQueryDto: PagerInfo + public class SysConfigQueryDto : PagerInfo { public string ConfigName { get; set; } public string ConfigKey { get; set; } diff --git a/ZR.Model/System/Dto/SysNoticeDto.cs b/ZR.Model/System/Dto/SysNoticeDto.cs index 6c89ef2..eb1ec16 100644 --- a/ZR.Model/System/Dto/SysNoticeDto.cs +++ b/ZR.Model/System/Dto/SysNoticeDto.cs @@ -2,10 +2,9 @@ using System; using System.Collections.Generic; using System.Runtime.Serialization; using Newtonsoft.Json; -using ZR.Model.Dto; using ZR.Model.Models; -namespace ZR.Model.Dto +namespace ZR.Model.System.Dto { /// /// 通知公告表输入对象 @@ -23,7 +22,7 @@ namespace ZR.Model.Dto /// /// 通知公告表查询对象 /// - public class SysNoticeQueryDto : PagerInfo + public class SysNoticeQueryDto : PagerInfo { public string NoticeTitle { get; set; } public string NoticeType { get; set; } diff --git a/ZR.Model/System/SysNotice.cs b/ZR.Model/System/SysNotice.cs index 47facb7..b81f574 100644 --- a/ZR.Model/System/SysNotice.cs +++ b/ZR.Model/System/SysNotice.cs @@ -1,9 +1,8 @@ using System; using System.Collections.Generic; using SqlSugar; -using ZR.Model.System; -namespace ZR.Model.Models +namespace ZR.Model.System { /// /// 通知公告表,数据实体对象 @@ -19,7 +18,7 @@ namespace ZR.Model.Models /// 描述 : 公告ID /// 空值 : true /// - [SqlSugar.SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnName = "notice_id")] + [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnName = "notice_id")] public int NoticeId { get; set; } /// /// 描述 : 公告标题 diff --git a/ZR.Model/System/Vo/TreeSelectVo.cs b/ZR.Model/System/Vo/TreeSelectVo.cs index 46ed195..cced4bc 100644 --- a/ZR.Model/System/Vo/TreeSelectVo.cs +++ b/ZR.Model/System/Vo/TreeSelectVo.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; using System.Text; using ZR.Model.System; -namespace ZR.Model.Vo.System +namespace ZR.Model.System.Vo { /// /// Treeselect树结构实体类 diff --git a/ZR.Repository/System/SysNoticeRepository.cs b/ZR.Repository/System/SysNoticeRepository.cs index d6ccd5c..01dd4f4 100644 --- a/ZR.Repository/System/SysNoticeRepository.cs +++ b/ZR.Repository/System/SysNoticeRepository.cs @@ -2,6 +2,7 @@ using System; using Infrastructure.Attribute; using ZR.Repository.System; using ZR.Model.Models; +using ZR.Model.System; namespace ZR.Repository.System { diff --git a/ZR.Repository/ZR.Repository.csproj b/ZR.Repository/ZR.Repository.csproj index 97c0951..89e76a0 100644 --- a/ZR.Repository/ZR.Repository.csproj +++ b/ZR.Repository/ZR.Repository.csproj @@ -1,7 +1,7 @@  - net5.0 + net6.0 @@ -10,7 +10,6 @@ - diff --git a/ZR.Service/System/IService/ISysDeptService.cs b/ZR.Service/System/IService/ISysDeptService.cs index 8484031..668415f 100644 --- a/ZR.Service/System/IService/ISysDeptService.cs +++ b/ZR.Service/System/IService/ISysDeptService.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Text; using ZR.Model.System; -using ZR.Model.Vo.System; +using ZR.Model.System.Vo; namespace ZR.Service.System.IService { diff --git a/ZR.Service/System/IService/ISysMenuService.cs b/ZR.Service/System/IService/ISysMenuService.cs index a8bd620..6c9c416 100644 --- a/ZR.Service/System/IService/ISysMenuService.cs +++ b/ZR.Service/System/IService/ISysMenuService.cs @@ -2,7 +2,6 @@ using ZR.Model.System.Dto; using ZR.Model.System; using ZR.Model.System.Vo; -using ZR.Model.Vo.System; namespace ZR.Service.System.IService { diff --git a/ZR.Service/System/IService/ISysNoticeService.cs b/ZR.Service/System/IService/ISysNoticeService.cs index fbeb568..8c8a53b 100644 --- a/ZR.Service/System/IService/ISysNoticeService.cs +++ b/ZR.Service/System/IService/ISysNoticeService.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using ZR.Model.Models; +using ZR.Model.System; namespace ZR.Service.System.IService { diff --git a/ZR.Service/System/SysDeptService.cs b/ZR.Service/System/SysDeptService.cs index ff6e20f..299bdd8 100644 --- a/ZR.Service/System/SysDeptService.cs +++ b/ZR.Service/System/SysDeptService.cs @@ -8,7 +8,7 @@ using System.Linq; using System.Text; using ZR.Common; using ZR.Model.System; -using ZR.Model.Vo.System; +using ZR.Model.System.Vo; using ZR.Repository.System; using ZR.Service.System.IService; diff --git a/ZR.Service/System/SysFileService.cs b/ZR.Service/System/SysFileService.cs index 1ff9b66..eeff8f6 100644 --- a/ZR.Service/System/SysFileService.cs +++ b/ZR.Service/System/SysFileService.cs @@ -73,7 +73,7 @@ namespace ZR.Service.System { str = Guid.NewGuid().ToString(); } - MD5CryptoServiceProvider md5 = new(); + MD5 md5 = MD5.Create(); return BitConverter.ToString(md5.ComputeHash(Encoding.Default.GetBytes(str)), 4, 8).Replace("-", ""); } diff --git a/ZR.Service/System/SysMenuService.cs b/ZR.Service/System/SysMenuService.cs index 5225e66..ff406f4 100644 --- a/ZR.Service/System/SysMenuService.cs +++ b/ZR.Service/System/SysMenuService.cs @@ -4,7 +4,6 @@ using System.Linq; using ZR.Model.System.Dto; using ZR.Model.System; using ZR.Model.System.Vo; -using ZR.Model.Vo.System; using ZR.Repository.System; using ZR.Service.System.IService; using ZR.Common; diff --git a/ZR.Service/System/SysNoticeService.cs b/ZR.Service/System/SysNoticeService.cs index 2b7d094..195f957 100644 --- a/ZR.Service/System/SysNoticeService.cs +++ b/ZR.Service/System/SysNoticeService.cs @@ -3,6 +3,7 @@ using Infrastructure.Attribute; using SqlSugar; using System.Collections.Generic; using ZR.Model.Models; +using ZR.Model.System; using ZR.Repository; using ZR.Repository.System; using ZR.Service.System.IService; diff --git a/ZR.Service/ZR.Service.csproj b/ZR.Service/ZR.Service.csproj index 4ad0985..9dca052 100644 --- a/ZR.Service/ZR.Service.csproj +++ b/ZR.Service/ZR.Service.csproj @@ -1,7 +1,7 @@  - net5.0 + net6.0 diff --git a/ZR.Tasks/ZR.Tasks.csproj b/ZR.Tasks/ZR.Tasks.csproj index 834ba93..1271233 100644 --- a/ZR.Tasks/ZR.Tasks.csproj +++ b/ZR.Tasks/ZR.Tasks.csproj @@ -1,11 +1,12 @@  - net5.0 + net6.0 - + + diff --git a/ZRAdmin.sln b/ZRAdmin.sln index af0b3a6..7c14b06 100644 --- a/ZRAdmin.sln +++ b/ZRAdmin.sln @@ -1,31 +1,23 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30711.63 +# Visual Studio Version 17 +VisualStudioVersion = 17.1.32210.238 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ZR.Admin.WebApi", "ZR.Admin.WebApi\ZR.Admin.WebApi.csproj", "{BA176987-AABB-406A-B4A8-6B63B422B703}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ZR.Admin.WebApi", "ZR.Admin.WebApi\ZR.Admin.WebApi.csproj", "{E5497BB4-B0C1-4794-9FAE-163F626EC399}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ZR.Repository", "ZR.Repository\ZR.Repository.csproj", "{0665F19A-F8DC-4C8C-8382-68ABE75E8646}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ZR.Model", "ZR.Model\ZR.Model.csproj", "{B35D73B1-2E22-4636-B88B-10C5E6D8E524}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ZR.Model", "ZR.Model\ZR.Model.csproj", "{F762038D-733D-4572-A55F-4C4EA6A8BE5F}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ZR.Common", "ZR.Common\ZR.Common.csproj", "{42C84599-1E99-45B4-929B-417C37337EF8}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ZR.Service", "ZR.Service\ZR.Service.csproj", "{76F7557E-BB62-48AC-AF6D-EE62BBF64225}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Infrastructure", "Infrastructure\Infrastructure.csproj", "{5D740120-5491-4FE2-B5BE-8A9C48BFE3C5}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ZR.Common", "ZR.Common\ZR.Common.csproj", "{D7F7C898-8758-46E6-B26B-960FE79FF8CF}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ZR.Tasks", "ZR.Tasks\ZR.Tasks.csproj", "{B657ED99-40E5-423A-AFE7-157C4EE576CB}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Infrastructure", "Infrastructure\Infrastructure.csproj", "{DF8B3C35-6E0E-481B-B2CB-C2BED3AF8634}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ZR.Service", "ZR.Service\ZR.Service.csproj", "{75ADA3C1-148D-4727-A718-79447D9B5EEE}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "02 Interfaces", "02 Interfaces", "{CAB76A06-3117-4AEB-8540-58ED63E7F96C}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ZR.Repository", "ZR.Repository\ZR.Repository.csproj", "{17E277BF-B2B8-4111-AE43-38246128C83C}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "01 基础设施层", "01 基础设施层", "{3DA5CBAB-687B-4022-B43B-AA7856121B9E}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ZR.Tasks", "ZR.Tasks\ZR.Tasks.csproj", "{328C152F-4DA3-4ABB-A9B7-628109902088}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Quartz定时任务", "Quartz定时任务", "{8A1C9D96-9967-42DA-9A57-2C945E08E93E}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "UI", "UI", "{7BBADB30-A3CB-4A8D-91E2-FE8F13AD1536}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ZR.CodeGenerator", "ZR.CodeGenerator\ZR.CodeGenerator.csproj", "{42F902A7-33C4-44D6-A7D8-5E0E72DAA03C}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ZR.CodeGenerator", "ZR.CodeGenerator\ZR.CodeGenerator.csproj", "{B353DE0B-12C6-4C15-909A-DB68F71D5AE9}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -33,53 +25,43 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {BA176987-AABB-406A-B4A8-6B63B422B703}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {BA176987-AABB-406A-B4A8-6B63B422B703}.Debug|Any CPU.Build.0 = Debug|Any CPU - {BA176987-AABB-406A-B4A8-6B63B422B703}.Release|Any CPU.ActiveCfg = Release|Any CPU - {BA176987-AABB-406A-B4A8-6B63B422B703}.Release|Any CPU.Build.0 = Release|Any CPU - {0665F19A-F8DC-4C8C-8382-68ABE75E8646}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0665F19A-F8DC-4C8C-8382-68ABE75E8646}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0665F19A-F8DC-4C8C-8382-68ABE75E8646}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0665F19A-F8DC-4C8C-8382-68ABE75E8646}.Release|Any CPU.Build.0 = Release|Any CPU - {F762038D-733D-4572-A55F-4C4EA6A8BE5F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F762038D-733D-4572-A55F-4C4EA6A8BE5F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F762038D-733D-4572-A55F-4C4EA6A8BE5F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F762038D-733D-4572-A55F-4C4EA6A8BE5F}.Release|Any CPU.Build.0 = Release|Any CPU - {76F7557E-BB62-48AC-AF6D-EE62BBF64225}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {76F7557E-BB62-48AC-AF6D-EE62BBF64225}.Debug|Any CPU.Build.0 = Debug|Any CPU - {76F7557E-BB62-48AC-AF6D-EE62BBF64225}.Release|Any CPU.ActiveCfg = Release|Any CPU - {76F7557E-BB62-48AC-AF6D-EE62BBF64225}.Release|Any CPU.Build.0 = Release|Any CPU - {D7F7C898-8758-46E6-B26B-960FE79FF8CF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D7F7C898-8758-46E6-B26B-960FE79FF8CF}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D7F7C898-8758-46E6-B26B-960FE79FF8CF}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D7F7C898-8758-46E6-B26B-960FE79FF8CF}.Release|Any CPU.Build.0 = Release|Any CPU - {DF8B3C35-6E0E-481B-B2CB-C2BED3AF8634}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {DF8B3C35-6E0E-481B-B2CB-C2BED3AF8634}.Debug|Any CPU.Build.0 = Debug|Any CPU - {DF8B3C35-6E0E-481B-B2CB-C2BED3AF8634}.Release|Any CPU.ActiveCfg = Release|Any CPU - {DF8B3C35-6E0E-481B-B2CB-C2BED3AF8634}.Release|Any CPU.Build.0 = Release|Any CPU - {328C152F-4DA3-4ABB-A9B7-628109902088}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {328C152F-4DA3-4ABB-A9B7-628109902088}.Debug|Any CPU.Build.0 = Debug|Any CPU - {328C152F-4DA3-4ABB-A9B7-628109902088}.Release|Any CPU.ActiveCfg = Release|Any CPU - {328C152F-4DA3-4ABB-A9B7-628109902088}.Release|Any CPU.Build.0 = Release|Any CPU - {42F902A7-33C4-44D6-A7D8-5E0E72DAA03C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {42F902A7-33C4-44D6-A7D8-5E0E72DAA03C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {42F902A7-33C4-44D6-A7D8-5E0E72DAA03C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {42F902A7-33C4-44D6-A7D8-5E0E72DAA03C}.Release|Any CPU.Build.0 = Release|Any CPU + {E5497BB4-B0C1-4794-9FAE-163F626EC399}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E5497BB4-B0C1-4794-9FAE-163F626EC399}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E5497BB4-B0C1-4794-9FAE-163F626EC399}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E5497BB4-B0C1-4794-9FAE-163F626EC399}.Release|Any CPU.Build.0 = Release|Any CPU + {B35D73B1-2E22-4636-B88B-10C5E6D8E524}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B35D73B1-2E22-4636-B88B-10C5E6D8E524}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B35D73B1-2E22-4636-B88B-10C5E6D8E524}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B35D73B1-2E22-4636-B88B-10C5E6D8E524}.Release|Any CPU.Build.0 = Release|Any CPU + {42C84599-1E99-45B4-929B-417C37337EF8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {42C84599-1E99-45B4-929B-417C37337EF8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {42C84599-1E99-45B4-929B-417C37337EF8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {42C84599-1E99-45B4-929B-417C37337EF8}.Release|Any CPU.Build.0 = Release|Any CPU + {5D740120-5491-4FE2-B5BE-8A9C48BFE3C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5D740120-5491-4FE2-B5BE-8A9C48BFE3C5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5D740120-5491-4FE2-B5BE-8A9C48BFE3C5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5D740120-5491-4FE2-B5BE-8A9C48BFE3C5}.Release|Any CPU.Build.0 = Release|Any CPU + {B657ED99-40E5-423A-AFE7-157C4EE576CB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B657ED99-40E5-423A-AFE7-157C4EE576CB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B657ED99-40E5-423A-AFE7-157C4EE576CB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B657ED99-40E5-423A-AFE7-157C4EE576CB}.Release|Any CPU.Build.0 = Release|Any CPU + {75ADA3C1-148D-4727-A718-79447D9B5EEE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {75ADA3C1-148D-4727-A718-79447D9B5EEE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {75ADA3C1-148D-4727-A718-79447D9B5EEE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {75ADA3C1-148D-4727-A718-79447D9B5EEE}.Release|Any CPU.Build.0 = Release|Any CPU + {17E277BF-B2B8-4111-AE43-38246128C83C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {17E277BF-B2B8-4111-AE43-38246128C83C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {17E277BF-B2B8-4111-AE43-38246128C83C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {17E277BF-B2B8-4111-AE43-38246128C83C}.Release|Any CPU.Build.0 = Release|Any CPU + {B353DE0B-12C6-4C15-909A-DB68F71D5AE9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B353DE0B-12C6-4C15-909A-DB68F71D5AE9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B353DE0B-12C6-4C15-909A-DB68F71D5AE9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B353DE0B-12C6-4C15-909A-DB68F71D5AE9}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {BA176987-AABB-406A-B4A8-6B63B422B703} = {7BBADB30-A3CB-4A8D-91E2-FE8F13AD1536} - {0665F19A-F8DC-4C8C-8382-68ABE75E8646} = {CAB76A06-3117-4AEB-8540-58ED63E7F96C} - {F762038D-733D-4572-A55F-4C4EA6A8BE5F} = {CAB76A06-3117-4AEB-8540-58ED63E7F96C} - {76F7557E-BB62-48AC-AF6D-EE62BBF64225} = {CAB76A06-3117-4AEB-8540-58ED63E7F96C} - {D7F7C898-8758-46E6-B26B-960FE79FF8CF} = {3DA5CBAB-687B-4022-B43B-AA7856121B9E} - {DF8B3C35-6E0E-481B-B2CB-C2BED3AF8634} = {3DA5CBAB-687B-4022-B43B-AA7856121B9E} - {328C152F-4DA3-4ABB-A9B7-628109902088} = {8A1C9D96-9967-42DA-9A57-2C945E08E93E} - {42F902A7-33C4-44D6-A7D8-5E0E72DAA03C} = {3DA5CBAB-687B-4022-B43B-AA7856121B9E} - EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {F420E614-D8A9-4E15-B9EA-9205B3DE7BAB} + SolutionGuid = {0469FF3A-7322-4053-94C7-881B103A57C5} EndGlobalSection EndGlobal