//using Hotline.CallCenter.Calls;
//using Hotline.Realtimes;
//using Microsoft.Extensions.DependencyInjection;
//using Microsoft.Extensions.Hosting;
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using System.Threading.Tasks;
//using XF.Domain.Repository;

//namespace Hotline.Application.CallCenter.Calls
//{
//    public class ToDayWaitNumService : BackgroundService
//    {
//        private readonly IServiceScopeFactory _serviceScopeFactory;
//        public ToDayWaitNumService(IServiceScopeFactory serviceScopeFactory)
//        {
//                _serviceScopeFactory = serviceScopeFactory;
//        }

//        protected async override Task ExecuteAsync(CancellationToken stoppingToken)
//        {
//            //using var scope = _serviceScopeFactory.CreateScope();
//            //var realtimeService = scope.ServiceProvider.GetRequiredService<IRealtimeService>();
//            //var _trcallrecordRepoository = scope.ServiceProvider.GetRequiredService<IRepository<TrCallRecord>>();
//            //int times = 60000;//一分钟
//            //while (!stoppingToken.IsCancellationRequested)
//            //{
//            //    try
//            //    {
//            //        int count = await _trcallrecordRepoository.Queryable()
//            //            .Where(x => x.CreatedTime.Date == DateTime.Now.Date)
//            //            .Where(x => x.QueueTims > 0 && x.Duration == 0)
//            //            .CountAsync();
//            //        await realtimeService.TodayWaitNumAsync(count, stoppingToken);
//            //    }
//            //    catch {}
//            //    await Task.Delay(times);
//            //}
//        }
//    }
//}
