using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using System;
using System.Threading.Tasks;

namespace Bailun.DC.DailyPlatformAccountBalance
{
    /// <summary>
    /// 平台帐号余额
    /// 从资金系统获取数据
    /// </summary>
    class Program
    {
        //static async Task Main(string[] args)
        //{
        //    Console.WriteLine("启动服务 " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
        //    var builder = new HostBuilder().ConfigureServices((hostContext, services) =>
        //    {
        //        services.AddHostedService<Services>();
        //    });

        //    await builder.RunConsoleAsync();
        //}

        static void Main(string[] args)
        {
            var _services = new Services();
            var day = DateTime.Parse(DateTime.Now.AddDays(-8).ToShortDateString());
            while (day < DateTime.Now.AddDays(-1))
            {
                _services.Init(day);
                _services.SaveDaily(day);
                _services.UpdateBalanceSheet(day);
                day = day.AddDays(1);
            }


        }
    }
}
