瀏覽代碼

Merge branch 'test' of http://110.188.24.182:10023/Fengwo/hotline into test

田爽 5 天之前
父節點
當前提交
5022604f8e
共有 2 個文件被更改,包括 28 次插入2 次删除
  1. 27 1
      src/Hotline.Api/Controllers/CorsJobController.cs
  2. 1 1
      src/Hotline.Api/StartupExtensions.cs

+ 27 - 1
src/Hotline.Api/Controllers/CorsJobController.cs

@@ -1,13 +1,20 @@
-using Hotline.Application.Jobs;
+using Hotline.Api.Realtimes;
+using Hotline.Application.Jobs;
+using Hotline.CallCenter.Calls;
 using Hotline.Orders;
+using Hotline.Realtimes;
 using Microsoft.AspNetCore.Authorization;
 using Microsoft.AspNetCore.Mvc;
+using XF.Domain.Repository;
 
 namespace Hotline.Api.Controllers
 {
     public class CorsJobController: BaseController
     {
         private readonly IOrderDomainService _orderDomainService;
+        private readonly IRepository<TrCallRecord> _trcallrecordRepoository;
+        private readonly IRealtimeService _realtimeService;
+
         public CorsJobController(IOrderDomainService orderDomainService)
         {
             _orderDomainService = orderDomainService;
@@ -24,5 +31,24 @@ namespace Hotline.Api.Controllers
         {
             await _orderDomainService.SendOverTimeSms(HttpContext.RequestAborted);
         }
+
+        /// <summary>
+        /// 推送当天等待(1分钟一次)
+        /// </summary>
+        /// <returns></returns>
+        [HttpGet("send-todaywaitnum")]
+        [AllowAnonymous]
+        public async Task SendToDayWaitNum()
+        {
+            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, HttpContext.RequestAborted);
+            }
+            catch { }
+        }
     }
 }

+ 1 - 1
src/Hotline.Api/StartupExtensions.cs

@@ -168,7 +168,7 @@ internal static class StartupExtensions
                 services
                     .AddScoped<ICallApplication, TianRunCallApplication>()
                     .AddScoped<ITrApplication, TrApplication>()
-                    .AddHostedService<CurrentWaitNumService>()
+                    //.AddHostedService<CurrentWaitNumService>()
                     //.AddHostedService<TelsStatusRefreshService>()
                     .AddTrSdk(callCenterConfiguration.TianRun.Address,
                         callCenterConfiguration.TianRun.Username,