From a51fb7d71ad26867c3464107ae9b81a978dddbca 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, 5 Dec 2021 18:01:39 +0800 Subject: [PATCH 01/14] =?UTF-8?q?=E8=AE=BE=E7=BD=AEZRAdmin.xml=E4=B8=BA?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=A4=8D=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ZR.Admin.WebApi/ZR.Admin.WebApi.csproj | 3 + ZR.Admin.WebApi/ZRAdmin.xml | 1061 ++++++++++++++++++++++++ 2 files changed, 1064 insertions(+) create mode 100644 ZR.Admin.WebApi/ZRAdmin.xml diff --git a/ZR.Admin.WebApi/ZR.Admin.WebApi.csproj b/ZR.Admin.WebApi/ZR.Admin.WebApi.csproj index 07c5a31..0b71c00 100644 --- a/ZR.Admin.WebApi/ZR.Admin.WebApi.csproj +++ b/ZR.Admin.WebApi/ZR.Admin.WebApi.csproj @@ -60,6 +60,9 @@ Always + + PreserveNewest + diff --git a/ZR.Admin.WebApi/ZRAdmin.xml b/ZR.Admin.WebApi/ZRAdmin.xml new file mode 100644 index 0000000..a7cb591 --- /dev/null +++ b/ZR.Admin.WebApi/ZRAdmin.xml @@ -0,0 +1,1061 @@ + + + + ZR.Admin.WebApi + + + + + json输出带时间格式的 + + + + + + + + 响应返回结果 + + 受影响行数 + + + + + 全局Code使用 + + + + + + + + 导出Excel + + + + + + + + + 代码生成演示Controller + + @author zr + @date 2021-11-24 + + + + + 代码生成演示接口 + + + + + 查询代码生成演示列表 + + + + + + 查询代码生成演示详情 + + + + + + + 添加代码生成演示 + + + + + + 更新代码生成演示 + + + + + + 删除代码生成演示 + + + + + + 代码生成 + + + + + 获取所有数据库的信息 + + + + + + 获取所有表根据数据名 + + 数据库名 + 表名 + 分页信息 + + + + + 代码生成器 + + 数据传输对象 + + + + + 获取代码生成表列表 + + 表名 + 分页信息 + + + + + 查询表字段列表 + + genTable表id + + + + + 删除代码生成 + + + + + + + 导入表结构(保存) + + + + + + + + 修改保存代码生成业务 + + 请求参数实体 + + + + + 预览代码 + + + + + + + 心跳 + + + + + + 加密 + + + + + + + 解密 + + + + + + + 发送邮件 + + 请求参数接收实体 + + + + + T4代码自动生成 + + + + + 文章接口 + + + + + 查询文章列表 + + + + + + 获取文章目录,前端没用到 + + + + + + 获取文章目录树 + + + + + + 查询文章详情 + + + + + + + 添加文章 + + + + + + 更新文章 + + + + + + 删除文章 + + + + + + 获取缓存监控数据 + + + + + + 获取服务器信息 + + + + + + 系统访问记录 + + + + + 查询登录日志 + /monitor/logininfor/list + + + + + + + + 清空登录日志 + /monitor/logininfor/clean + + + + + + /monitor/logininfor/1 + + + + + + + 登录日志导出 + + + + + + 查询操作日志 + + + + + + + 删除操作日志 + + + + + + + 清空操作日志 + + + + + + 导出操作日志 + + + + + + 参数配置Controller + + @author zhaorui + @date 2021-09-29 + + + + + 参数配置接口 + + + + + 查询参数配置列表 + + + + + + 查询参数配置详情 + + + + + + + 根据参数键名查询参数值 + + + + + + + 添加参数配置 + + + + + + 更新参数配置 + + + + + + 删除参数配置 + + + + + + 部门 + + + + + 获取部门列表 + + + + + + 查询部门列表(排除节点) + + + + + + + 获取部门下拉树列表 + + + + + + + 根据部门编号获取详细信息 + + + + + + 新增部门 + + + + + + + 修改部门 + + + + + + + 删除部门 + + + + + + 数据字典信息 + @author zr + + + + + 搜索 + + + + + + + + 根据字典类型查询字典数据信息 + + + + + + + 查询字典数据详细 + + + + + + + 添加 + + + + + + + 修改 + + + + + + + 删除字典类型 + + + + + + + 数据字典信息 + + + + + 查询 + + + + + + + + 查询字典类型详细 + + + + + + + 添加字典类型 + + + + + + + 修改字典类型 + + + + + + + 删除字典类型 + + + + + + 字典导出 + + + + + + 登录 + + + + + 登录 + + 登录对象 + + + + + 注销 + + + + + + 获取用户信息 + + + + + + 获取路由信息 + + + + + + 生成图片验证码 + + + + + + 获取菜单列表 √ + + + + + + 根据菜单编号获取详细信息 √ + + + + + + + 获取菜单下拉树列表(分配角色所需菜单) + + + + + + 获取角色菜单信息 + 加载对应角色菜单列表树 + + + + + + + 修改菜单 √ + + + + + + + 添加菜单 √ + + + + + + + 菜单删除 √ + + + + + + + 保存排序 + + + + + + + 岗位管理 + + + + + 岗位列表查询 + + + + + + 岗位查询 + + + + + + + 岗位管理 + + + + + + + 岗位管理 + + + + + + + 岗位删除 + + + + + + + 获取岗位选择框列表 + + + + + 岗位导出 + + + + + + 个人中心用户信息获取 + + + + + + 修改用户 + + + + + + 修改密码 + + + + + + 修改头像 + + + + + + 角色信息 + + + + + 获取系统角色管理 + + + + + + 根据角色编号获取详细信息 + + + + + + + 添加角色 √ + + + + + + + 修改角色 √ + + + + + + + 根据角色分配菜单 + + + + + + + 角色删除 √ + + + + + + + 修改角色状态 √ + + 角色对象 + + + + + 角色导出 + + + + + + 用户管理 -> 获取用户 + /system/user/list + + + + + + 用户管理 -> 编辑、添加用户获取用户,信息查询 + + + + + + + 添加用户 + + + + + + + 修改用户 + + + + + + + 改变用户状态 + + + + + + + 删除用户 + + + + + + + 重置密码 + + + + + + 用户导出 + + + + + + + 根据角色编号获取已分配的用户 + + + + + + + 添加角色用户 + + + + + + 删除角色用户 + + + + + + + 获取未分配用户角色 + + + + + + + 查询日志 + + + + + + + + 删除定时任务调用日志 + + + + + + + 清空日志 + + + + + + 定时任务日志导出 + + + + + + 计划任务 + + + + + 查询计划任务列表 + + + + + + 查询单个计划任务 + + 编码 + + + + + 添加任务 + + + + + + 更新任务 + + + + + + 删除任务 + + + + + + 启动任务 + + + + + + 停止任务 + + + + + + 定时任务立即执行一次 + + + + + + + 定时任务导出 + + + + + + 存储文件 + + + + + + + HttpContext扩展类 + + + + + 是否是ajax请求 + + + + + + + 获取客户端IP + + + + + + + 获取请求令牌 + + + + + + + 登录cookie写入 + + + + + + + + 定时任务扩展方法 + + + + + 程序启动后添加任务计划 + + + + + + + API授权判断 + + + + + 权限字符串,例如 system:user:view + + + + + 执行Action前校验是否有权限访问 + + + + + + + + OnActionExecuting是在Action执行之前运行的方法。 + + + + + + OnActionExecuted是在Action中的代码执行之后运行的方法。 + + + + + + 记录请求,输出日志 + + + + + OnActionExecuted是在Action中的代码执行之后运行的方法。 + + + + + + 设置请求参数 + + + + + + + 授权校验访问 + 如果跳过授权登录在Action 或controller加上 AllowAnonymousAttribute + + + + + 只判断token是否正确,不判断权限 + 如果需要判断权限的在Action上加上ApiActionPermission属性标识权限类别,ActionPermissionFilter作权限处理 + + + + + + 记录用户登陆信息 + + + + + + + + + 2020-11-20 + + + + + 获取用户身份信息 + + + + + + + 生成token + + + + + + + 从令牌中获取数据声明 + + 令牌 + + + + + jwt token校验 + + + + + + + + 注册Services服务 + + + + + From 6622ea12e99fcd58e0268a986f2963851c57ddb9 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, 5 Dec 2021 18:17:05 +0800 Subject: [PATCH 02/14] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=89=8D=E7=AB=AF?= =?UTF-8?q?=E5=BC=80=E5=8F=91=E7=8E=AF=E5=A2=83=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ZR.Admin.WebApi/build.bat | 2 +- ZR.Vue/.env.development | 2 +- ZR.Vue/.env.staging | 8 ++++++++ ZR.Vue/vue.config.js | 6 +++--- 4 files changed, 13 insertions(+), 5 deletions(-) create mode 100644 ZR.Vue/.env.staging diff --git a/ZR.Admin.WebApi/build.bat b/ZR.Admin.WebApi/build.bat index f3d0008..5aa4fb6 100644 --- a/ZR.Admin.WebApi/build.bat +++ b/ZR.Admin.WebApi/build.bat @@ -1,6 +1,6 @@ @echo off -docker build -t ZRAdmin:latest -f ./Dockerfile . +docker build -t ZRAdmin.NET:latest -f ./Dockerfile . echo "==============鿴===========" docker images diff --git a/ZR.Vue/.env.development b/ZR.Vue/.env.development index e4fd273..d7d1cf0 100644 --- a/ZR.Vue/.env.development +++ b/ZR.Vue/.env.development @@ -3,7 +3,7 @@ ENV = 'development' # ZR管理系统/开发环境 -VUE_APP_BASE_API = 'http://localhost:8888/' +VUE_APP_BASE_API = '/dev-api' # 路由前缀 VUE_APP_ROUTER_PREFIX = '/' diff --git a/ZR.Vue/.env.staging b/ZR.Vue/.env.staging new file mode 100644 index 0000000..184dcfe --- /dev/null +++ b/ZR.Vue/.env.staging @@ -0,0 +1,8 @@ +# 测试环境配置 +ENV = 'staging' + +# ZR管理系统/生产环境 +VUE_APP_BASE_API = '/stage-api' + +# 路由前缀 +VUE_APP_ROUTER_PREFIX = '/' diff --git a/ZR.Vue/vue.config.js b/ZR.Vue/vue.config.js index 4b9cde4..a366f0e 100644 --- a/ZR.Vue/vue.config.js +++ b/ZR.Vue/vue.config.js @@ -34,11 +34,11 @@ module.exports = { open: true, proxy: { // detail: https://cli.vuejs.org/config/#devserver-proxy - '/api': { - target: process.env.VUE_APP_BASE_API, + [process.env.VUE_APP_BASE_API]: { + target: 'http://localhost:8888/',// 后端接口地址 changeOrigin: true, pathRewrite: { - '^/api': ''//需要rewrite的 + ['^' + process.env.VUE_APP_BASE_API]: ''//需要rewrite的 } } }, From 013264da731bf3ff287761346c58562937c9d5cf 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, 5 Dec 2021 22:09:09 +0800 Subject: [PATCH 03/14] =?UTF-8?q?fix=20=E4=BB=A3=E7=A0=81=E7=94=9F?= =?UTF-8?q?=E6=88=90=E8=A1=A8=E6=97=A0=E4=B8=BB=E9=94=AE=E6=97=A0=E8=87=AA?= =?UTF-8?q?=E5=A2=9E=E6=97=B6controller=20=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ZR.CodeGenerator/CodeGeneratorTool.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ZR.CodeGenerator/CodeGeneratorTool.cs b/ZR.CodeGenerator/CodeGeneratorTool.cs index eadb973..9a0c7d6 100644 --- a/ZR.CodeGenerator/CodeGeneratorTool.cs +++ b/ZR.CodeGenerator/CodeGeneratorTool.cs @@ -46,7 +46,7 @@ namespace ZR.CodeGenerator /// public static void GenerateSingle(GenerateDto dto) { - string PKName = "id"; + string PKName = "Id"; string PKType = "int"; ReplaceDto replaceDto = new(); replaceDto.ModelTypeName = dto.GenTable.ClassName;//表名对应C# 实体类名 From 1e1a80b1a798731a0b1e80c64448b6124a9a0415 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: Mon, 6 Dec 2021 12:52:07 +0800 Subject: [PATCH 04/14] =?UTF-8?q?fix=20=E4=BB=A3=E7=A0=81=E7=94=9F?= =?UTF-8?q?=E6=88=90=E5=AF=BC=E5=85=A5=E4=B8=9A=E5=8A=A1=E5=90=8D=E6=88=AA?= =?UTF-8?q?=E5=8F=96bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ZR.CodeGenerator/CodeGeneratorTool.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ZR.CodeGenerator/CodeGeneratorTool.cs b/ZR.CodeGenerator/CodeGeneratorTool.cs index 9a0c7d6..f118b71 100644 --- a/ZR.CodeGenerator/CodeGeneratorTool.cs +++ b/ZR.CodeGenerator/CodeGeneratorTool.cs @@ -278,9 +278,10 @@ namespace ZR.CodeGenerator /// 业务名 public static string GetBusinessName(string tableName) { - int lastIndex = tableName.LastIndexOf("_"); + int lastIndex = tableName.LastIndexOf("_");//_前缀长度 int nameLength = tableName.Length; - string businessName = tableName[(nameLength - lastIndex + 1)..]; + int subLength = (nameLength - lastIndex) - 1; + string businessName = tableName[(lastIndex + 1)..];// tableName.Substring(lastIndex + 1, subLength); return businessName.ToLower(); } From d2c63d552e4a5f529819018c82038a5bff4cebad 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: Mon, 6 Dec 2021 12:52:33 +0800 Subject: [PATCH 05/14] =?UTF-8?q?fix=20vue=E6=B7=BB=E5=8A=A0=E3=80=81?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E8=A1=A8=E5=8D=95=E7=94=9F=E6=88=90bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ZR.CodeGenerator/CodeGenerateTemplate.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ZR.CodeGenerator/CodeGenerateTemplate.cs b/ZR.CodeGenerator/CodeGenerateTemplate.cs index ddb9f7e..5f9fae9 100644 --- a/ZR.CodeGenerator/CodeGenerateTemplate.cs +++ b/ZR.CodeGenerator/CodeGenerateTemplate.cs @@ -78,7 +78,7 @@ namespace ZR.CodeGenerator { return sb.ToString(); } - if (!dbFieldInfo.IsInsert || !dbFieldInfo.IsEdit) + if (!dbFieldInfo.IsInsert && !dbFieldInfo.IsEdit) { return sb.ToString(); } @@ -187,7 +187,7 @@ namespace ZR.CodeGenerator if (!dbFieldInfo.IsQuery || dbFieldInfo.HtmlType == GenConstants.HTML_FILE_UPLOAD) return sb.ToString(); if (dbFieldInfo.HtmlType == GenConstants.HTML_DATETIME) { - sb.AppendLine(" "); + sb.AppendLine($" "); sb.AppendLine(" "); sb.AppendLine(" "); From 0e70896fa45edb4e6ac3a0bc3386af8cc03e4d52 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: Mon, 6 Dec 2021 12:54:53 +0800 Subject: [PATCH 06/14] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E7=94=9F=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/System/ArticleController.cs | 2 +- .../Extensions/SwaggerExtension.cs | 15 +- ZR.Admin.WebApi/Startup.cs | 19 +- ZR.Admin.WebApi/ZRAdmin.xml | 254 ++++++++---------- ZR.Admin.WebApi/appsettings.json | 2 +- .../CodeGenTemplate/TplControllers.txt | 32 ++- .../wwwroot/CodeGenTemplate/TplVue.txt | 2 +- ZR.Vue/src/views/tool/gen/genInfoForm.vue | 2 +- 8 files changed, 150 insertions(+), 178 deletions(-) diff --git a/ZR.Admin.WebApi/Controllers/System/ArticleController.cs b/ZR.Admin.WebApi/Controllers/System/ArticleController.cs index 6c993d3..c6f9ce9 100644 --- a/ZR.Admin.WebApi/Controllers/System/ArticleController.cs +++ b/ZR.Admin.WebApi/Controllers/System/ArticleController.cs @@ -16,7 +16,7 @@ using System; namespace ZR.Admin.WebApi.Controllers { /// - /// T4代码自动生成 + /// 文章管理 /// [Verify] [Route("article")] diff --git a/ZR.Admin.WebApi/Extensions/SwaggerExtension.cs b/ZR.Admin.WebApi/Extensions/SwaggerExtension.cs index 40f9d49..31042e7 100644 --- a/ZR.Admin.WebApi/Extensions/SwaggerExtension.cs +++ b/ZR.Admin.WebApi/Extensions/SwaggerExtension.cs @@ -27,11 +27,16 @@ namespace ZR.Admin.WebApi.Extensions Version = "v1", Description = "", }); - //if (CurrentEnvironment.IsDevelopment()) - //{ - //添加文档注释 - c.IncludeXmlComments(Path.Combine(hostEnvironment.ContentRootPath, "ZRAdmin.xml"), true); - //} + try + { + //添加文档注释 + c.IncludeXmlComments(Path.Combine(hostEnvironment.ContentRootPath, "ZRAdmin.xml"), true); + } + catch (Exception ex) + { + Console.WriteLine("swagger 文档加载失败" + ex.Message); + } + //参考文章:http://www.zyiz.net/tech/detail-134965.html //需要安装包Swashbuckle.AspNetCore.Filters // 开启权限小锁 需要在对应的Action上添加[Authorize]才能看到 diff --git a/ZR.Admin.WebApi/Startup.cs b/ZR.Admin.WebApi/Startup.cs index 7e334ba..e8b4b86 100644 --- a/ZR.Admin.WebApi/Startup.cs +++ b/ZR.Admin.WebApi/Startup.cs @@ -32,7 +32,7 @@ namespace ZR.Admin.WebApi Configuration = configuration; CurrentEnvironment = hostEnvironment; } - + private NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger(); private IWebHostEnvironment CurrentEnvironment { get; } public IConfiguration Configuration { get; } public void ConfigureServices(IServiceCollection services) @@ -167,13 +167,14 @@ namespace ZR.Admin.WebApi }); //ʽ ӡSQL - DbScoped.SugarScope.GetConnection("0").Aop.OnLogExecuting = (sql, pars) => + DbScoped.SugarScope.GetConnection(0).Aop.OnLogExecuting = (sql, pars) => { - Console.WriteLine("SQL䡿" + sql.ToLower() + "\r\n" - + DbScoped.SugarScope.Utilities.SerializeObject(pars.ToDictionary(it => it.ParameterName, it => it.Value))); + var param = DbScoped.SugarScope.Utilities.SerializeObject(pars.ToDictionary(it => it.ParameterName, it => it.Value)); + //Console.WriteLine("SQL䡿" + sql.ToLower() + "\r\n" + param); + logger.Info($"Sql䣺{sql}{param}"); }; //ӡ־ - DbScoped.SugarScope.GetConnection("0").Aop.OnError = (e) => + DbScoped.SugarScope.GetConnection(0).Aop.OnError = (e) => { Console.WriteLine($"[ִSql]{e.Message}SQL={e.Sql}"); Console.WriteLine(); @@ -182,14 +183,14 @@ namespace ZR.Admin.WebApi //ʽ ӡSQL DbScoped.SugarScope.GetConnection(1).Aop.OnLogExecuting = (sql, pars) => { - Console.WriteLine("SQLBus" + sql.ToLower() + "\r\n" - + DbScoped.SugarScope.Utilities.SerializeObject(pars.ToDictionary(it => it.ParameterName, it => it.Value))); + var param = DbScoped.SugarScope.Utilities.SerializeObject(pars.ToDictionary(it => it.ParameterName, it => it.Value)); + //Console.WriteLine("SQLBus" + sql.ToLower() + "\r\n" + param); + logger.Info($"Sql䣺{sql}, {param}"); }; //Bus Db־ DbScoped.SugarScope.GetConnection(1).Aop.OnError = (e) => { - Console.WriteLine($"[ִSqlBus]{e.Message}SQL={e.Sql}"); - Console.WriteLine(); + logger.Error($"ִSqlʧܣ{e.Sql}ԭ{e.Message}"); }; } } diff --git a/ZR.Admin.WebApi/ZRAdmin.xml b/ZR.Admin.WebApi/ZRAdmin.xml index a7cb591..30d4241 100644 --- a/ZR.Admin.WebApi/ZRAdmin.xml +++ b/ZR.Admin.WebApi/ZRAdmin.xml @@ -36,148 +36,38 @@ - - - 代码生成演示Controller - - @author zr - @date 2021-11-24 - - - + - 代码生成演示接口 + 公共模块 - - - 查询代码生成演示列表 - - - - - - 查询代码生成演示详情 - - - - - - - 添加代码生成演示 - - - - - - 更新代码生成演示 - - - - - - 删除代码生成演示 - - - - - - 代码生成 - - - - - 获取所有数据库的信息 - - - - - - 获取所有表根据数据名 - - 数据库名 - 表名 - 分页信息 - - - - - 代码生成器 - - 数据传输对象 - - - - - 获取代码生成表列表 - - 表名 - 分页信息 - - - - - 查询表字段列表 - - genTable表id - - - - - 删除代码生成 - - - - - - - 导入表结构(保存) - - - - - - - - 修改保存代码生成业务 - - 请求参数实体 - - - - - 预览代码 - - - - - + 心跳 - - - 加密 - - - - - - - 解密 - - - - - + 发送邮件 请求参数接收实体 + + + 存储文件 + + + + + + + 存储文件到阿里云 + + + + T4代码自动生成 @@ -231,6 +121,77 @@ + + + 代码生成 + + + + + 获取所有数据库的信息 + + + + + + 获取所有表根据数据名 + + 数据库名 + 表名 + 分页信息 + + + + + 获取代码生成表列表 + + 表名 + 分页信息 + + + + + 查询表字段列表 + + genTable表id + + + + + 删除代码生成 + + + + + + + 导入表结构(保存) + + + + + + + + 修改保存代码生成业务 + + 请求参数实体 + + + + + 预览代码 + + + + + + + 生成代码(下载方式) + + 数据传输对象 + + 获取缓存监控数据 @@ -663,6 +624,7 @@ 修改头像 + @@ -894,13 +856,6 @@ - - - 存储文件 - - - - HttpContext扩展类 @@ -920,6 +875,13 @@ + + + ClaimsIdentity + + + + 获取请求令牌 @@ -927,13 +889,13 @@ - - - 登录cookie写入 - - - - + + + 组装Claims + + + + @@ -1036,6 +998,12 @@ + + + 验证Token + + + 从令牌中获取数据声明 @@ -1051,7 +1019,7 @@ - + 注册Services服务 diff --git a/ZR.Admin.WebApi/appsettings.json b/ZR.Admin.WebApi/appsettings.json index b8dcce0..bd00d8f 100644 --- a/ZR.Admin.WebApi/appsettings.json +++ b/ZR.Admin.WebApi/appsettings.json @@ -15,7 +15,7 @@ "urls": "http://localhost:8888", //Ŀurl "sysConfig": { "DBCommandTimeout": 10, - "cors": "http://localhost:8887" //ַ"," + "cors": "http://localhost:8887" //ַǰĿ"," }, "JwtSettings": { "Issuer": "https://localhost:8888", diff --git a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplControllers.txt b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplControllers.txt index 8d53e48..a5ffedf 100644 --- a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplControllers.txt +++ b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplControllers.txt @@ -160,25 +160,23 @@ ${end} string sFileName = ExportExcel(list, "${replaceDto.ModelTypeName}", "${genTable.FunctionName}"); return SUCCESS(new { path = "/export/" + sFileName, fileName = sFileName }); } - $if(genTable.SortField != "") - /// - /// 保存排序 - /// - /// - /// - /// - [ActionPermissionFilter(Permission = "${replaceDto.PermissionPrefix}:update")] - [HttpGet("ChangeSort")] - [Log(Title = "保存排序", BusinessType = BusinessType.UPDATE)] - public IActionResult ChangeSort(int id = 0, int orderNum = 0) - { - if (id <= 0) { return ToResponse(ApiResult.Error(101, "请求参数错误")); } - - bool result = _${replaceDto.ModelTypeName}Service.Update(w => w.${replaceDto.PKName} == id, it => new ${replaceDto.ModelTypeName}() { ${genTable.SortField} = orderNum });; + ////// + ////// 代码自动生成(不用可删除) 保存排序 + ////// + ////// + ////// + ////// + ///[ActionPermissionFilter(Permission = "${replaceDto.PermissionPrefix}:update")] + ///[HttpGet("ChangeSort")] + //[Log(Title = "保存排序", BusinessType = BusinessType.UPDATE)] + //public IActionResult ChangeSort(int id = 0, int orderNum = 0) + //{ + // if (id <= 0) { return ToResponse(ApiResult.Error(101, "请求参数错误")); } + // bool result = _${replaceDto.ModelTypeName}Service.Update(w => w.${replaceDto.PKName} == id, it => new ${replaceDto.ModelTypeName}() { ${genTable.SortField} = orderNum });; - return SUCCESS(result); - } + // return SUCCESS(result); + //} $end } } \ No newline at end of file diff --git a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplVue.txt b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplVue.txt index 32197e9..49fc6e6 100644 --- a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplVue.txt +++ b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplVue.txt @@ -20,7 +20,7 @@ ${vueQueryFormHtml} 删除 -$if(genTable.SortField != "") +$if(genTable.SortField != "" && 1 == 2) 修改排序 diff --git a/ZR.Vue/src/views/tool/gen/genInfoForm.vue b/ZR.Vue/src/views/tool/gen/genInfoForm.vue index 1d48727..54ff5f5 100644 --- a/ZR.Vue/src/views/tool/gen/genInfoForm.vue +++ b/ZR.Vue/src/views/tool/gen/genInfoForm.vue @@ -75,7 +75,7 @@ - 排序字段 + 查询排序字段 From b2abc465cf21c96ac4486a0c9c2313e8d6e18d03 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: Mon, 6 Dec 2021 13:28:12 +0800 Subject: [PATCH 07/14] =?UTF-8?q?fix=20=E6=96=B0=E5=A2=9E=E9=AA=8C?= =?UTF-8?q?=E8=AF=81=E7=A0=81=E5=BC=80=E5=85=B3=E4=B8=8D=E5=85=BC=E5=AE=B9?= =?UTF-8?q?=E8=80=81=E7=89=88=E6=9C=ACbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ZR.Admin.WebApi/Controllers/System/SysLoginController.cs | 8 +++++--- ZR.Admin.WebApi/ZRAdmin.xml | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ZR.Admin.WebApi/Controllers/System/SysLoginController.cs b/ZR.Admin.WebApi/Controllers/System/SysLoginController.cs index 6687616..1e07704 100644 --- a/ZR.Admin.WebApi/Controllers/System/SysLoginController.cs +++ b/ZR.Admin.WebApi/Controllers/System/SysLoginController.cs @@ -143,17 +143,19 @@ namespace ZR.Admin.WebApi.Controllers.System string uuid = Guid.NewGuid().ToString().Replace("-", ""); SysConfig sysConfig = sysConfigService.GetSysConfigByKey("sys.account.captchaOnOff"); + var captchaOff = sysConfig?.ConfigValue ?? "0"; + var code = SecurityCodeHelper.GetRandomEnDigitalText(4); byte[] imgByte; - if (sysConfig.ConfigValue == "1") + if (captchaOff == "1") { imgByte = SecurityCodeHelper.GetGifEnDigitalCodeByte(code);//动态gif数字字母 } - else if (sysConfig.ConfigValue == "2") + else if (captchaOff == "2") { imgByte = SecurityCodeHelper.GetGifBubbleCodeByte(code);//动态gif泡泡 } - else if (sysConfig.ConfigValue == "3") + else if (captchaOff == "3") { imgByte = SecurityCodeHelper.GetBubbleCodeByte(code);//泡泡 } diff --git a/ZR.Admin.WebApi/ZRAdmin.xml b/ZR.Admin.WebApi/ZRAdmin.xml index 30d4241..69d5491 100644 --- a/ZR.Admin.WebApi/ZRAdmin.xml +++ b/ZR.Admin.WebApi/ZRAdmin.xml @@ -70,7 +70,7 @@ - T4代码自动生成 + 文章管理 From 54a8c7f783fd548314858f9c53316ed35e2a07fc 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: Mon, 6 Dec 2021 13:30:44 +0800 Subject: [PATCH 08/14] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E7=94=9F=E6=88=90=E6=9F=A5=E8=AF=A2=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ZR.CodeGenerator/CodeGenerateTemplate.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ZR.CodeGenerator/CodeGenerateTemplate.cs b/ZR.CodeGenerator/CodeGenerateTemplate.cs index 5f9fae9..38db3e1 100644 --- a/ZR.CodeGenerator/CodeGenerateTemplate.cs +++ b/ZR.CodeGenerator/CodeGenerateTemplate.cs @@ -229,7 +229,7 @@ namespace ZR.CodeGenerator //有排序字段 if (!string.IsNullOrEmpty(genTable?.SortField.ToString()) && genTable?.SortField.ToString() == dbFieldInfo.CsharpField) { - sb.AppendLine($@" "); + sb.AppendLine($@" "); sb.AppendLine(@"