feat: 完成job模块优化
This commit is contained in:
@@ -1,38 +0,0 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Volo.Abp.BackgroundWorkers.Hangfire;
|
||||
using Yi.Framework.DigitalCollectibles.Domain.Managers;
|
||||
|
||||
namespace Yi.Framework.DigitalCollectibles.Application.Jobs;
|
||||
/// <summary>
|
||||
/// 自动下架商品
|
||||
/// </summary>
|
||||
public class AutoPassInGoodsJob: HangfireBackgroundWorkerBase
|
||||
{
|
||||
private readonly MarketManager _marketManager;
|
||||
private readonly ILogger<AutoPassInGoodsJob> _logger;
|
||||
public AutoPassInGoodsJob(MarketManager marketManager, ILogger<AutoPassInGoodsJob> logger)
|
||||
{
|
||||
_marketManager = marketManager;
|
||||
_logger = logger;
|
||||
RecurringJobId = "交易市场自动流拍";
|
||||
//每小时,第10分钟执行一次
|
||||
CronExpression = "0 10 * * * ?";
|
||||
//
|
||||
// JobDetail = JobBuilder.Create<AutoPassInGoodsJob>().WithIdentity(nameof(AutoPassInGoodsJob))
|
||||
// .Build();
|
||||
//
|
||||
// //每小时,第10分钟执行一次
|
||||
// Trigger = TriggerBuilder.Create().WithIdentity(nameof(AutoPassInGoodsJob))
|
||||
// // .WithSimpleSchedule((builer) =>
|
||||
// // {
|
||||
// // builer.WithIntervalInHours(10);
|
||||
// // })
|
||||
// // .StartNow()
|
||||
// .WithCronSchedule("0 10 * * * ?")
|
||||
// .Build();
|
||||
}
|
||||
public override async Task DoWorkAsync(CancellationToken cancellationToken = new CancellationToken())
|
||||
{
|
||||
await _marketManager.AutoPassInGoodsAsync();
|
||||
}
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
using Volo.Abp.BackgroundWorkers.Hangfire;
|
||||
using Yi.Framework.DigitalCollectibles.Domain.Managers;
|
||||
|
||||
namespace Yi.Framework.DigitalCollectibles.Application.Jobs;
|
||||
|
||||
/// <summary>
|
||||
/// 自动刷新填满矿池
|
||||
/// </summary>
|
||||
public class AutoRefreshMiningPoolJob : HangfireBackgroundWorkerBase
|
||||
{
|
||||
private readonly MiningPoolManager _miningPoolManager;
|
||||
|
||||
public AutoRefreshMiningPoolJob(MiningPoolManager miningPoolManager)
|
||||
{
|
||||
_miningPoolManager = miningPoolManager;
|
||||
|
||||
RecurringJobId = "刷新矿池和用户限制";
|
||||
//每天早上10点执行一次
|
||||
CronExpression = "0 0 10 * * ?";
|
||||
//
|
||||
// JobDetail = JobBuilder.Create<AutoRefreshMiningPoolJob>().WithIdentity(nameof(AutoRefreshMiningPoolJob))
|
||||
// .Build();
|
||||
//
|
||||
// //每天早上10点执行一次
|
||||
// Trigger = TriggerBuilder.Create().WithIdentity(nameof(AutoRefreshMiningPoolJob))
|
||||
// .WithCronSchedule("0 0 10 * * ?")
|
||||
// .Build();
|
||||
//
|
||||
|
||||
// Trigger = TriggerBuilder.Create().WithIdentity(nameof(AutoRefreshMiningPoolJob))
|
||||
// .WithSimpleSchedule((schedule) =>
|
||||
// {
|
||||
// schedule.WithInterval(TimeSpan.FromHours(1));
|
||||
// })
|
||||
// .StartNow()
|
||||
// .Build();
|
||||
}
|
||||
public override async Task DoWorkAsync(CancellationToken cancellationToken = new CancellationToken())
|
||||
{
|
||||
|
||||
//刷新矿池
|
||||
await _miningPoolManager.RefreshMiningPoolAsync();
|
||||
//刷新用户限制
|
||||
await _miningPoolManager.RefreshMiningUserLimitAsync();
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
using Volo.Abp.BackgroundWorkers.Hangfire;
|
||||
using Yi.Framework.DigitalCollectibles.Domain.Managers;
|
||||
|
||||
namespace Yi.Framework.DigitalCollectibles.Application.Jobs;
|
||||
|
||||
/// <summary>
|
||||
/// 自动更新藏品价值
|
||||
/// </summary>
|
||||
public class AutoUpdateCollectiblesValueJob : HangfireBackgroundWorkerBase
|
||||
{
|
||||
private readonly CollectiblesManager _collectiblesManager;
|
||||
|
||||
public AutoUpdateCollectiblesValueJob(CollectiblesManager collectiblesManager)
|
||||
{
|
||||
_collectiblesManager = collectiblesManager;
|
||||
RecurringJobId = "更新藏品价值";
|
||||
//每天早上9点执行一次
|
||||
CronExpression = "0 0 9 * * ?";
|
||||
}
|
||||
|
||||
public override async Task DoWorkAsync(CancellationToken cancellationToken = new CancellationToken())
|
||||
{
|
||||
await _collectiblesManager.UpdateAllValueAsync();
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Volo.Abp.BackgroundWorkers.Hangfire;
|
||||
using Yi.Framework.DigitalCollectibles.Domain.Managers;
|
||||
|
||||
namespace Yi.Framework.DigitalCollectibles.Application.Jobs;
|
||||
|
||||
/// <summary>
|
||||
/// 处理挂机挖矿定时任务
|
||||
/// </summary>
|
||||
public class OnHookAutoMiningJob : HangfireBackgroundWorkerBase
|
||||
{
|
||||
private readonly MiningPoolManager _miningPoolManager;
|
||||
private readonly ILogger<OnHookAutoMiningJob> _logger;
|
||||
|
||||
public OnHookAutoMiningJob(MiningPoolManager miningPoolManager, ILogger<OnHookAutoMiningJob> logger)
|
||||
{
|
||||
_miningPoolManager = miningPoolManager;
|
||||
_logger = logger;
|
||||
|
||||
RecurringJobId = "自动挂机挖矿";
|
||||
//每小时执行一次
|
||||
CronExpression = "0 0 * * * ?";
|
||||
//
|
||||
// JobDetail = JobBuilder.Create<OnHookAutoMiningJob>().WithIdentity(nameof(OnHookAutoMiningJob))
|
||||
// .Build();
|
||||
//
|
||||
// //每小时执行一次
|
||||
// Trigger = TriggerBuilder.Create().WithIdentity(nameof(OnHookAutoMiningJob))
|
||||
// // .WithCronSchedule("10 * * * * ?")
|
||||
// .WithCronSchedule("0 0 * * * ?")
|
||||
// .Build();
|
||||
}
|
||||
public override async Task DoWorkAsync(CancellationToken cancellationToken = new CancellationToken())
|
||||
{
|
||||
await _miningPoolManager.OnHookMiningAsync();
|
||||
}
|
||||
}
|
||||
@@ -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" />
|
||||
|
||||
Reference in New Issue
Block a user