PushESBTrackMonitorJob.cs 1.0 KB

12345678910111213141516171819202122232425262728
  1. using Quartz;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using XYY.Tool.QuotaReduction;
  8. namespace XYY.Tool.TimingTask.jobs
  9. {
  10. public class PushESBTrackMonitorJob : IJob
  11. {
  12. public async Task Execute(IJobExecutionContext context)
  13. {
  14. RestSharp.RestClient client = new RestSharp.RestClient(JobConfig.PushESBTrackMonitorApi);
  15. RestSharp.RestRequest request = new RestSharp.RestRequest(RestSharp.Method.GET);
  16. request.AddHeader("Authorization", "token 985833DB91DA7B38C3918D3F1F9D2339");
  17. client.Timeout = -1;
  18. var response = client.Execute(request);
  19. if (response.StatusCode != System.Net.HttpStatusCode.OK)
  20. {
  21. string msg = "异常轨迹文件推送失败" + (response.ErrorMessage ?? response.Content);
  22. dingApiRequest.sendMessageToWeChat("PushESBTrackMonitorJob", msg, new List<string>() { "LiuZhengKai" });
  23. }
  24. }
  25. }
  26. }