using MySql.Data.MySqlClient; using StackExchange.Redis; public class Config { public const bool GameOnline = false; public ConfigurationOptions redis; public MySqlConnectionStringBuilder mysql; /// /// 结束倒计时 /// public int CountDownTimes => GameOnline ? 10 * 60 : 2 * 60; /// /// 结算地址 /// public string SettleUrl { get { var host = "192.168.10.87"; if (GameOnline) { host = "115.159.121.129"; } return $"http://{host}/ylsj2019/Gameserver/Amfphp/service_call/InquireApi/WorldBosSettle.php"; } } private Config() { } static private Config _ins; public static Config Ins { get { if (null == _ins) { if (GameOnline) { var host = "127.0.0.1"; var port = 6379; var pwd = "wanggang1985"; _ins = new Config() { redis = ConfigurationOptions.Parse($"{host}:{port},password={pwd},connectTimeout=2000"), mysql = new MySqlConnectionStringBuilder { Server = "127.0.0.1", UserID = "gwang", Password = "wanggang1985", Port = 3306, Database = "ylsj2019_pay", CharacterSet = "utf8" } }; } else { var host = "192.168.10.16"; var port = 6004; var pwd = "wanggang1985"; _ins = new Config() { redis = ConfigurationOptions.Parse($"{host}:{port},password={pwd},connectTimeout=2000"), mysql = new MySqlConnectionStringBuilder { Server = "192.168.10.16", UserID = "gwang", Password = "wanggang1985", Port = 3306, Database = "ylsj2019_pay", CharacterSet = "utf8" } }; } } return _ins; } } }