Config_URL.cs 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. using System;
  2. internal class Config_URL
  3. {
  4. #region ' server '
  5. static Uri _appServerUrl;
  6. /// <summary>
  7. /// 服务器地址
  8. /// </summary>
  9. public static string Server_URL
  10. {
  11. get
  12. {
  13. if (null == _appServerUrl)
  14. {
  15. var path = "/Gameserver/Amfphp/";
  16. _appServerUrl = new UriBuilder(http_or_s, Server_Host, -1, RootPath + path).Uri;
  17. }
  18. return _appServerUrl.ToString();
  19. }
  20. }
  21. private readonly static string http_or_s= GlobalConfig.netType == eNetType.LAN ? "http" : "https";
  22. private readonly static string RootPath = GlobalConfig.netType switch
  23. {
  24. eNetType.TestOnline => "/TTTTTT",
  25. eNetType.T2Online => "/t2",
  26. eNetType.Online_dev => "/ylsj2019_dev",
  27. _ => "/ylsj2019"
  28. };
  29. /// <summary>
  30. /// 服务器主机地址
  31. /// </summary>
  32. public static string Server_Host
  33. {
  34. get
  35. {
  36. var host = "ylsjtt.game7000.com"; // 测试服
  37. if (GlobalConfig.netType == eNetType.LAN)
  38. {
  39. host = "wanggang.com"; // 内网地址
  40. }
  41. return host;
  42. }
  43. }
  44. /// <summary>
  45. /// 模拟支付请求地址URL
  46. /// </summary>
  47. public static string ImitatePayUrl => new UriBuilder(http_or_s, Server_Host, -1,RootPath+ "/Gameserver/Amfphp/service_call/pay/official/imitate/pay.php").Uri.ToString();
  48. #endregion
  49. #region ' CDN '
  50. static Uri _appCDNUrl;
  51. public static string CDN_Host
  52. {
  53. get { return Server_Host; }
  54. }
  55. /// <summary>
  56. /// 资源CDN服务器地址
  57. /// </summary>
  58. public static string CND_CheckURL
  59. {
  60. get
  61. {
  62. if (null == _appCDNUrl)
  63. {
  64. string method = GlobalConfig.netType == eNetType.LAN ? "http" : "https";
  65. string path = "/Gameserver/Amfphp/service_call/InquireApi/CheckUpdate.php";
  66. string root = GlobalConfig.netType switch
  67. {
  68. eNetType.TestOnline => "/TTTTTT",
  69. eNetType.T2Online => "/t2",
  70. eNetType.Online_dev => "/ylsj2019_dev",
  71. _ => "/ylsj2019"
  72. };
  73. _appCDNUrl = new UriBuilder(method, CDN_Host, -1, root + path).Uri;
  74. }
  75. return _appCDNUrl.ToString();
  76. }
  77. }
  78. #endregion
  79. }