fix定时任务执行api请求问题
This commit is contained in:
parent
d7ee352f3a
commit
ac277c9230
@ -111,7 +111,7 @@ namespace ZR.Admin.WebApi.Controllers
|
||||
if (parm.ApiUrl.IfNotEmpty() && parm.TaskType == 2)
|
||||
{
|
||||
tasksQz.AssemblyName = "ZR.Tasks";
|
||||
tasksQz.ClassName = "TaskScheduler.HttpResultfulJob";
|
||||
tasksQz.ClassName = "TaskScheduler.Job_HttpRequest";
|
||||
}
|
||||
return SUCCESS(_tasksQzService.Add(tasksQz));
|
||||
}
|
||||
@ -146,7 +146,7 @@ namespace ZR.Admin.WebApi.Controllers
|
||||
if (parm.ApiUrl.IfNotEmpty() && parm.TaskType == 2)
|
||||
{
|
||||
parm.AssemblyName = "ZR.Tasks";
|
||||
parm.ClassName = "TaskScheduler.HttpResultfulJob";
|
||||
parm.ClassName = "TaskScheduler.Job_HttpRequest";
|
||||
}
|
||||
if (tasksQz.IsStart)
|
||||
{
|
||||
|
||||
@ -3,11 +3,15 @@ using Infrastructure.Attribute;
|
||||
using Quartz;
|
||||
using Quartz.Impl;
|
||||
using Quartz.Impl.Triggers;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using ZR.Service.System.IService;
|
||||
|
||||
namespace ZR.Tasks.TaskScheduler
|
||||
{
|
||||
/// <summary>
|
||||
/// 定时任务http请求
|
||||
/// </summary>
|
||||
[AppService(ServiceType = typeof(Job_HttpRequest), ServiceLifetime = LifeTime.Scoped)]
|
||||
internal class Job_HttpRequest : JobBase, IJob
|
||||
{
|
||||
@ -25,9 +29,11 @@ namespace ZR.Tasks.TaskScheduler
|
||||
{
|
||||
AbstractTrigger trigger = (context as JobExecutionContextImpl).Trigger as AbstractTrigger;
|
||||
var info = await tasksQzService.GetByIdAsync(trigger.Name);
|
||||
|
||||
var result = await HttpHelper.HttpPostAsync("http://" + info.ApiUrl, info.JobParams);
|
||||
//Console.WriteLine(result);
|
||||
if (info != null)
|
||||
{
|
||||
var result = await HttpHelper.HttpGetAsync("http://" + info.ApiUrl);
|
||||
Console.WriteLine(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user