소스 검색

callqueue

dss 2 년 전
부모
커밋
7a26940bd9

+ 1 - 1
src/CallCenter.Api/Controllers/TestController.cs

@@ -137,7 +137,7 @@ namespace CallCenter.Api.Controllers
         [HttpGet("callqueue")]
         public async Task CallQueueTest()
         {
-            await _realtimeService.CallQueueAsync(1,HttpContext.RequestAborted);
+            await _realtimeService.CallQueueAsync(new List<Calls.Call>(),HttpContext.RequestAborted);
         }
 
 

+ 3 - 2
src/CallCenter.Api/Realtimes/RealtimeService.cs

@@ -1,4 +1,5 @@
 using CallCenter.Caches;
+using CallCenter.Calls;
 using CallCenter.Realtimes;
 using CallCenter.Users;
 using Microsoft.AspNetCore.SignalR;
@@ -74,7 +75,7 @@ namespace CallCenter.Api.Realtimes
         /// <param name="count"></param>
         /// <param name="cancellationToken"></param>
         /// <returns></returns>
-        public async Task CallQueueAsync(int count,CancellationToken cancellationToken)
+        public async Task CallQueueAsync(List<Call> list,CancellationToken cancellationToken)
         {
             var works = _userCacheManager.GetWorks();
             if (works!=null)
@@ -82,7 +83,7 @@ namespace CallCenter.Api.Realtimes
                 var sendlist = works.Where(x => x.SignalRId != null && x.SignalRId != "").Select(x => x.SignalRId).ToList();
                 foreach (var item in sendlist)
                 {
-                    await _hubContext.Clients.Client(item).SendAsync(RealtimeMethods.CallQueue, new { count = count }, cancellationToken);
+                    await _hubContext.Clients.Client(item).SendAsync(RealtimeMethods.CallQueue, new { list }, cancellationToken);
                 }
             }
         }

+ 3 - 4
src/CallCenter.CacheManager/CallQueueManager.cs

@@ -35,13 +35,12 @@ namespace CallCenter.CacheManager
             {
                 //查询当前队列
                 var callList = callQueueManager.GetCallQueueList();
-                int count = 0;
-                if (callList!=null)
+                if (callList ==null)
                 {
-                    count = callList.Count;
+                    callList = new List<Calls.Call>();
                 }
                 //通知
-                await realtimeService.CallQueueAsync(count, cancellationToken);
+                await realtimeService.CallQueueAsync(callList, cancellationToken);
                 await Task.Delay(time, cancellationToken);
             }
 

+ 3 - 2
src/CallCenter/Realtimes/IRealtimeService.cs

@@ -1,4 +1,5 @@
-using CallCenter.Share.Enums;
+using CallCenter.Calls;
+using CallCenter.Share.Enums;
 using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -15,7 +16,7 @@ namespace CallCenter.Realtimes
 
         Task ByeAsync(string userId, ByeDto dto, CancellationToken cancellationToken);
 
-        Task CallQueueAsync(int count,CancellationToken cancellationToken);
+        Task CallQueueAsync(List<Call> list, CancellationToken cancellationToken);
 
         Task AlertAsync(string userId, AlertDto dto, CancellationToken cancellationToken);