using Newtonsoft.Json;
using Quartz;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using XYY.Tool.QuotaReduction;

namespace XYY.Tool.TimingTask.jobs
{
    internal class ReloadExecuteAsEmptyJob : IJob
    {
        public async Task Execute(IJobExecutionContext context)
        {
            string msg = string.Empty;
            RestSharp.RestClient client = new RestSharp.RestClient(JobConfig.ReloadExecuteAsEmptyApi);
            RestSharp.RestRequest request = new RestSharp.RestRequest(RestSharp.Method.POST);
            request.AddHeader("Authorization", "token 985833DB91DA7B38C3918D3F1F9D2339");
            client.Timeout = 0;
            var response = client.Execute(request);
            if(response.StatusCode != System.Net.HttpStatusCode.OK)
            {
                msg = "同步空计费日志失败" + (response.ErrorMessage ?? response.Content);
            }
            else
            {
                msg = "同步空计费完成";
            }
            dingApiRequest.sendDingMessageToChat("GenerateFirstBillsJob", "SMP同步空计费");

        }
    }
}
