fix: 修复依赖注入问题
This commit is contained in:
@@ -11,8 +11,9 @@ public class AutoRefreshMiningPoolJob : QuartzBackgroundWorkerBase
|
|||||||
{
|
{
|
||||||
private readonly MiningPoolManager _miningPoolManager;
|
private readonly MiningPoolManager _miningPoolManager;
|
||||||
|
|
||||||
public AutoRefreshMiningPoolJob()
|
public AutoRefreshMiningPoolJob(MiningPoolManager miningPoolManager)
|
||||||
{
|
{
|
||||||
|
_miningPoolManager = miningPoolManager;
|
||||||
JobDetail = JobBuilder.Create<AutoRefreshMiningPoolJob>().WithIdentity(nameof(AutoRefreshMiningPoolJob))
|
JobDetail = JobBuilder.Create<AutoRefreshMiningPoolJob>().WithIdentity(nameof(AutoRefreshMiningPoolJob))
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
@@ -20,6 +21,15 @@ public class AutoRefreshMiningPoolJob : QuartzBackgroundWorkerBase
|
|||||||
Trigger = TriggerBuilder.Create().WithIdentity(nameof(AutoRefreshMiningPoolJob))
|
Trigger = TriggerBuilder.Create().WithIdentity(nameof(AutoRefreshMiningPoolJob))
|
||||||
.WithCronSchedule("0 0 10 * * ?")
|
.WithCronSchedule("0 0 10 * * ?")
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
|
|
||||||
|
// Trigger = TriggerBuilder.Create().WithIdentity(nameof(AutoRefreshMiningPoolJob))
|
||||||
|
// .WithSimpleSchedule((schedule) =>
|
||||||
|
// {
|
||||||
|
// schedule.WithInterval(TimeSpan.FromHours(1));
|
||||||
|
// })
|
||||||
|
// .StartNow()
|
||||||
|
// .Build();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async Task Execute(IJobExecutionContext context)
|
public override async Task Execute(IJobExecutionContext context)
|
||||||
|
|||||||
@@ -15,6 +15,11 @@ public class MiningPoolService : ApplicationService
|
|||||||
{
|
{
|
||||||
private readonly MiningPoolManager _manager;
|
private readonly MiningPoolManager _manager;
|
||||||
|
|
||||||
|
public MiningPoolService(MiningPoolManager manager)
|
||||||
|
{
|
||||||
|
_manager = manager;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 内测-白嫖-获取自动挖矿卡
|
/// 内测-白嫖-获取自动挖矿卡
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -29,10 +34,10 @@ public class MiningPoolService : ApplicationService
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet("mining-pool")]
|
[HttpGet("mining-pool")]
|
||||||
public async Task<MiningPoolGetOutput> GetMiningPoolContentAsync()
|
public async Task<MiningPoolGetOutput?> GetMiningPoolContentAsync()
|
||||||
{
|
{
|
||||||
var content = await _manager.GetMiningPoolContentAsync();
|
var content = await _manager.GetMiningPoolContentAsync();
|
||||||
var output = content.Adapt<MiningPoolGetOutput>();
|
var output = content.Adapt<MiningPoolGetOutput?>();
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ public class MiningPoolManager : DomainService
|
|||||||
return await ComputeMiningProbabilityAsync();
|
return await ComputeMiningProbabilityAsync();
|
||||||
});
|
});
|
||||||
|
|
||||||
public async Task<MiningPoolContent> GetMiningPoolContentAsync()
|
public async Task<MiningPoolContent?> GetMiningPoolContentAsync()
|
||||||
{
|
{
|
||||||
var pool = await _miningPoolCache.GetAsync(MiningCacheConst.MiningPoolContent);
|
var pool = await _miningPoolCache.GetAsync(MiningCacheConst.MiningPoolContent);
|
||||||
return pool;
|
return pool;
|
||||||
|
|||||||
Reference in New Issue
Block a user