feat: 完成job模块优化

This commit is contained in:
橙子
2025-02-23 01:31:30 +08:00
parent f8a4c737ee
commit f6b19ec2a5
20 changed files with 40 additions and 66 deletions

View File

@@ -3,7 +3,6 @@
<ItemGroup>
<ProjectReference Include="..\..\..\framework\Yi.Framework.BackgroundWorkers.Hangfire\Yi.Framework.BackgroundWorkers.Hangfire.csproj" />
<ProjectReference Include="..\..\..\framework\Yi.Framework.Ddd.Application\Yi.Framework.Ddd.Application.csproj" />
<ProjectReference Include="..\Yi.Framework.DigitalCollectibles.Application.Contracts\Yi.Framework.DigitalCollectibles.Application.Contracts.csproj" />

View File

@@ -18,7 +18,6 @@
<ProjectReference Include="..\..\..\framework\Yi.Framework.Ddd.Application\Yi.Framework.Ddd.Application.csproj" />
<ProjectReference Include="..\Yi.Framework.Rbac.Application.Contracts\Yi.Framework.Rbac.Application.Contracts.csproj" />
<ProjectReference Include="..\Yi.Framework.Rbac.Domain\Yi.Framework.Rbac.Domain.csproj" />
<ProjectReference Include="..\..\..\framework\Yi.Framework.BackgroundWorkers.Hangfire\Yi.Framework.BackgroundWorkers.Hangfire.csproj" />
</ItemGroup>
</Project>

View File

@@ -1,12 +1,7 @@
using Lazy.Captcha.Core.Generator;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp;
using Volo.Abp.BackgroundWorkers;
using Volo.Abp.BackgroundWorkers.Hangfire;
using Volo.Abp.Modularity;
using Yi.Framework.Ddd.Application;
using Yi.Framework.Rbac.Application.Contracts;
using Yi.Framework.Rbac.Application.Jobs;
using Yi.Framework.Rbac.Domain;
namespace Yi.Framework.Rbac.Application

View File

@@ -3,7 +3,6 @@
<ItemGroup>
<ProjectReference Include="..\..\framework\Yi.Framework.BackgroundWorkers.Hangfire\Yi.Framework.BackgroundWorkers.Hangfire.csproj" />
<ProjectReference Include="..\..\framework\Yi.Framework.Ddd.Application\Yi.Framework.Ddd.Application.csproj" />
<ProjectReference Include="..\..\module\bbs\Yi.Framework.Bbs.Application\Yi.Framework.Bbs.Application.csproj" />
<ProjectReference Include="..\..\module\chat-hub\Yi.Framework.ChatHub.Application\Yi.Framework.ChatHub.Application.csproj" />

View File

