FustGoTrackingJob.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  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. namespace XYY.Tool.TimingTask.jobs
  8. {
  9. internal class FustGoTrackingJob : IJob
  10. {
  11. public Task Execute(IJobExecutionContext context)
  12. {
  13. return GetUsps();
  14. }
  15. private async Task GetUsps()
  16. {
  17. string apiUrl = "http://api.fustgo.com";
  18. //string apiUrl = "http://localhost:5153";
  19. string src = "/Tracking/GetUsps";
  20. RestSharp.RestClient client = new RestSharp.RestClient(apiUrl);
  21. RestSharp.RestRequest request = new RestSharp.RestRequest(src, RestSharp.Method.GET);
  22. var resp = await client.ExecuteAsync(request);
  23. if (resp.IsSuccessful)
  24. {
  25. Console.WriteLine($"{DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss")} 处理FUSTGO-USPS轨迹:成功");
  26. }
  27. else
  28. {
  29. Console.WriteLine($"{DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss")} 处理FUSTGO-USPS轨迹:失败 {resp.Content}");
  30. }
  31. }
  32. }
  33. }