feat: 文件备份/CDR/LOG本地文件列表功能接口

This commit is contained in:
TsMask
2025-05-09 18:31:23 +08:00
parent 5e7c9bb7e0
commit 2f27466408
15 changed files with 1287 additions and 73 deletions

View File

@@ -3,8 +3,10 @@ package service
import (
"fmt"
"be.ems/src/framework/config"
"be.ems/src/framework/constants/cachekey"
"be.ems/src/framework/database/redis"
"be.ems/src/framework/utils/crypto"
"be.ems/src/modules/system/model"
"be.ems/src/modules/system/repository"
)
@@ -168,3 +170,40 @@ func (r *SysConfigImpl) SelectConfigByKey(configKey string) model.SysConfig {
}
return model.SysConfig{}
}
// FindByKey 查询配置信息BY键
func (s SysConfigImpl) FindByKey(configKey string) model.SysConfig {
sysConf := s.sysConfigRepository.SelectConfigList(model.SysConfig{
ConfigKey: configKey,
})
if len(sysConf) > 0 {
return sysConf[0]
}
return model.SysConfig{}
}
// UpdateEncryptValue 更新并加密配置值信息
func (s SysConfigImpl) UpdateEncryptValue(sysConfig model.SysConfig) int64 {
appKey := config.Get("aes.appKey").(string)
bodyEn, err := crypto.AESEncryptBase64(sysConfig.ConfigValue, appKey)
if err != nil {
return 0
}
sysConfig.ConfigValue = bodyEn
return s.UpdateConfig(sysConfig)
}
// FindByKeyDecryptValue 获取并解密配置值信息
func (s SysConfigImpl) FindByKeyDecryptValue(configKey string) model.SysConfig {
item := s.FindByKey(configKey)
if item.ConfigKey != configKey {
return item
}
appKey := config.Get("aes.appKey").(string)
bodyDe, err := crypto.AESDecryptBase64(item.ConfigValue, appKey)
if err != nil {
return item
}
item.ConfigValue = bodyDe
return item
}