feat: 系统可暴露的配置信息

This commit is contained in:
TsMask
2023-10-25 17:05:03 +08:00
parent 633878f05a
commit 0d0ad90e1f
3 changed files with 69 additions and 2 deletions

View File

@@ -0,0 +1,45 @@
package service
import (
systemService "ems.agt/src/modules/system/service"
)
// 实例化服务层 CommontImpl 结构体
var NewCommontImpl = &CommontImpl{
sysUserService: systemService.NewSysUserImpl,
sysConfigService: systemService.NewSysConfigImpl,
}
// 通用请求 服务层处理
type CommontImpl struct {
// 用户信息服务
sysUserService systemService.ISysUser
// 参数配置服务
sysConfigService systemService.ISysConfig
}
// SystemConfigInfo 系统配置信息
func (s *CommontImpl) SystemConfigInfo() map[string]any {
infoMap := map[string]any{}
// 获取LOGO类型
logoType := s.sysConfigService.SelectConfigValueByKey("sys.logo.type")
infoMap["logoType"] = logoType
// 获取LOGO文件
filePathIcon := s.sysConfigService.SelectConfigValueByKey("sys.logo.filePathIcon")
infoMap["filePathIcon"] = filePathIcon
filePathBrand := s.sysConfigService.SelectConfigValueByKey("sys.logo.filePathBrand")
infoMap["filePathBrand"] = filePathBrand
// 获取系统名称
title := s.sysConfigService.SelectConfigValueByKey("sys.title")
infoMap["title"] = title
// 获取版权声明
copyright := s.sysConfigService.SelectConfigValueByKey("sys.copyright")
infoMap["copyright"] = copyright
// 获取是否开启用户注册功能
registerUser := s.sysConfigService.SelectConfigValueByKey("sys.account.registerUser")
infoMap["registerUser"] = registerUser
// 获取登录界面背景
loginBackground := s.sysConfigService.SelectConfigValueByKey("sys.loginBackground")
infoMap["loginBackground"] = loginBackground
return infoMap
}