Эх сурвалжийг харах

Merge branch 'master' of http://110.188.24.182:10023/Fengwo/hotline

xf 1 жил өмнө
parent
commit
09b5f077fa

+ 1 - 1
src/Hotline.Api/config/appsettings.Development.json

@@ -1,7 +1,7 @@
 {
   "AllowedHosts": "*",
   "CallCenterConfiguration": {
-    "CallCenterType": "XunShi",
+    "CallCenterType": "WeiErXin", //XunShi、WeiErXin
     "DeviceConfigs": {
       "Address": "http://192.168.100.100/xml",
       "Authorize": true,

+ 2 - 2
src/Hotline.Api/config/appsettings.json

@@ -1,13 +1,13 @@
 {
   "AllowedHosts": "*",
   "CallCenterConfiguration": {
-    "CallCenterType": "XunShi",
+    "CallCenterType": "WeiErXin", //XunShi、WeiErXin
     "DeviceConfigs": {
       "Address": "http://192.168.100.100/xml",
       "Authorize": true,
       "ReceiveKey": "E1BBD1BB-A269-44",
       "SendKey": "2A-BA92-160A3B1D",
-      "Expired": 1440 //认证过期时间(秒)
+      "Expired": 86300 //认证过期时间(秒)
     }
   },
   "ConnectionStrings": {

+ 24 - 15
src/Hotline/CallCenter/Tels/TelDomainService.cs

@@ -8,6 +8,7 @@ using XF.Domain.Dependency;
 using XF.Domain.Exceptions;
 using Hotline.Share.Enums.CallCenter;
 using Hotline.Caching.Interfaces;
+using Microsoft.Extensions.Options;
 
 namespace Hotline.CallCenter.Tels;
 
@@ -19,6 +20,7 @@ public class TelDomainService : ITelDomainService, IScopeDependency
     private readonly ITelHoldRepository _telHoldRepository;
     private readonly IRealtimeService _realtimeService;
     private readonly ITelCacheManager _telCacheManager;
+    private readonly IOptionsSnapshot<CallCenterConfiguration> _options;
 
     public TelDomainService(
         IDeviceManager deviceManager,
@@ -26,7 +28,8 @@ public class TelDomainService : ITelDomainService, IScopeDependency
         ITelRestRepository telRestRepository,
         ITelHoldRepository telHoldRepository,
         IRealtimeService realtimeService,
-        ITelCacheManager telCacheManager)
+        ITelCacheManager telCacheManager,
+        IOptionsSnapshot<CallCenterConfiguration> options)
     {
         _deviceManager = deviceManager;
         _telRepository = telRepository;
@@ -34,6 +37,7 @@ public class TelDomainService : ITelDomainService, IScopeDependency
         _telHoldRepository = telHoldRepository;
         _realtimeService = realtimeService;
         _telCacheManager = telCacheManager;
+        _options = options;
     }
 
 
@@ -108,13 +112,17 @@ public class TelDomainService : ITelDomainService, IScopeDependency
         telRest.StartTime = DateTime.Now;
         await _telRestRepository.UpdateAsync(telRest, cancellationToken);
 
-        #region 处理设备
-        var tel = _telCacheManager.GetTel(telRest.TelNo);
-        foreach (var group in tel.Groups)
+        if (_options.Value.CallCenterType!= "WeiErXin")
         {
-            await _deviceManager.ModifyGroupExtAsync(group.No, group.Distribution, group.Voice, tel.No, true, cancellationToken);
+            #region 处理设备
+            var tel = _telCacheManager.GetTel(telRest.TelNo);
+            foreach (var group in tel.Groups)
+            {
+                await _deviceManager.ModifyGroupExtAsync(group.No, group.Distribution, group.Voice, tel.No, true, cancellationToken);
+            }
+            #endregion
         }
-        #endregion
+
         //通知前端休息通过
         await _realtimeService.RestApplyPassAsync(telRest.UserId, cancellationToken);
 
@@ -137,17 +145,18 @@ public class TelDomainService : ITelDomainService, IScopeDependency
             throw new UserFriendlyException("未查询到分机休息信息");
         restingTel.EndRest();
         await _telRestRepository.UpdateAsync(restingTel, cancellationToken);
-
-        #region 处理设备
-        var telCache = _telCacheManager.GetTel(tel.No);
-        //更新分机组
-        foreach (var group in telCache.Groups)
+        if (_options.Value.CallCenterType != "WeiErXin")
         {
-            await _deviceManager.ModifyGroupExtAsync(group.No, group.Distribution, group.Voice, "", true, cancellationToken);
+            #region 处理设备
+            var telCache = _telCacheManager.GetTel(tel.No);
+            //更新分机组
+            foreach (var group in telCache.Groups)
+            {
+                await _deviceManager.ModifyGroupExtAsync(group.No, group.Distribution, group.Voice, "", true, cancellationToken);
+            }
+
+            #endregion
         }
-
-        #endregion
-
         return restingTel;
     }