using Newtonsoft.Json; using Quartz; using RestSharp; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using XYY.Tool.QuotaReduction; using XYY.Tool.TimingTask.Model; namespace XYY.Tool.TimingTask.jobs { public class ExchangeRateJob : IJob { public Task Execute(IJobExecutionContext context) { string msg = string.Empty; //发起两次请求 var client = new RestClient(JobConfig.ExchangeRateSyncApi); client.Timeout = -1; var request = new RestRequest(Method.GET); IRestResponse response = client.Execute(request); if (response.StatusCode == System.Net.HttpStatusCode.OK) { var result = JsonConvert.DeserializeObject(response.Content); Tuple tuple = JsonConvert.DeserializeObject>(result.data.ToString()); msg = tuple.Item2; } else { msg += "中国银行汇率同步接口调用失败!"; } dingApiRequest.sendDingMessageToChat("ExchangeRateSync", msg); return null; } } }