Config.cs 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. using MySql.Data.MySqlClient;
  2. using StackExchange.Redis;
  3. public class Config
  4. {
  5. public const bool GameOnline = true;
  6. public ConfigurationOptions redis;
  7. public MySqlConnectionStringBuilder mysql;
  8. /// <summary>
  9. /// 结束倒计时
  10. /// </summary>
  11. public int CountDownTimes => GameOnline ? 10 * 60 : 2 * 60;
  12. /// <summary>
  13. /// 结算地址
  14. /// </summary>
  15. public string SettleUrl
  16. {
  17. get
  18. {
  19. var host = "192.168.10.86";
  20. if (GameOnline)
  21. {
  22. host = "115.159.121.129";
  23. }
  24. return $"http://{host}/ylsj2019/Gameserver/Amfphp/service_call/InquireApi/WorldBosSettle.php";
  25. }
  26. }
  27. private Config() { }
  28. static private Config _ins;
  29. public static Config Ins
  30. {
  31. get
  32. {
  33. if (null == _ins)
  34. {
  35. if (GameOnline)
  36. {
  37. var host = "127.0.0.1";
  38. var port = 6379;
  39. var pwd = "wanggang1985";
  40. _ins = new Config()
  41. {
  42. redis = ConfigurationOptions.Parse($"{host}:{port},password={pwd},connectTimeout=2000"),
  43. mysql = new MySqlConnectionStringBuilder
  44. {
  45. Server = "127.0.0.1",
  46. UserID = "gwang",
  47. Password = "wanggang1985",
  48. Port = 3306,
  49. Database = "ylsj2019_pay"
  50. }
  51. };
  52. }
  53. else
  54. {
  55. var host = "192.168.10.16";
  56. var port = 6004;
  57. var pwd = "wanggang1985";
  58. _ins = new Config()
  59. {
  60. redis = ConfigurationOptions.Parse($"{host}:{port},password={pwd},connectTimeout=2000"),
  61. mysql = new MySqlConnectionStringBuilder
  62. {
  63. Server = "192.168.10.16",
  64. UserID = "gwang",
  65. Password = "wanggang1985",
  66. Port = 3306,
  67. Database = "ylsj2019_pay"
  68. }
  69. };
  70. }
  71. }
  72. return _ins;
  73. }
  74. }
  75. }