懒得勤快 4 yıl önce
ebeveyn
işleme
7d28b58bed

+ 4 - 3
src/Masuit.MyBlogs.Core/Controllers/ToolsController.cs

@@ -56,13 +56,14 @@ namespace Masuit.MyBlogs.Core.Controllers
             var ipAddress = IPAddress.Parse(ip);
             ViewBag.IP = ip;
             var cityInfo = Policy<CityResponse>.Handle<AddressNotFoundException>().Fallback(() => new CityResponse()).Execute(() => CommonHelper.MaxmindReader.City(ipAddress));
-            var location = ipAddress.GetIPLocation();
+            var loc = ipAddress.GetIPLocation();
             var address = new IpInfo()
             {
                 CityInfo = cityInfo,
-                Address = $"{location}(UTC{TZConvert.GetTimeZoneInfo(cityInfo.Location.TimeZone ?? "Asia/Shanghai").BaseUtcOffset.Hours:+#;-#;0})",
+                Address = loc.Location,
                 Asn = ipAddress.GetIPAsn(),
-                IsProxy = location.ToString().Contains(new[] { "cloud", "Compute", "Serv", "Tech", "Solution", "Host", "云", "Datacenter", "Data Center", "Business" }) || await ipAddress.IsProxy()
+                TimeZone = $"UTC{TZConvert.GetTimeZoneInfo(cityInfo.Location.TimeZone ?? "Asia/Shanghai").BaseUtcOffset.Hours:+#;-#;0}",
+                IsProxy = loc.Network.Contains(new[] { "cloud", "Compute", "Serv", "Tech", "Solution", "Host", "云", "Datacenter", "Data Center", "Business" }) || await ipAddress.IsProxy()
             };
             if (Request.Method.Equals(HttpMethods.Get))
             {

+ 1 - 0
src/Masuit.MyBlogs.Core/Models/ViewModel/IpInfo.cs

@@ -8,5 +8,6 @@ namespace Masuit.MyBlogs.Core.Models.ViewModel
         public CityResponse CityInfo { get; set; }
         public AsnResponse Asn { get; set; }
         public bool IsProxy { get; set; }
+        public string TimeZone { get; set; }
     }
 }

+ 10 - 2
src/Masuit.MyBlogs.Core/Views/Post/Details_Admin.cshtml

@@ -530,7 +530,15 @@
         }, function () { });
 	}
     
-function showViewer(data) { 
-    layer.alert(data);
+function showViewer(data) {
+    var html="";
+    for (let item of data) {
+        html+=`<p><a href="/tools/ip/${item.key}" target="_blank">${item.key}</a>:${item.value}</p>`;
+    }
+    layer.open({
+      type: 1,
+      area: ['800px',"60%"], //宽高
+      content: html
+    });
 }
 </script>

+ 1 - 1
src/Masuit.MyBlogs.Core/Views/Post/PostOnline.razor

@@ -37,7 +37,7 @@
     public void ShowViewer()
     {
         if (online>0) {
-            JS.InvokeVoidAsync("showViewer",CacheManager.Get(nameof(PostOnline) + ":" + Id).Select(s => s+":"+s.GetIPLocation()).Join("<br/>"));
+            JS.InvokeVoidAsync("showViewer",CacheManager.Get(nameof(PostOnline) + ":" + Id).Select(s => KeyValuePair.Create(s,s.GetIPLocation())));
         }
     }
 

+ 4 - 0
src/Masuit.MyBlogs.Core/Views/Tools/GetIPInfo.cshtml

@@ -48,6 +48,10 @@
             <td>参考地理位置:</td>
             <td>@Model.Address</td>
         </tr>
+        <tr>
+            <td>时区:</td>
+            <td>@Model.TimeZone</td>
+        </tr>
         <tr>
             <td>经纬度:</td>
             <td>(经度:@(Model.CityInfo.Location.Longitude),纬度:@(Model.CityInfo.Location.Latitude))</td>

+ 0 - 1
src/Masuit.MyBlogs.Core/wwwroot/ng-views/controllers/system.js

@@ -537,7 +537,6 @@ myApp.controller("firewall", ["$scope", "$http","NgTableParams","$timeout", func
 	$scope.detail= function(text) {
         layer.open({
           type: 1,
-          skin: 'layui-layer-rim', //加上边框
           area: ['600px', '80%'], //宽高
           content: text
         });