diff --git a/src/client/Bootstrap.Client.DataAccess.MongoDB/Dict.cs b/src/client/Bootstrap.Client.DataAccess.MongoDB/Dict.cs index 67ae0456..8281bc45 100644 --- a/src/client/Bootstrap.Client.DataAccess.MongoDB/Dict.cs +++ b/src/client/Bootstrap.Client.DataAccess.MongoDB/Dict.cs @@ -1,5 +1,4 @@ using Bootstrap.Security; -using Longbow.Configuration; using MongoDB.Driver; using System.Collections.Generic; using System.Linq; @@ -16,30 +15,5 @@ namespace Bootstrap.Client.DataAccess.MongoDB /// /// public override IEnumerable RetrieveDicts() => DbManager.Dicts.Find(FilterDefinition.Empty).ToList(); - - private static string RetrieveAppName(string name, string defaultValue = "未设置") - { - var dicts = DictHelper.RetrieveDicts(); - var platName = dicts.FirstOrDefault(d => d.Category == "应用程序" && d.Code == ConfigurationManager.AppSettings["AppId"])?.Name; - return dicts.FirstOrDefault(d => d.Category == platName && d.Name == name)?.Code ?? $"{name}{defaultValue}"; - } - - /// - /// 获得系统设置地址 - /// - /// - public override string RetrieveSettingsUrl() => RetrieveAppName("系统设置地址"); - - /// - /// 获得系统个人中心地址 - /// - /// - public override string RetrieveProfilesUrl() => RetrieveAppName("个人中心地址"); - - /// - /// 获得系统通知地址地址 - /// - /// - public override string RetrieveNotisUrl() => RetrieveAppName("系统通知地址"); } } diff --git a/src/client/Bootstrap.Client.DataAccess/Bootstrap.Client.DataAccess.csproj b/src/client/Bootstrap.Client.DataAccess/Bootstrap.Client.DataAccess.csproj index 00fc802f..64226235 100644 --- a/src/client/Bootstrap.Client.DataAccess/Bootstrap.Client.DataAccess.csproj +++ b/src/client/Bootstrap.Client.DataAccess/Bootstrap.Client.DataAccess.csproj @@ -5,8 +5,9 @@ - + + diff --git a/src/client/Bootstrap.Client.DataAccess/Dict.cs b/src/client/Bootstrap.Client.DataAccess/Dict.cs index 14888409..39459128 100644 --- a/src/client/Bootstrap.Client.DataAccess/Dict.cs +++ b/src/client/Bootstrap.Client.DataAccess/Dict.cs @@ -16,13 +16,13 @@ namespace Bootstrap.Client.DataAccess /// 获取系统网站标题 /// /// - public virtual string RetrieveWebTitle() => (DictHelper.RetrieveDicts().FirstOrDefault(d => d.Name == "网站标题" && d.Category == "网站设置" && d.Define == 0) ?? new BootstrapDict() { Code = "后台管理系统" }).Code; + public virtual string RetrieveWebTitle(string appId) => DbHelper.RetrieveTitle(appId); /// /// 获取系统网站页脚 /// /// - public virtual string RetrieveWebFooter() => (DictHelper.RetrieveDicts().FirstOrDefault(d => d.Name == "网站页脚" && d.Category == "网站设置" && d.Define == 0) ?? new BootstrapDict() { Code = "2016 © 通用后台管理系统" }).Code; + public virtual string RetrieveWebFooter(string appId) => DbHelper.RetrieveFooter(appId); /// /// 获得网站设置中的当前样式 @@ -93,18 +93,18 @@ namespace Bootstrap.Client.DataAccess /// 获得系统设置地址 /// /// - public virtual string RetrieveSettingsUrl() => DbHelper.RetrieveSettingsUrl(); + public virtual string RetrieveSettingsUrl(string appId) => DbHelper.RetrieveSettingsUrl(appId); /// /// 获得系统个人中心地址 /// /// - public virtual string RetrieveProfilesUrl() => DbHelper.RetrieveProfilesUrl(); + public virtual string RetrieveProfilesUrl(string appId) => DbHelper.RetrieveProfilesUrl(appId); /// /// 获得系统通知地址地址 /// /// - public virtual string RetrieveNotisUrl() => DbHelper.RetrieveNotisUrl(); + public virtual string RetrieveNotisUrl(string appId) => DbHelper.RetrieveNotisUrl(appId); } } diff --git a/src/client/Bootstrap.Client.DataAccess/Helper/DictHelper.cs b/src/client/Bootstrap.Client.DataAccess/Helper/DictHelper.cs index 52b47694..ef9fd107 100644 --- a/src/client/Bootstrap.Client.DataAccess/Helper/DictHelper.cs +++ b/src/client/Bootstrap.Client.DataAccess/Helper/DictHelper.cs @@ -27,14 +27,16 @@ namespace Bootstrap.Client.DataAccess /// /// 获取站点 Title 配置信息 /// + /// App 应用ID 默认为 0 表示后台管理程序 /// - public static string RetrieveWebTitle() => DbContextManager.Create().RetrieveWebTitle(); + public static string RetrieveWebTitle(string appId) => DbContextManager.Create().RetrieveWebTitle(appId); /// /// 获取站点 Footer 配置信息 /// + /// App 应用ID 默认为 0 表示后台管理程序 /// - public static string RetrieveWebFooter() => DbContextManager.Create().RetrieveWebFooter(); + public static string RetrieveWebFooter(string appId) => DbContextManager.Create().RetrieveWebFooter(appId); /// /// 获得网站设置中的当前样式 @@ -94,20 +96,23 @@ namespace Bootstrap.Client.DataAccess /// /// 获得系统设置地址 /// + /// App 应用ID 默认为 0 表示后台管理程序 /// - public static string RetrieveSettingsUrl() => DbContextManager.Create().RetrieveSettingsUrl(); + public static string RetrieveSettingsUrl(string appId) => DbContextManager.Create().RetrieveSettingsUrl(appId); /// /// 获得系统个人中心地址 /// + /// App 应用ID 默认为 0 表示后台管理程序 /// - public static string RetrieveProfilesUrl() => DbContextManager.Create().RetrieveProfilesUrl(); + public static string RetrieveProfilesUrl(string appId) => DbContextManager.Create().RetrieveProfilesUrl(appId); /// /// 获得系统通知地址地址 /// + /// App 应用ID 默认为 0 表示后台管理程序 /// - public static string RetrieveNotisUrl() => DbContextManager.Create().RetrieveNotisUrl(); + public static string RetrieveNotisUrl(string appId) => DbContextManager.Create().RetrieveNotisUrl(appId); /// /// 配置 IP 地理位置查询配置项 注入方法调用此方法 diff --git a/src/client/Bootstrap.Client/Bootstrap.Client.csproj b/src/client/Bootstrap.Client/Bootstrap.Client.csproj index 1865e3e2..89d3ff7b 100644 --- a/src/client/Bootstrap.Client/Bootstrap.Client.csproj +++ b/src/client/Bootstrap.Client/Bootstrap.Client.csproj @@ -5,7 +5,7 @@ - + diff --git a/src/client/Bootstrap.Client/Models/HeaderBarModel.cs b/src/client/Bootstrap.Client/Models/HeaderBarModel.cs index 7970a388..87896541 100644 --- a/src/client/Bootstrap.Client/Models/HeaderBarModel.cs +++ b/src/client/Bootstrap.Client/Models/HeaderBarModel.cs @@ -21,9 +21,9 @@ namespace Bootstrap.Client.Models var user = UserHelper.RetrieveUserByUserName(identity.Name); DisplayName = user.DisplayName; UserName = user.UserName; - SettingsUrl = DictHelper.RetrieveSettingsUrl(); - ProfilesUrl = DictHelper.RetrieveProfilesUrl(); - NotisUrl = DictHelper.RetrieveNotisUrl(); + SettingsUrl = DictHelper.RetrieveSettingsUrl(AppId); + ProfilesUrl = DictHelper.RetrieveProfilesUrl(AppId); + NotisUrl = DictHelper.RetrieveNotisUrl(AppId); // set LogoutUrl var authHost = ConfigurationManager.Get().AuthHost; diff --git a/src/client/Bootstrap.Client/Models/ModelBase.cs b/src/client/Bootstrap.Client/Models/ModelBase.cs index 72a8c8c2..6f488b41 100644 --- a/src/client/Bootstrap.Client/Models/ModelBase.cs +++ b/src/client/Bootstrap.Client/Models/ModelBase.cs @@ -1,4 +1,5 @@ using Bootstrap.Client.DataAccess; +using Longbow.Configuration; namespace Bootstrap.Client.Models { @@ -12,11 +13,14 @@ namespace Bootstrap.Client.Models /// public ModelBase() { - Title = DictHelper.RetrieveWebTitle(); - Footer = DictHelper.RetrieveWebFooter(); + AppId = ConfigurationManager.GetValue("AppId", "2"); + Title = DictHelper.RetrieveWebTitle(AppId); + Footer = DictHelper.RetrieveWebFooter(AppId); Theme = DictHelper.RetrieveActiveTheme(); } + public string AppId { get; private set; } + /// /// 获取 网站标题 ///