CrazyIter_Bin 5 ماه پیش
والد
کامیت
0fc1f82ecd
1فایلهای تغییر یافته به همراه12 افزوده شده و 5 حذف شده
  1. 12 5
      TEAMModelOS.Extension/IES.Exam/IES.ExamServer/Services/IndexService.cs

+ 12 - 5
TEAMModelOS.Extension/IES.Exam/IES.ExamServer/Services/IndexService.cs

@@ -230,19 +230,19 @@ namespace IES.ExamServer.Services
             }
             if (_url!.IsNotEmpty())
             {
-                List<int> ports = new List<int>();
+                List<UriInfo> ports = new List<UriInfo>();
                 foreach (var url in _url)
                 {
                     Uri uri = new Uri(url);
-                    ports.Add(uri.Port);
+                    device.uris.Add(new UriInfo { port= uri.Port, protocol= uri.Scheme });
                 }
-                device.port= string.Join(",", ports);
+                 
             }
             else
             {
                 throw new Exception("未获取到端口信息!");
             }
-            string hashData = ShaHashHelper.GetSHA1($"{device.name}-{device.remote}-{device.port}-{device.os}-{string.Join(",", device.networks.Select(x => $"{x.mac}-{x.ip}"))}");
+            string hashData = ShaHashHelper.GetSHA1($"{device.name}-{device.remote}-{string.Join(",", device.uris.Select(x => $"{x.port}-{x.protocol}"))}-{device.os}-{string.Join(",", device.networks.Select(x => $"{x.mac}-{x.ip}"))}");
             device.deviceId=hashData;
             return device;
         }
@@ -371,6 +371,13 @@ namespace IES.ExamServer.Services
             return device;
         }
     }
+
+    public class UriInfo 
+    {
+        public string? protocol { get; set; }
+        public int port { get; set; }
+       
+    }
     public class ServerDevice
     { 
         
@@ -412,7 +419,7 @@ namespace IES.ExamServer.Services
         /// <summary>
         /// 端口,可能有多个端口
         /// </summary>
-        public string? port { get; set; }
+        public List<UriInfo> uris { get; set; } = new List<UriInfo>();
         /// <summary>
         /// 地区
         /// </summary>