using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Security.Policy; using System.Text; using System.Threading.Tasks; public static class SysConfig { public static DateTime ToUtc(this DateTime time) { return time.AddHours(-AppConfigHelper.Get("TimeZone", 8)); } public static DateTime ToLocal(this DateTime utcTime) { return utcTime.AddHours(AppConfigHelper.Get("TimeZone", 8)); } public static DateTimeOffset ToLocal(this DateTimeOffset utcTime) { return utcTime.ToOffset(TimeSpan.FromHours(AppConfigHelper.Get("TimeZone", 8))); } public static string GetBaseUrl() { return $"http://{IpHelper.GetLocalIp()}:{AppConfigHelper.Get("HttpPort", 8090)}/api/"; } public static string GetUrl(string url) { if (url.StartsWith("/")) { return $"http://{IpHelper.GetLocalIp()}:{AppConfigHelper.Get("HttpPort", 8090)}/api{url}"; } else { return $"http://{IpHelper.GetLocalIp()}:{AppConfigHelper.Get("HttpPort", 8090)}/api/{url}"; } } }