From db9ce695949bdf1bdf7bae9dd455bba1e14e3a2b Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 3 Aug 2023 11:48:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BC=95=E7=94=A8=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/ExtraController.cs | 3 - IRaCIS.Core.API/IRaCIS.Core.API.csproj | 10 -- IRaCIS.Core.API/IRaCIS.Core.API.xml | 108 ------------------ .../Hangfire/HangfireConfig.cs | 40 ------- .../Hangfire/hangfireAuthorizationFilter.cs | 17 --- .../Serilog/SerilogConfig.cs | 4 +- .../_ServiceExtensions/hangfireSetup.cs | 39 ------- 7 files changed, 1 insertion(+), 220 deletions(-) delete mode 100644 IRaCIS.Core.API/_PipelineExtensions/Hangfire/HangfireConfig.cs delete mode 100644 IRaCIS.Core.API/_PipelineExtensions/Hangfire/hangfireAuthorizationFilter.cs delete mode 100644 IRaCIS.Core.API/_ServiceExtensions/hangfireSetup.cs diff --git a/IRaCIS.Core.API/Controllers/ExtraController.cs b/IRaCIS.Core.API/Controllers/ExtraController.cs index a7e0c5e45..73f85eb32 100644 --- a/IRaCIS.Core.API/Controllers/ExtraController.cs +++ b/IRaCIS.Core.API/Controllers/ExtraController.cs @@ -1,9 +1,6 @@ using System; using System.Net.Http; using EasyCaching.Core; -using gRPC.ZHiZHUN.AuthServer.protos; -using Grpc.Net.Client; -using Grpc.Net.Client.Configuration; using IRaCIS.Application.Interfaces; using IRaCIS.Application.Contracts; using IRaCIS.Core.Application.Auth; diff --git a/IRaCIS.Core.API/IRaCIS.Core.API.csproj b/IRaCIS.Core.API/IRaCIS.Core.API.csproj index 65b1434e0..4b04686c8 100644 --- a/IRaCIS.Core.API/IRaCIS.Core.API.csproj +++ b/IRaCIS.Core.API/IRaCIS.Core.API.csproj @@ -72,16 +72,6 @@ - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - true - - diff --git a/IRaCIS.Core.API/IRaCIS.Core.API.xml b/IRaCIS.Core.API/IRaCIS.Core.API.xml index 659916ddf..430c4af5f 100644 --- a/IRaCIS.Core.API/IRaCIS.Core.API.xml +++ b/IRaCIS.Core.API/IRaCIS.Core.API.xml @@ -401,113 +401,5 @@ - - Holder for reflection information generated from Protos/GrpcToken.proto - - - File descriptor for Protos/GrpcToken.proto - - - - 新增用户时需要传递数据消息, 可理解为一个类 - - - - Field number for the "id" field. - - - Field number for the "userName" field. - - - Field number for the "realName" field. - - - Field number for the "reviewerCode" field. - - - Field number for the "userTypeEnumInt" field. - - - Field number for the "userTypeShortName" field. - - - Field number for the "isAdmin" field. - - - - 新增时返回的消息格式 - - - - Field number for the "code" field. - - - Field number for the "token" field. - - - - service 用标识定义服务的,里面写对应的方法 - - - - Service descriptor - - - Client for TokenGrpcService - - - Creates a new client for TokenGrpcService - The channel to use to make remote calls. - - - Creates a new client for TokenGrpcService that uses a custom CallInvoker. - The callInvoker to use to make remote calls. - - - Protected parameterless constructor to allow creation of test doubles. - - - Protected constructor to allow creation of configured clients. - The client configuration. - - - - 获取token - - The request to send to the server. - The initial metadata to send with the call. This parameter is optional. - An optional deadline for the call. The call will be cancelled if deadline is hit. - An optional token for canceling the call. - The response received from the server. - - - - 获取token - - The request to send to the server. - The options for the call. - The response received from the server. - - - - 获取token - - The request to send to the server. - The initial metadata to send with the call. This parameter is optional. - An optional deadline for the call. The call will be cancelled if deadline is hit. - An optional token for canceling the call. - The call object. - - - - 获取token - - The request to send to the server. - The options for the call. - The call object. - - - Creates a new instance of client from given ClientBaseConfiguration. - diff --git a/IRaCIS.Core.API/_PipelineExtensions/Hangfire/HangfireConfig.cs b/IRaCIS.Core.API/_PipelineExtensions/Hangfire/HangfireConfig.cs deleted file mode 100644 index 48423534d..000000000 --- a/IRaCIS.Core.API/_PipelineExtensions/Hangfire/HangfireConfig.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Hangfire; -using Hangfire.Dashboard; -using IRaCIS.Application.Services.BackGroundJob; -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Hosting; - -namespace IRaCIS.Core.API -{ - - - public static class HangfireConfig - { - - public static void UseHangfireConfig(this IApplicationBuilder app, IWebHostEnvironment env) - { - app.UseHangfireDashboard("/api/hangfire", new DashboardOptions() - { - //直接访问,没有带token 获取不到用户身份信息,所以这种自定义授权暂时没法使用 - //Authorization = new[] { new hangfireAuthorizationFilter() } - - //本地请求 才能看 - Authorization = new[] { new LocalRequestsOnlyAuthorizationFilter() } - - }); - - #region hangfire - //// 延迟任务执行 1秒之后执行 有时启动没运行 换成添加到队列中 - //BackgroundJob.Schedule(t => t.MemoryCacheTrialStatus(), TimeSpan.FromSeconds(1)); - ////添加到后台任务队列, - //BackgroundJob.Enqueue(t => t.MemoryCacheTrialStatus()); - - //周期性任务,1天执行一次 - - RecurringJob.AddOrUpdate(t => t.ProjectStartCache(), Cron.Daily); - - #endregion - - } - } -} diff --git a/IRaCIS.Core.API/_PipelineExtensions/Hangfire/hangfireAuthorizationFilter.cs b/IRaCIS.Core.API/_PipelineExtensions/Hangfire/hangfireAuthorizationFilter.cs deleted file mode 100644 index 707b55234..000000000 --- a/IRaCIS.Core.API/_PipelineExtensions/Hangfire/hangfireAuthorizationFilter.cs +++ /dev/null @@ -1,17 +0,0 @@ -using Hangfire.Dashboard; - -namespace IRaCIS.Core.API.Filter -{ - public class hangfireAuthorizationFilter : IDashboardAuthorizationFilter - { - public bool Authorize(DashboardContext context) - { - var httpContext = context.GetHttpContext(); - - // Allow all authenticated users to see the Dashboard (potentially dangerous). - return httpContext.User.Identity.IsAuthenticated; - - //return true; - } - } -} \ No newline at end of file diff --git a/IRaCIS.Core.API/_PipelineExtensions/Serilog/SerilogConfig.cs b/IRaCIS.Core.API/_PipelineExtensions/Serilog/SerilogConfig.cs index c5aab64f1..c5af7adbe 100644 --- a/IRaCIS.Core.API/_PipelineExtensions/Serilog/SerilogConfig.cs +++ b/IRaCIS.Core.API/_PipelineExtensions/Serilog/SerilogConfig.cs @@ -1,6 +1,4 @@ -using Hangfire; -using Hangfire.Dashboard; -using IRaCIS.Core.API._PipelineExtensions.Serilog; +using IRaCIS.Core.API._PipelineExtensions.Serilog; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Serilog; diff --git a/IRaCIS.Core.API/_ServiceExtensions/hangfireSetup.cs b/IRaCIS.Core.API/_ServiceExtensions/hangfireSetup.cs deleted file mode 100644 index a5dd1fc09..000000000 --- a/IRaCIS.Core.API/_ServiceExtensions/hangfireSetup.cs +++ /dev/null @@ -1,39 +0,0 @@ -using Hangfire; -using Hangfire.SqlServer; -using Hangfire.Tags.SqlServer; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using System; - -namespace IRaCIS.Core.API -{ - public static class hangfireSetup - { - public static void AddhangfireSetup(this IServiceCollection services, IConfiguration configuration) - { - var hangFireConnStr = configuration.GetSection("ConnectionStrings:Hangfire").Value; - - services.AddHangfire(hangFireConfig => - { - //指定存储介质 - hangFireConfig.UseSqlServerStorage(hangFireConnStr, new SqlServerStorageOptions() - { - SchemaName = "hangfire", - CommandBatchMaxTimeout = TimeSpan.FromMinutes(5), - SlidingInvisibilityTimeout = TimeSpan.FromMinutes(5), - QueuePollInterval = TimeSpan.Zero, - UseRecommendedIsolationLevel = true, - UsePageLocksOnDequeue = true, - DisableGlobalLocks = true - }); - - hangFireConfig.UseTagsWithSql(); //nuget引入Hangfire.Tags.SqlServer - //.UseHangfireHttpJob(); - - }); - - services.AddHangfireServer(); - - } - } -}