admin 2 năm trước cách đây
mục cha
commit
610acb30ca

+ 6 - 1
src/CallCenter.Application/Handlers/FlowControl/AnsweredVisitorToExtNotificationHandler.cs

@@ -4,6 +4,8 @@ using CallCenter.Realtimes;
 using CallCenter.Share.Enums;
 using CallCenter.Share.Notifications;
 using MediatR;
+using Microsoft.Extensions.Logging;
+using System.Text.Json;
 
 namespace CallCenter.Application.Handlers
 {
@@ -14,14 +16,16 @@ namespace CallCenter.Application.Handlers
         private readonly IRealtimeService _realtimeService;
         private readonly IUserCacheManager _userCacheManager;
         private readonly ICallCacheManager _callCacheManager;
+        private readonly ILogger<AnsweredVisitorToExtNotificationHandler> _logger;
 
-        public AnsweredVisitorToExtNotificationHandler(ICallRepository callRepository, ICallDetailRepository callDetailRepository,IRealtimeService realtimeService,IUserCacheManager userCacheManager, ICallCacheManager callCacheManager)
+        public AnsweredVisitorToExtNotificationHandler(ICallRepository callRepository, ICallDetailRepository callDetailRepository,IRealtimeService realtimeService,IUserCacheManager userCacheManager, ICallCacheManager callCacheManager,ILogger<AnsweredVisitorToExtNotificationHandler> logger)
         {
             _callRepository = callRepository;
             _callDetailRepository = callDetailRepository;
             _realtimeService = realtimeService;
             _userCacheManager = userCacheManager;
             _callCacheManager = callCacheManager;
+            _logger = logger;
         }
 
         public async Task Handle(AnsweredVisitorToExtNotification notification, CancellationToken cancellationToken)
@@ -51,6 +55,7 @@ namespace CallCenter.Application.Handlers
 
                 //处理排队缓存数据 TODO
                 _callCacheManager.RemoveCallCache(model.Id);
+                _logger.LogInformation(JsonSerializer.Serialize(_callCacheManager.GetCallQueueList()));
                 await _realtimeService.CallQueueAsync(_callCacheManager.GetCallQueueList(), cancellationToken);
 
                 var callDetail = _callDetailRepository.GetAsync(x => x.CallId == model.Id && x.EventName == "ANSWER");