From d97ef84b7e0fa6d0e87c355675383c4c717300d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=B7=B3?= Date: Tue, 29 Nov 2022 12:34:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4hangfire=EF=BC=88=E4=B8=8D?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E6=AF=AB=E7=A7=92=E7=BA=A7=E5=88=AB=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 49a9eb54600aba0a1be2583e97431a87442c50e5. --- README.md | 1 - .../Config/SwaggerDoc.xml | 12 --------- .../Controllers/TestController.cs | 27 ------------------- .../Yi.Framework.ApiMicroservice/Program.cs | 14 ---------- .../Yi.Framework.Task/HttpJob.cs | 24 ----------------- 5 files changed, 78 deletions(-) diff --git a/README.md b/README.md index b3cf2f69..56d1079d 100644 --- a/README.md +++ b/README.md @@ -161,7 +161,6 @@ WebFirst开发:所有代码生成器已经配置完成,无需任何操作数 - [x] 支持`数据权限` - [x] 支持 太多了忘了 - **** ### 目录结构: diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/SwaggerDoc.xml b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/SwaggerDoc.xml index 0431a866..726f6ee9 100644 --- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/SwaggerDoc.xml +++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/SwaggerDoc.xml @@ -602,18 +602,6 @@ - - - hangfireJob测试 - - - - - - hangfireJob测试 - - - 树形结构构建测试 diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/TestController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/TestController.cs index 5d53e956..0d1e30ad 100644 --- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/TestController.cs +++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/TestController.cs @@ -221,33 +221,6 @@ namespace Yi.Framework.ApiMicroservice.Controllers return Result.Success("http://localhost:19001/hangfire"); } - /// - /// hangfireJob测试 - /// - /// - [HttpGet] - public Result HangfireStratJobTest() - { - Dictionary data = new Dictionary() - { - {JobConst.method,"get" }, - {JobConst.url,"https://www.baidu.com" } - }; - RecurringJob.AddOrUpdate(nameof(HttpJob),(Job)=>Job.Execute2(data), "*/5 * * * * ?"); - return Result.Success("http://localhost:19001/hangfire"); - } - /// - /// hangfireJob测试 - /// - /// - [HttpGet] - public Result HangfireStopJobTest() - { - RecurringJob.RemoveIfExists(nameof(HttpJob)); - return Result.Success(); - } - - /// /// 树形结构构建测试 /// diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Program.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Program.cs index ce453b9e..bd4402c8 100644 --- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Program.cs +++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Program.cs @@ -80,15 +80,6 @@ builder.Services.AddSqlsugarServer(DbFiterExtend.Data); //Quartz #endregion builder.Services.AddQuartzService(); -builder.Services.AddHangfire(option => -{ - option.SetDataCompatibilityLevel(CompatibilityLevel.Version_170);//ȫüݰ汾¼ - option.UseColouredConsoleLogProvider();//־ - option.UseSimpleAssemblyNameTypeSerializer();//ʹü򵥳л - option.UseRecommendedSerializerSettings();//ʹƼл - option.UseMemoryStorage(); -}); -builder.Services.AddHangfireServer(); #region //AutoMapperע #endregion @@ -240,10 +231,6 @@ app.UseDbSeedInitService(); #endregion app.UseRedisSeedInitService(); -app.UseHangfireDashboard(); - - - app.UseEndpoints(endpoints => { #region @@ -251,7 +238,6 @@ app.UseEndpoints(endpoints => #endregion endpoints.MapHub("/api/hub/main"); endpoints.MapControllers(); - endpoints.MapHangfireDashboard(); }); //׼Ӷ⻧ diff --git a/Yi.Framework.Net6/Yi.Framework.Task/HttpJob.cs b/Yi.Framework.Net6/Yi.Framework.Task/HttpJob.cs index 1af9aa0f..9e7c102c 100644 --- a/Yi.Framework.Net6/Yi.Framework.Task/HttpJob.cs +++ b/Yi.Framework.Net6/Yi.Framework.Task/HttpJob.cs @@ -36,30 +36,6 @@ namespace Yi.Framework.Job } - _logger.LogWarning("定时任务开始调度:" + nameof(HttpJob) + ":" + DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss") + $":访问地址为:{url},结果为:{data}"); - Console.WriteLine($"结果:{data}"); - }); - } - - public Task Execute2(Dictionary dic) - { - return Task.Run(async () => - { - //var jobData = context.JobDetail.JobDataMap; - string method = dic[Common.Const.JobConst.method].ToString(); - string url = dic[Common.Const.JobConst.url].ToString(); - string data = "异常!"; - switch (method) - { - case "post": - data = await Common.Helper.HttpHelper.Post(url); - break; - case "get": - data = await Common.Helper.HttpHelper.Get(url); - break; - } - - _logger.LogWarning("定时任务开始调度:" + nameof(HttpJob) + ":" + DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss") + $":访问地址为:{url},结果为:{data}"); Console.WriteLine($"结果:{data}"); });