Config.cs 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. using System.IO;
  2. using MySql.Data.MySqlClient;
  3. using StackExchange.Redis;
  4. public class Config
  5. {
  6. public const bool GameOnline = true;
  7. public ConfigurationOptions redis;
  8. public MySqlConnectionStringBuilder mysql;
  9. public string mongo => GameOnline ? "mongodb://localhost:27017" : "mongodb://localhost:27017";
  10. /// <summary>
  11. /// 结束倒计时
  12. /// </summary>
  13. public int CountDownTimes => GameOnline ? 10 * 60 : 2 * 60;
  14. /// <summary>
  15. /// 结算地址
  16. /// </summary>
  17. public string SettleUrl
  18. {
  19. get
  20. {
  21. var host = "192.168.10.87";
  22. if (GameOnline)
  23. {
  24. host = "115.159.121.129";
  25. }
  26. return $"http://{host}/ylsj2019/Gameserver/Amfphp/service_call/InquireApi/WorldBosSettle.php";
  27. }
  28. }
  29. public string OutDir
  30. {
  31. get
  32. {
  33. <<<<<<< HEAD
  34. var dir = "/data/stat_out/";
  35. =======
  36. var dir = "/data/stat_out/";
  37. >>>>>>> 统计数据转存部分增加对客户端上报日志的转存代码.
  38. VerifyFolder(dir);
  39. return dir;
  40. }
  41. }
  42. /// <summary>
  43. /// 确保路径存在
  44. /// </summary>
  45. /// <param name="dir"></param>
  46. internal static void VerifyFolder(string dir)
  47. {
  48. if (!Directory.Exists(dir))
  49. {
  50. Directory.CreateDirectory(dir);
  51. }
  52. }
  53. private Config() { }
  54. static private Config _ins;
  55. public static Config Ins
  56. {
  57. get
  58. {
  59. if (null == _ins)
  60. {
  61. if (GameOnline)
  62. {
  63. var host = "127.0.0.1";
  64. var port = 6379;
  65. var pwd = "wanggang1985";
  66. _ins = new Config()
  67. {
  68. redis = ConfigurationOptions.Parse($"{host}:{port},password={pwd},connectTimeout=2000"),
  69. mysql = new MySqlConnectionStringBuilder
  70. {
  71. Server = "127.0.0.1",
  72. UserID = "gwang",
  73. Password = "wanggang1985",
  74. Port = 3306,
  75. Database = "ylsj2019_pay",
  76. CharacterSet = "utf8"
  77. }
  78. };
  79. }
  80. else
  81. {
  82. var host = "192.168.10.16";
  83. var port = 6004;
  84. var pwd = "wanggang1985";
  85. _ins = new Config()
  86. {
  87. redis = ConfigurationOptions.Parse($"{host}:{port},password={pwd},connectTimeout=2000"),
  88. mysql = new MySqlConnectionStringBuilder
  89. {
  90. Server = "192.168.10.16",
  91. UserID = "gwang",
  92. Password = "wanggang1985",
  93. Port = 3306,
  94. Database = "ylsj2019_pay",
  95. CharacterSet = "utf8"
  96. }
  97. };
  98. }
  99. }
  100. return _ins;
  101. }
  102. }
  103. }