@@ -1,7 +1,6 @@
using Volo.Abp.SettingManagement;
using Yi.Abp.Application.Contracts;
using Yi.Abp.Domain;
using Yi.Framework.BackgroundWorkers.Hangfire;
using Yi.Framework.Bbs.Application;
using Yi.Framework.ChatHub.Application;
using Yi.Framework.CodeGen.Application;
@@ -26,8 +25,7 @@ namespace Yi.Abp.Application
typeof(YiFrameworkCodeGenApplicationModule),
typeof (YiFrameworkSettingManagementApplicationModule),
typeof(YiFrameworkDddApplicationModule),
typeof(YiFrameworkBackgroundWorkersHangfireModule)
typeof(YiFrameworkDddApplicationModule)
)]
public class YiAbpApplicationModule : AbpModule
{

View File

@@ -1,11 +1,9 @@
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using Volo.Abp.BackgroundWorkers.Hangfire;
using Volo.Abp.BackgroundWorkers.Hangfire;
using Volo.Abp.Data;
using Yi.Framework.Rbac.Domain.Entities;
using Yi.Framework.SqlSugarCore.Abstractions;
namespace Yi.Abp.Application.Jobs
namespace Yi.Abp.Web.Jobs
{
public class DemoResetJob : HangfireBackgroundWorkerBase
{

View File

@@ -1,15 +1,12 @@
using Hangfire;
using SqlSugar;
using Volo.Abp.BackgroundWorkers.Hangfire;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.Uow;
using Yi.Framework.Rbac.Domain.Entities;
using Yi.Framework.SqlSugarCore.Abstractions;
namespace Yi.Abp.Application.Jobs
namespace Yi.Abp.Web.Jobs
{
/// <summary>
/// 定时任务
/// 定时任务Test,Job可单独拆成一个Host单独允许
/// </summary>
public class TestJob : HangfireBackgroundWorkerBase
{

View File

@@ -1,19 +1,8 @@
using FreeRedis;
using Hangfire;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Options;
using Volo.Abp.BackgroundWorkers.Hangfire;
using Volo.Abp.Caching;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Entities;
using Volo.Abp.BackgroundWorkers.Hangfire;
using Volo.Abp.EventBus.Local;
using Yi.Framework.Bbs.Domain.Entities;
using Yi.Framework.Bbs.Domain.Shared.Caches;
using Yi.Framework.Bbs.Domain.Shared.Enums;
using Yi.Framework.Bbs.Domain.Shared.Etos;
using Yi.Framework.SqlSugarCore.Abstractions;
namespace Yi.Framework.Bbs.Application.Jobs;
namespace Yi.Abp.Web.Jobs.bbs;
public class AccessLogCacheJob : HangfireBackgroundWorkerBase
{

View File

@@ -1,5 +1,4 @@
using FreeRedis;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Options;
using Volo.Abp.BackgroundWorkers.Hangfire;
using Volo.Abp.Caching;
@@ -9,7 +8,7 @@ using Yi.Framework.Bbs.Domain.Shared.Caches;
using Yi.Framework.Bbs.Domain.Shared.Enums;
using Yi.Framework.SqlSugarCore.Abstractions;
namespace Yi.Framework.Bbs.Application.Jobs;
namespace Yi.Abp.Web.Jobs.bbs;
public class AccessLogStoreJob : HangfireBackgroundWorkerBase
{

View File

@@ -1,7 +1,7 @@
using Volo.Abp.BackgroundWorkers.Hangfire;
using Yi.Framework.Bbs.Domain.Managers;
namespace Yi.Framework.Bbs.Application.Jobs;
namespace Yi.Abp.Web.Jobs.bbs;
/// <summary>
/// 每日任务job

View File

@@ -1,7 +1,7 @@
using Volo.Abp.BackgroundWorkers.Hangfire;
using Yi.Framework.Bbs.Domain.Managers;
namespace Yi.Framework.Bbs.Application.Jobs
namespace Yi.Abp.Web.Jobs.bbs
{
public class InterestRecordsJob : HangfireBackgroundWorkerBase
{

View File

@@ -1,8 +1,7 @@
using Microsoft.Extensions.Logging;
using Volo.Abp.BackgroundWorkers.Hangfire;
using Volo.Abp.BackgroundWorkers.Hangfire;
using Yi.Framework.DigitalCollectibles.Domain.Managers;
namespace Yi.Framework.DigitalCollectibles.Application.Jobs;
namespace Yi.Abp.Web.Jobs.digital_collectibles;
/// <summary>
/// 自动下架商品
/// </summary>

View File

@@ -1,7 +1,7 @@
using Volo.Abp.BackgroundWorkers.Hangfire;
using Yi.Framework.DigitalCollectibles.Domain.Managers;
namespace Yi.Framework.DigitalCollectibles.Application.Jobs;
namespace Yi.Abp.Web.Jobs.digital_collectibles;
/// <summary>
/// 自动刷新填满矿池

View File

@@ -1,7 +1,7 @@
using Volo.Abp.BackgroundWorkers.Hangfire;
using Yi.Framework.DigitalCollectibles.Domain.Managers;
namespace Yi.Framework.DigitalCollectibles.Application.Jobs;
namespace Yi.Abp.Web.Jobs.digital_collectibles;
/// <summary>
/// 自动更新藏品价值

View File

@@ -1,8 +1,7 @@
using Microsoft.Extensions.Logging;
using Volo.Abp.BackgroundWorkers.Hangfire;
using Volo.Abp.BackgroundWorkers.Hangfire;
using Yi.Framework.DigitalCollectibles.Domain.Managers;
namespace Yi.Framework.DigitalCollectibles.Application.Jobs;
namespace Yi.Abp.Web.Jobs.digital_collectibles;
/// <summary>
/// 处理挂机挖矿定时任务

View File

@@ -1,17 +1,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Microsoft.Extensions.Options;
using Volo.Abp.BackgroundWorkers.Hangfire;
using Volo.Abp.Domain.Repositories;
using Yi.Framework.Rbac.Domain.Shared.Options;
using Yi.Framework.SqlSugarCore.Abstractions;
namespace Yi.Framework.Rbac.Application.Jobs
namespace Yi.Abp.Web.Jobs.rbac
{
public class BackupDataBaseJob: HangfireBackgroundWorkerBase
{

View File

@@ -29,6 +29,7 @@
<ItemGroup>
<ProjectReference Include="..\..\framework\Yi.Framework.AspNetCore.Authentication.OAuth\Yi.Framework.AspNetCore.Authentication.OAuth.csproj" />
<ProjectReference Include="..\..\framework\Yi.Framework.AspNetCore\Yi.Framework.AspNetCore.csproj" />
<ProjectReference Include="..\..\framework\Yi.Framework.BackgroundWorkers.Hangfire\Yi.Framework.BackgroundWorkers.Hangfire.csproj" />
<ProjectReference Include="..\Yi.Abp.Application\Yi.Abp.Application.csproj" />
<ProjectReference Include="..\Yi.Abp.SqlSugarCore\Yi.Abp.SqlSugarCore.csproj" />
</ItemGroup>

View File

@@ -58,15 +58,16 @@ namespace Yi.Abp.Web
typeof(YiAbpApplicationModule),
typeof(AbpAspNetCoreMultiTenancyModule),
typeof(AbpAspNetCoreMvcModule),
typeof(AbpAutofacModule),
typeof(AbpSwashbuckleModule),
typeof(AbpAspNetCoreSerilogModule),
typeof(AbpAuditingModule),
typeof(YiFrameworkBackgroundWorkersHangfireModule),
typeof(AbpBackgroundJobsHangfireModule),
typeof(AbpAspNetCoreAuthenticationJwtBearerModule),
typeof(YiFrameworkAspNetCoreModule),
typeof(YiFrameworkAspNetCoreAuthenticationOAuthModule)
typeof(YiFrameworkAspNetCoreAuthenticationOAuthModule),
typeof(YiFrameworkBackgroundWorkersHangfireModule),
typeof(AbpAutofacModule)
)]
public class YiAbpWebModule : AbpModule
{

View File

@@ -12,8 +12,10 @@
<ItemGroup>
<Content Include="appsettings.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
<Content Include="appsettings.Development.json">
<CopyToPublishDirectory>Always</CopyToPublishDirectory>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
@@ -38,7 +40,9 @@
<ItemGroup>
<ProjectReference Include="..\..\src\Yi.Abp.Application\Yi.Abp.Application.csproj" />
<ProjectReference Include="..\..\src\Yi.Abp.SqlSugarCore\Yi.Abp.SqlSugarCore.csproj" />
<PackageReference Include="Hangfire.MemoryStorage" Version="1.8.1.1" />
<PackageReference Include="Hangfire.Redis.StackExchange" Version="1.9.4" />
<PackageReference Include="Hangfire.Core" Version="1.8.14" />
</ItemGroup>
</Project>

View File

@@ -1,5 +1,10 @@
using Volo.Abp.Auditing;
using Hangfire;
using Hangfire.MemoryStorage;
using StackExchange.Redis;
using Volo.Abp.Auditing;
using Volo.Abp.Autofac;
using Volo.Abp.BackgroundJobs.Hangfire;
using Volo.Abp.BackgroundWorkers;
using Yi.Abp.Application;
using Yi.Abp.SqlsugarCore;
@@ -8,14 +13,14 @@ namespace Yi.Abp.Test
[DependsOn(
typeof(YiAbpSqlSugarCoreModule),
typeof(YiAbpApplicationModule),
typeof(AbpAutofacModule),
typeof(AbpAuditingModule)
typeof(AbpAutofacModule)
)]
public class YiAbpTestModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<AbpBackgroundWorkerOptions>(options=>options.IsEnabled=false);
}
}
}