using Autofac; using Entity.Constant; using HybirdFrameworkCore.Autofac; using Service.Station; using Service.System; namespace Service.Init; /// /// 换电站基本信息静态数据 /// public class StaticStationInfo { public static StationConstant.StationStatus StationStatus; public static StationConstant.StationWay StationWay; public static StationConstant.StationModel StationModel; public static string StationName { get => Resolve(StationParamConst.StationName); set => Set(StationParamConst.StationName, value); } public static string StationNo { get => Resolve(StationParamConst.StationNo); set => Set(StationParamConst.StationNo, value); } #region cloud public static string CloudServerIp { get => Resolve(StationParamConst.CloudServerIp); set => Set(StationParamConst.CloudServerIp, value); } public static int CloudServerPort { get => int.Parse(Resolve(StationParamConst.CloudServerPort)); set => Set(StationParamConst.CloudServerPort, value); } public static string CloudClientId { get => Resolve(StationParamConst.CloudClientId); set => Set(StationParamConst.CloudClientId, value); } public static string CloudUsername { get => Resolve(StationParamConst.CloudUsername); set => Set(StationParamConst.CloudUsername, value); } public static string CloudPassword { get => Resolve(StationParamConst.CloudPassword); set => Set(StationParamConst.CloudPassword, value); } public static string CloudSubTopic { get => Resolve(StationParamConst.CloudSubTopic); set => Set(StationParamConst.CloudSubTopic, value); } public static string CloudPubTopic { get => Resolve(StationParamConst.CloudPubTopic); set => Set(StationParamConst.CloudPubTopic, value); } #endregion #region db method private static SysConfigService _sysConfigService; private static string Resolve(string key) { if (_sysConfigService == null) { _sysConfigService = AppInfo.Container.Resolve(); } string? s = _sysConfigService.Get(key); if (s != null) { return s; } return "33000"; } private static void Set(string key, object value) { if (_sysConfigService == null) { _sysConfigService = AppInfo.Container.Resolve(); } _sysConfigService.Set(key, value); } #endregion }