diff --git a/src/admin/Bootstrap.Admin/Models/HeaderBarModel.cs b/src/admin/Bootstrap.Admin/Models/HeaderBarModel.cs index aeab1773..6297ab60 100644 --- a/src/admin/Bootstrap.Admin/Models/HeaderBarModel.cs +++ b/src/admin/Bootstrap.Admin/Models/HeaderBarModel.cs @@ -24,6 +24,10 @@ namespace Bootstrap.Admin.Models AppCode = user.App; Css = user.Css; ActiveCss = string.IsNullOrEmpty(Css) ? Theme : Css; + + // 通过 AppCode 获取用户默认应用的标题 + Title = DictHelper.RetrieveWebTitle(AppCode); + Footer = DictHelper.RetrieveWebFooter(AppCode); } } diff --git a/src/admin/Bootstrap.Admin/Models/ModelBase.cs b/src/admin/Bootstrap.Admin/Models/ModelBase.cs index cb445d5f..50dcdc3c 100644 --- a/src/admin/Bootstrap.Admin/Models/ModelBase.cs +++ b/src/admin/Bootstrap.Admin/Models/ModelBase.cs @@ -29,12 +29,12 @@ namespace Bootstrap.Admin.Models /// /// 获取 网站标题 /// - public string Title { get; private set; } + public string Title { get; protected set; } /// /// 获取 网站页脚 /// - public string Footer { get; private set; } + public string Footer { get; protected set; } /// /// 网站样式全局设置 diff --git a/src/admin/Bootstrap.DataAccess.MongoDB/Dict.cs b/src/admin/Bootstrap.DataAccess.MongoDB/Dict.cs index 1f067f5a..b5d131a1 100644 --- a/src/admin/Bootstrap.DataAccess.MongoDB/Dict.cs +++ b/src/admin/Bootstrap.DataAccess.MongoDB/Dict.cs @@ -74,21 +74,23 @@ namespace Bootstrap.DataAccess.MongoDB } /// - /// + /// 获得网站标题设置 /// + /// /// - public override string RetrieveWebTitle() + public override string RetrieveWebTitle(string appId = "0") { - var code = RetrieveAppName("网站标题"); + var code = RetrieveAppName("网站标题", appId); if (code == "网站标题未设置") code = DictHelper.RetrieveDicts().FirstOrDefault(d => d.Name == "网站标题" && d.Category == "网站设置" && d.Define == 0)?.Code ?? "后台管理系统"; return code; } /// - /// + /// 获得网站页脚设置 /// + /// /// - public override string RetrieveWebFooter() + public override string RetrieveWebFooter(string appId = "0") { var code = RetrieveAppName("网站页脚"); if (code == "网站页脚未设置") code = DictHelper.RetrieveDicts().FirstOrDefault(d => d.Name == "网站页脚" && d.Category == "网站设置" && d.Define == 0)?.Code ?? "2016 © 通用后台管理系统"; diff --git a/src/admin/Bootstrap.DataAccess/Dict.cs b/src/admin/Bootstrap.DataAccess/Dict.cs index a28b9e27..66de0427 100644 --- a/src/admin/Bootstrap.DataAccess/Dict.cs +++ b/src/admin/Bootstrap.DataAccess/Dict.cs @@ -63,11 +63,13 @@ namespace Bootstrap.DataAccess /// /// 获取系统网站标题 /// + /// /// - public virtual string RetrieveWebTitle() + public virtual string RetrieveWebTitle(string appId = "0") { // 优先查找配置的应用程序网站标题 - var code = DbHelper.RetrieveTitle(); + var code = DbHelper.RetrieveTitle(appId); + if (code == "网站标题未设置") code = DictHelper.RetrieveDicts().FirstOrDefault(d => d.Name == "网站标题" && d.Category == "网站设置" && d.Define == 0)?.Code ?? "后台管理系统"; return code; } @@ -75,11 +77,12 @@ namespace Bootstrap.DataAccess /// /// 获取系统网站页脚 /// + /// /// - public virtual string RetrieveWebFooter() + public virtual string RetrieveWebFooter(string appId = "0") { // 优先查找配置的应用程序网站标题 - var code = DbHelper.RetrieveFooter(); + var code = DbHelper.RetrieveFooter(appId); 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/Helper/DictHelper.cs b/src/admin/Bootstrap.DataAccess/Helper/DictHelper.cs index ca3e2465..7ba70dc8 100644 --- a/src/admin/Bootstrap.DataAccess/Helper/DictHelper.cs +++ b/src/admin/Bootstrap.DataAccess/Helper/DictHelper.cs @@ -98,14 +98,16 @@ namespace Bootstrap.DataAccess /// /// 获取站点 Title 配置信息 /// + /// /// - public static string RetrieveWebTitle() => DbContextManager.Create().RetrieveWebTitle(); + public static string RetrieveWebTitle(string appId = "0") => DbContextManager.Create().RetrieveWebTitle(appId); /// /// 获取站点 Footer 配置信息 /// + /// /// - public static string RetrieveWebFooter() => DbContextManager.Create().RetrieveWebFooter(); + public static string RetrieveWebFooter(string appId = "0") => DbContextManager.Create().RetrieveWebFooter(appId); /// /// 获得系统中配置的可以使用的网站样式