diff --git a/.gitee/ISSUE_TEMPLATE/config.yaml b/.gitee/ISSUE_TEMPLATE/config.yaml new file mode 100644 index 0000000000000000000000000000000000000000..a8c7ac62811cf0884139e043b8007280fb72520e --- /dev/null +++ b/.gitee/ISSUE_TEMPLATE/config.yaml @@ -0,0 +1,82 @@ +name: 问题反馈 +description: 当你在代码中发现了一个 Bug,导致应用崩溃或抛出异常,或者有一个组件存在问题,或者某些地方看起来不对劲。 +title: "[Bug]: " +labels: ["bug"] +body: + - type: markdown + attributes: + value: | + 感谢对项目的支持与关注。在提出问题之前,请确保你已查看相关开发或使用文档: + - http://www.izhaorui.cn/doc + - type: checkboxes + attributes: + label: 这个问题是否已经存在? + options: + - label: 我已经搜索过现有的问题 (https://gitee.com/../../issues) + required: true + - type: textarea + attributes: + label: 如何复现 + description: 请详细告诉我们如何复现你遇到的问题,如涉及代码,可提供一个最小代码示例,并使用反引号```附上它 + placeholder: | + 1. ... + 2. ... + 3. ... + validations: + required: true + - type: textarea + attributes: + label: 预期结果 + description: 请告诉我们你预期会发生什么。 + validations: + required: false + - type: textarea + attributes: + label: 实际结果 + description: 请告诉我们实际发生了什么。 + validations: + required: false + - type: textarea + attributes: + label: 截图或视频 + description: 如果可以的话,上传任何关于 bug 的截图。 + value: | + [在这里上传图片] + - type: dropdown + id: version + attributes: + label: vue版本 + description: 你当前正在使用我们软件的哪个前端版本 + options: + - vue3 (默认) + - vue2 + validations: + required: true + - type: dropdown + id: version + attributes: + label: 运行环境 + options: + - 开发环境 (development) + - 生产环境(production) + validations: + required: true + - type: dropdown + id: version + attributes: + label: 应用程序托管 + options: + - 前端iis + 后端iis + - 前端nginx + 后端 iis + - 前端nginx + 后端自启动 + - docker + - 其他 + validations: + required: true +contact_links: + - name: 使用文档 + url: http://www.izhaorui.cn/doc/ + about: 官方文档 + - name: ♥️ VIP 服务 ♥️ + url: https://www.izhaorui.cn/doc/support.html + about: 支持作者 \ No newline at end of file diff --git a/.gitee/ISSUE_TEMPLATE/feature.yaml b/.gitee/ISSUE_TEMPLATE/feature.yaml new file mode 100644 index 0000000000000000000000000000000000000000..7828cb6666238d19f6466d75a5ab546d78aace9b --- /dev/null +++ b/.gitee/ISSUE_TEMPLATE/feature.yaml @@ -0,0 +1,13 @@ +name: 功能建议 +description: 对本项目提出一个功能建议 +title: "[功能建议]: " +labels: ["enhancement"] +body: + - type: markdown + attributes: + value: | + 感谢对项目的支持与关注。如果你在使用中有什么好的建议欢迎提出来 + - type: textarea + attributes: + label: 请输入内容 + description: 如果可以的话,上传任何关于 功能 的截图。 \ No newline at end of file diff --git a/Infrastructure/ZR.Infrastructure.csproj b/Infrastructure/ZR.Infrastructure.csproj index e54e04ac0030b6002e0320bf72e47bd9cfec8469..63a8cafa19edf91430de51208057892a6793e540 100644 --- a/Infrastructure/ZR.Infrastructure.csproj +++ b/Infrastructure/ZR.Infrastructure.csproj @@ -17,7 +17,7 @@ - + diff --git a/ZR.CodeGenerator/ZR.CodeGenerator.csproj b/ZR.CodeGenerator/ZR.CodeGenerator.csproj index 846d34c00f8c8cda0c47c4b923e4a46fff4eacfa..25dea25b0b0ebec05ce7d2395dc2e4282b44f1ac 100644 --- a/ZR.CodeGenerator/ZR.CodeGenerator.csproj +++ b/ZR.CodeGenerator/ZR.CodeGenerator.csproj @@ -11,7 +11,7 @@ - + diff --git a/ZR.Tasks/TaskScheduler/JobBase.cs b/ZR.Tasks/TaskScheduler/JobBase.cs index 11c100188079cc352da7ca47dde48914aa3bbed0..01fd43f0bbe058cad621bc3dc4ee18f8c8bcc61d 100644 --- a/ZR.Tasks/TaskScheduler/JobBase.cs +++ b/ZR.Tasks/TaskScheduler/JobBase.cs @@ -1,4 +1,4 @@ -using Infrastructure; +using Infrastructure; using NLog; using Quartz; using System; @@ -62,6 +62,51 @@ namespace ZR.Tasks return logModel; } + /// + /// 执行指定任务(接收返回结果) + /// + /// 作业上下文 + /// 业务逻辑方法 + public async Task ExecuteJob(IJobExecutionContext context, Func> job) + { + double elapsed = 0; + int status = 0; + string logMsg; + try + { + //var s = context.Trigger.Key.Name; + //记录Job时间 + Stopwatch stopwatch = new Stopwatch(); + stopwatch.Start(); + //执行任,并返回结果 + string result = await job(); + stopwatch.Stop(); + elapsed = stopwatch.Elapsed.TotalMilliseconds; + logMsg = result.Length <= 2000 ? result : result.Substring(0, 2000); + } + catch (Exception ex) + { + JobExecutionException e2 = new(ex) + { + //true 是立即重新执行任务 + RefireImmediately = true + }; + status = 1; + logMsg = $"Job Run Fail,Exception:{ex.Message}"; + WxNoticeHelper.SendMsg("任务执行出错", logMsg); + } + + var logModel = new SysTasksLog() + { + Elapsed = elapsed, + Status = status.ToString(), + JobMessage = logMsg + }; + + await RecordTaskLog(context, logModel); + return logModel; + } + /// /// 记录到日志 /// diff --git a/ZR.Tasks/TaskScheduler/Job_SyncTest.cs b/ZR.Tasks/TaskScheduler/Job_SyncTest.cs index 5494c43fa76d1fc530dc418c706e27f70d018893..0218743d5287ece49e084f428328359c0c541922 100644 --- a/ZR.Tasks/TaskScheduler/Job_SyncTest.cs +++ b/ZR.Tasks/TaskScheduler/Job_SyncTest.cs @@ -1,4 +1,4 @@ -using Infrastructure.Attribute; +using Infrastructure.Attribute; using Quartz; using System.Threading.Tasks; @@ -15,7 +15,7 @@ namespace ZR.Tasks.TaskScheduler public async Task Execute(IJobExecutionContext context) { - await ExecuteJob(context, async () => await Run()); + await ExecuteJob(context, Run); } public async Task Run()