节点配置增加产品信息

This commit is contained in:
GoEdgeLab
2022-01-09 10:44:17 +08:00
parent cd25e08962
commit c493350c32
2 changed files with 43 additions and 0 deletions

View File

@@ -4,6 +4,7 @@ import (
"encoding/json"
"fmt"
"github.com/TeaOSLab/EdgeAPI/internal/remotelogs"
"github.com/TeaOSLab/EdgeAPI/internal/utils"
"github.com/TeaOSLab/EdgeAPI/internal/zero"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
"github.com/TeaOSLab/EdgeCommon/pkg/systemconfigs"
@@ -157,6 +158,36 @@ func (this *SysSettingDAO) ReadUserServerConfig(tx *dbs.Tx) (*userconfigs.UserSe
return config, nil
}
// ReadAdminUIConfig 读取管理员界面配置
func (this *SysSettingDAO) ReadAdminUIConfig(tx *dbs.Tx, cacheMap *utils.CacheMap) (*systemconfigs.AdminUIConfig, error) {
var cacheKey = this.Table + ":ReadAdminUIConfig"
if cacheMap != nil {
cache, ok := cacheMap.Get(cacheKey)
if ok && cache != nil {
return cache.(*systemconfigs.AdminUIConfig), nil
}
}
valueJSON, err := this.ReadSetting(tx, systemconfigs.SettingCodeAdminUIConfig)
if err != nil {
return nil, err
}
if len(valueJSON) > 0 {
var config = &systemconfigs.AdminUIConfig{}
err = json.Unmarshal(valueJSON, config)
if err != nil {
return nil, err
}
if cacheMap != nil {
cacheMap.Put(cacheKey, config)
}
return config, nil
}
return &systemconfigs.AdminUIConfig{}, nil
}
// NotifyUpdate 通知更改
func (this *SysSettingDAO) NotifyUpdate(tx *dbs.Tx, code string) error {
switch code {