diff --git a/src/admin/Bootstrap.DataAccess.MongoDB/Dict.cs b/src/admin/Bootstrap.DataAccess.MongoDB/Dict.cs index 79c4c7d8..1f067f5a 100644 --- a/src/admin/Bootstrap.DataAccess.MongoDB/Dict.cs +++ b/src/admin/Bootstrap.DataAccess.MongoDB/Dict.cs @@ -65,5 +65,34 @@ namespace Bootstrap.DataAccess.MongoDB DbManager.Dicts.FindOneAndUpdate(md => md.Category == dict.Category && md.Name == dict.Name, Builders.Update.Set(md => md.Code, dict.Code)); return true; } + + private static string RetrieveAppName(string name, string appId = "0", string defaultValue = "未设置") + { + var dicts = DictHelper.RetrieveDicts(); + var platName = dicts.FirstOrDefault(d => d.Category == "应用程序" && d.Code == appId)?.Name; + return dicts.FirstOrDefault(d => d.Category == platName && d.Name == name)?.Code ?? $"{name}{defaultValue}"; + } + + /// + /// + /// + /// + public override string RetrieveWebTitle() + { + var code = RetrieveAppName("网站标题"); + if (code == "网站标题未设置") code = DictHelper.RetrieveDicts().FirstOrDefault(d => d.Name == "网站标题" && d.Category == "网站设置" && d.Define == 0)?.Code ?? "后台管理系统"; + return code; + } + + /// + /// + /// + /// + public override string RetrieveWebFooter() + { + var code = RetrieveAppName("网站页脚"); + if (code == "网站页脚未设置") code = DictHelper.RetrieveDicts().FirstOrDefault(d => d.Name == "网站页脚" && d.Category == "网站设置" && d.Define == 0)?.Code ?? "2016 © 通用后台管理系统"; + return code; + } } } diff --git a/src/admin/Bootstrap.DataAccess/Dict.cs b/src/admin/Bootstrap.DataAccess/Dict.cs index 7d6cb47e..b8f1e238 100644 --- a/src/admin/Bootstrap.DataAccess/Dict.cs +++ b/src/admin/Bootstrap.DataAccess/Dict.cs @@ -64,13 +64,25 @@ namespace Bootstrap.DataAccess /// 获取系统网站标题 /// /// - public virtual string RetrieveWebTitle() => DbHelper.RetrieveTitle(); + public virtual string RetrieveWebTitle() + { + // 优先查找配置的应用程序网站标题 + var code = DbHelper.RetrieveTitle(); + if (code == "未设置") code = DictHelper.RetrieveDicts().FirstOrDefault(d => d.Name == "网站标题" && d.Category == "网站设置" && d.Define == 0)?.Code ?? "后台管理系统"; + return code; + } /// /// 获取系统网站页脚 /// /// - public virtual string RetrieveWebFooter() => DbHelper.RetrieveFooter(); + public virtual string RetrieveWebFooter() + { + // 优先查找配置的应用程序网站标题 + var code = DbHelper.RetrieveFooter(); + if (code == "未设置") code = DictHelper.RetrieveDicts().FirstOrDefault(d => d.Name == "网站页脚" && d.Category == "网站设置" && d.Define == 0)?.Code ?? "2016 © 通用后台管理系统"; + return code; + } /// /// 获得系统中配置的可以使用的网站样式 diff --git a/src/client/Bootstrap.Client.DataAccess.MongoDB/Dict.cs b/src/client/Bootstrap.Client.DataAccess.MongoDB/Dict.cs index 8281bc45..f28a7155 100644 --- a/src/client/Bootstrap.Client.DataAccess.MongoDB/Dict.cs +++ b/src/client/Bootstrap.Client.DataAccess.MongoDB/Dict.cs @@ -15,5 +15,54 @@ namespace Bootstrap.Client.DataAccess.MongoDB /// /// public override IEnumerable RetrieveDicts() => DbManager.Dicts.Find(FilterDefinition.Empty).ToList(); + + /// + /// 获取应用程序配置值 + /// + /// + /// + /// + /// + private string RetrieveAppName(string name, string appId = "0", string defaultValue = "未设置") + { + var dicts = DictHelper.RetrieveDicts(); + var platName = dicts.FirstOrDefault(d => d.Category == "应用程序" && d.Code == appId)?.Name; + return dicts.FirstOrDefault(d => d.Category == platName && d.Name == name)?.Code ?? $"{name}{defaultValue}"; + } + + /// + /// 获取系统网站标题 + /// + /// App 应用ID 默认为 0 表示后台管理程序 + /// + public override string RetrieveWebTitle(string appId) => RetrieveAppName("网站标题", appId); + + /// + /// 获取系统网站页脚 + /// + /// App 应用ID 默认为 0 表示后台管理程序 + /// + public override string RetrieveWebFooter(string appId) => RetrieveAppName("网站页脚", appId); + + /// + /// 获得系统设置地址 + /// + /// App 应用ID 默认为 0 表示后台管理程序 + /// + public override string RetrieveSettingsUrl(string appId) => RetrieveAppName("系统设置地址", appId); + + /// + /// 获得系统个人中心地址 + /// + /// App 应用ID 默认为 0 表示后台管理程序 + /// + public override string RetrieveProfilesUrl(string appId) => RetrieveAppName("个人中心地址", appId); + + /// + /// 获得系统通知地址地址 + /// + /// App 应用ID 默认为 0 表示后台管理程序 + /// + public override string RetrieveNotisUrl(string appId) => RetrieveAppName("系统通知地址", appId); } } diff --git a/src/client/Bootstrap.Client.DataAccess/Dict.cs b/src/client/Bootstrap.Client.DataAccess/Dict.cs index 39459128..937d46fc 100644 --- a/src/client/Bootstrap.Client.DataAccess/Dict.cs +++ b/src/client/Bootstrap.Client.DataAccess/Dict.cs @@ -12,18 +12,6 @@ namespace Bootstrap.Client.DataAccess /// public class Dict : BootstrapDict { - /// - /// 获取系统网站标题 - /// - /// - public virtual string RetrieveWebTitle(string appId) => DbHelper.RetrieveTitle(appId); - - /// - /// 获取系统网站页脚 - /// - /// - public virtual string RetrieveWebFooter(string appId) => DbHelper.RetrieveFooter(appId); - /// /// 获得网站设置中的当前样式 /// @@ -89,6 +77,20 @@ namespace Bootstrap.Client.DataAccess /// public virtual string RetrieveIconFolderPath() => (DictHelper.RetrieveDicts().FirstOrDefault(d => d.Name == "头像路径" && d.Category == "头像地址" && d.Define == 0) ?? new BootstrapDict { Code = "~/images/uploader/" }).Code; + /// + /// 获取系统网站标题 + /// + /// App 应用ID 默认为 0 表示后台管理程序 + /// + public virtual string RetrieveWebTitle(string appId) => DbHelper.RetrieveTitle(appId); + + /// + /// 获取系统网站页脚 + /// + /// App 应用ID 默认为 0 表示后台管理程序 + /// + public virtual string RetrieveWebFooter(string appId) => DbHelper.RetrieveFooter(appId); + /// /// 获得系统设置地址 /// diff --git a/src/client/Bootstrap.Client/Bootstrap.Client.csproj b/src/client/Bootstrap.Client/Bootstrap.Client.csproj index 113fc5b8..44232d7c 100644 --- a/src/client/Bootstrap.Client/Bootstrap.Client.csproj +++ b/src/client/Bootstrap.Client/Bootstrap.Client.csproj @@ -10,6 +10,7 @@ +