diff --git a/internal/configloaders/admin_ui_config.go b/internal/configloaders/admin_ui_config.go index a6663cf6..954d872f 100644 --- a/internal/configloaders/admin_ui_config.go +++ b/internal/configloaders/admin_ui_config.go @@ -52,6 +52,15 @@ func UpdateAdminUIConfig(uiConfig *systemconfigs.AdminUIConfig) error { return nil } +// 是否显示财务信息 +func ShowFinance() bool { + config, _ := LoadAdminUIConfig() + if config != nil && !config.ShowFinance { + return false + } + return true +} + func loadAdminUIConfig() (*systemconfigs.AdminUIConfig, error) { if sharedAdminUIConfig != nil { return sharedAdminUIConfig, nil @@ -88,5 +97,6 @@ func defaultAdminUIConfig() *systemconfigs.AdminUIConfig { AdminSystemName: "GoEdge管理员系统", ShowOpenSourceInfo: true, ShowVersion: true, + ShowFinance: true, } } diff --git a/internal/configloaders/user_ui_config.go b/internal/configloaders/user_ui_config.go index eab50eb2..e85f4207 100644 --- a/internal/configloaders/user_ui_config.go +++ b/internal/configloaders/user_ui_config.go @@ -88,5 +88,6 @@ func defaultUserUIConfig() *systemconfigs.UserUIConfig { UserSystemName: "GoEdge用户系统", ShowOpenSourceInfo: true, ShowVersion: true, + ShowFinance: true, } } diff --git a/internal/web/actions/default/settings/ui/index.go b/internal/web/actions/default/settings/ui/index.go index 72ea4bd7..71ddda23 100644 --- a/internal/web/actions/default/settings/ui/index.go +++ b/internal/web/actions/default/settings/ui/index.go @@ -29,6 +29,7 @@ func (this *IndexAction) RunPost(params struct { ProductName string AdminSystemName string ShowOpenSourceInfo bool + ShowFinance bool ShowVersion bool Version string @@ -49,6 +50,7 @@ func (this *IndexAction) RunPost(params struct { config.ProductName = params.ProductName config.AdminSystemName = params.AdminSystemName config.ShowOpenSourceInfo = params.ShowOpenSourceInfo + config.ShowFinance = params.ShowFinance config.ShowVersion = params.ShowVersion config.Version = params.Version err = configloaders.UpdateAdminUIConfig(config) diff --git a/internal/web/actions/default/settings/user-ui/index.go b/internal/web/actions/default/settings/user-ui/index.go index 598cce09..61cfee2d 100644 --- a/internal/web/actions/default/settings/user-ui/index.go +++ b/internal/web/actions/default/settings/user-ui/index.go @@ -31,6 +31,7 @@ func (this *IndexAction) RunPost(params struct { ShowOpenSourceInfo bool ShowVersion bool Version string + ShowFinance bool Must *actions.Must CSRF *actionutils.CSRF @@ -51,6 +52,7 @@ func (this *IndexAction) RunPost(params struct { config.ShowOpenSourceInfo = params.ShowOpenSourceInfo config.ShowVersion = params.ShowVersion config.Version = params.Version + config.ShowFinance = params.ShowFinance err = configloaders.UpdateUserUIConfig(config) if err != nil { this.ErrorPage(err) diff --git a/internal/web/helpers/user_must_auth.go b/internal/web/helpers/user_must_auth.go index d7321b6a..7d33ce03 100644 --- a/internal/web/helpers/user_must_auth.go +++ b/internal/web/helpers/user_must_auth.go @@ -106,6 +106,7 @@ func (this *userMustAuth) BeforeAction(actionPtr actions.ActionWrapper, paramNam action.Data["teaShowOpenSourceInfo"] = config.ShowOpenSourceInfo action.Data["teaIsSuper"] = false action.Data["teaDemoEnabled"] = teaconst.IsDemo + action.Data["teaShowFinance"] = configloaders.ShowFinance() if !action.Data.Has("teaSubMenu") { action.Data["teaSubMenu"] = "" } @@ -238,6 +239,10 @@ func (this *userMustAuth) modules(adminId int64) []maps.Map { result := []maps.Map{} for _, m := range allMaps { + if m.GetString("code") == "finance" && !configloaders.ShowFinance() { + continue + } + module := m.GetString("module") if configloaders.AllowModule(adminId, module) { result = append(result, m) diff --git a/web/views/@default/clusters/regions/@menu.html b/web/views/@default/clusters/regions/@menu.html index 199ce0d4..41f9d3f4 100644 --- a/web/views/@default/clusters/regions/@menu.html +++ b/web/views/@default/clusters/regions/@menu.html @@ -1,6 +1,6 @@ 区域 - 价格 - | - + 价格 + | + \ No newline at end of file diff --git a/web/views/@default/settings/ui/index.html b/web/views/@default/settings/ui/index.html index 5fc92540..3e1b99e4 100644 --- a/web/views/@default/settings/ui/index.html +++ b/web/views/@default/settings/ui/index.html @@ -35,6 +35,12 @@

定制自己的版本号,留空表示使用系统自带的版本号。

+ + 是否显示财务相关功能 + + + + diff --git a/web/views/@default/settings/user-ui/index.html b/web/views/@default/settings/user-ui/index.html index bd749bd1..a49349e4 100644 --- a/web/views/@default/settings/user-ui/index.html +++ b/web/views/@default/settings/user-ui/index.html @@ -35,7 +35,14 @@

定制自己的版本号,留空表示使用系统自带的版本号。

+ + 是否显示财务相关功能 + + + + +

修改后,可能需要等待数分钟才会生效。

\ No newline at end of file