Browse Source

Merge branch 'master' of http://git.ius.plus:88/Project-Wing/WingCloudServer

Conflicts:
	src/InteractionCenter/VinnoServerService.cs
denny 2 years ago
parent
commit
2719529ed1
2 changed files with 34 additions and 30 deletions
  1. 17 0
      src/AutoMapperProfile.cs
  2. 17 30
      src/InteractionCenter/VinnoServerService.cs

+ 17 - 0
src/AutoMapperProfile.cs

@@ -0,0 +1,17 @@
+using AutoMapper;
+using WingInterfaceLibrary.DTO.Device;
+using WingInterfaceLibrary.DTO.DistributedServerInfo;
+using WingInterfaceLibrary.DTO.User;
+using WingServerCommon.Interfaces.Cache;
+
+namespace WingCloudServer
+{
+    public class AutoMapperProfile : Profile
+    {   
+         public AutoMapperProfile()
+         {
+            CreateMap<CacheIPAddressInfoDTO, IPAddressInfoDTO>().ReverseMap();
+             
+         }
+    }
+}

+ 17 - 30
src/InteractionCenter/VinnoServerService.cs

@@ -14,6 +14,7 @@ using WingServerCommon.Config;
 using WingServerCommon.Config.Parameters;
 using System.Net;
 using Newtonsoft.Json;
+using WingServerCommon.Mapper;
 
 namespace WingCloudServer.InteractionCenter
 {
@@ -31,7 +32,7 @@ namespace WingCloudServer.InteractionCenter
         private ITokenDBService _tokenDBService;
 
         /// <summary>
-        /// 默认构造
+        /// 默认构é€
         /// </summary>
         public VinnoServerService()
         {
@@ -96,6 +97,7 @@ namespace WingCloudServer.InteractionCenter
                             Enable = d.Enable,
                             ServerType = (int)d.ServerType,
                             ServerUrl = d.ServerUrl,
+                            AssignClientIPList = d.AssignClientIPList.MappingTo<List<CacheIPAddressInfoDTO>>()
                         }).ToList();
                     }
                 }
@@ -118,6 +120,7 @@ namespace WingCloudServer.InteractionCenter
                             Enable = d.Enable,
                             ServerType = (int)d.ServerType,
                             ServerUrl = d.ServerUrl,
+                            AssignClientIPList = d.AssignClientIPList.MappingTo<List<CacheIPAddressInfoDTO>>()
                         }).ToList();
                     }
                 }
@@ -130,7 +133,7 @@ namespace WingCloudServer.InteractionCenter
         }
 
         /// <summary>
-        /// åˆ�始åŒ
+        /// åˆ�始åŒ
         /// </summary>
         public override void Load(JsonRpcClientPool jsonRpcClientPool)
         {
@@ -142,7 +145,7 @@ namespace WingCloudServer.InteractionCenter
         }
 
         /// <summary>
-        /// 加载ServerInfo到内存
+        /// 加载ServerInfo到内å­
         /// </summary>
         /// <returns></returns>
         private void LoadDBServerInfo()
@@ -215,37 +218,21 @@ namespace WingCloudServer.InteractionCenter
         {
             //这里应该是批�查询,请求�数�改
             var list = new List<ServerInfoDTO>();
-            // var serverInformationList = new List<CacheDistributedServerInfosDTO>();
-            // if (request.Codes != null && request.Codes.Any())
-            // {
-            //     foreach (var item in request.Codes)
-            //     {
-            //         var entity = CacheMaintenance.Instance.Get<IDistributedServerInfosManager>().Get(item);
-            //         if (entity != null && !string.IsNullOrEmpty(entity.Code))
-            //         {
-            //             serverInformationList.Add(entity);
-            //         }
-            //     }
-
-            // }
-            // else
-            // {
-            //     serverInformationList = CacheMaintenance.Instance.Get<IDistributedServerInfosManager>()
-            //     .Where(x => !string.IsNullOrEmpty(x.Name) && !string.IsNullOrEmpty(x.ServerUrl))?.ToList();
-            // }
-            // if (serverInformationList != null && serverInformationList.Any())
-            // {
-            //     list = serverInformationList.Select(c => new ServerInfoDTO()
-            //     {
-            //         Name = c.Name,
-            //         Host = c.ServerUrl
-            //     }).ToList();
-            // }
+            var serverInformationList = CacheMaintenance.Instance.Get<IDistributedServerInfosManager>()
+            .Where(x => !string.IsNullOrEmpty(x.Name) && !string.IsNullOrEmpty(x.ServerUrl))?.ToList();
+            if (serverInformationList != null && serverInformationList.Any())
+            {
+                list = serverInformationList.Select(c => new ServerInfoDTO()
+                {
+                    Name = c.Name,
+                    Host = c.ServerUrl
+                }).ToList();
+            }
             return await Task.FromResult(list);
         }
 
         /// <summary>
-        /// 测速接� 
+        /// 测速接å�
         /// </summary>
         /// <returns></returns>
         public async Task<EchoResult> EchoAsync()