SysConfig.cs 848 B

123456789101112131415161718192021222324252627282930313233
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Data.Entity;
  4. using System.IO;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. using XdCxRhDW.Entity;
  9. namespace XdCxRhDW.Repostory
  10. {
  11. public static class SysConfig
  12. {
  13. public static SysSetings Config { get; set; }
  14. public static DateTime ToUtc(this DateTime time)
  15. {
  16. return time.AddHours(-Config.ZoneHours);
  17. }
  18. public static string GetFullUrl(string url)
  19. {
  20. if (Config == null) return null;
  21. if (url.StartsWith("/"))
  22. {
  23. return $"http://{IpHelper.GetLocalIp()}:{Config.HttpPort}/api{url}";
  24. }
  25. else
  26. {
  27. return $"http://{IpHelper.GetLocalIp()}:{Config.HttpPort}/api/{url}";
  28. }
  29. }
  30. }
  31. }