RetryChargeJob.cs 1.1 KB

1234567891011121314151617181920212223242526272829
  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. internal class RetryChargeJob : IJob
  11. {
  12. public async Task Execute(IJobExecutionContext context)
  13. {
  14. RestSharp.RestClient client = new RestSharp.RestClient(JobConfig.ReChargeJobApi);
  15. RestSharp.RestRequest request = new RestSharp.RestRequest(RestSharp.Method.GET);
  16. request.AddHeader("Authorization", "token 57AEDE5487260443D6BF2182D31286B1");
  17. string from=DateTime.Now.ToString("yyyy-MM-dd");
  18. string to=DateTime.Now.AddDays(1).ToString("yyyy-MM-dd");
  19. string keywork = "Timeout";
  20. var param = new { from, to, keywork };
  21. request.AddJsonBody(param);
  22. var result = await client.ExecuteAsync(request);
  23. Console.WriteLine($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} 【计费超时重算】执行成功!日期:{from} 到 {to}");
  24. }
  25. }
  26. }