Config.cs 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. using MySql.Data.MySqlClient;
  2. using StackExchange.Redis;
  3. public class Config
  4. {
  5. public const bool GameOnline = false;
  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.87";
  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. CharacterSet = "utf8"
  51. }
  52. };
  53. }
  54. else
  55. {
  56. var host = "192.168.10.16";
  57. var port = 6004;
  58. var pwd = "wanggang1985";
  59. _ins = new Config()
  60. {
  61. redis = ConfigurationOptions.Parse($"{host}:{port},password={pwd},connectTimeout=2000"),
  62. mysql = new MySqlConnectionStringBuilder
  63. {
  64. Server = "192.168.10.16",
  65. UserID = "gwang",
  66. Password = "wanggang1985",
  67. Port = 3306,
  68. Database = "ylsj2019_pay",
  69. CharacterSet = "utf8"
  70. }
  71. };
  72. }
  73. }
  74. return _ins;
  75. }
  76. }
  77. }