mirror of
https://github.com/certd/certd.git
synced 2026-04-24 04:17:25 +08:00
perf: 支持ftp上传
This commit is contained in:
@@ -75,7 +75,8 @@ export class AccessService extends BaseService<AccessEntity> implements IAccessS
|
||||
//星号保护
|
||||
const length = value.length;
|
||||
const subIndex = Math.min(2, length);
|
||||
const starLength = length - subIndex * 2;
|
||||
let starLength = length - subIndex * 2;
|
||||
starLength = Math.max(2, starLength);
|
||||
const starString = '*'.repeat(starLength);
|
||||
json[key] = value.substring(0, subIndex) + starString + value.substring(value.length - subIndex);
|
||||
encryptSetting[key] = {
|
||||
|
||||
@@ -74,14 +74,15 @@ export class SysSettingsService extends BaseService<SysSettingsEntity> {
|
||||
async getSetting<T>(type: any): Promise<T> {
|
||||
const key = type.__key__;
|
||||
const cacheKey = type.getCacheKey();
|
||||
let settings: T = await this.cache.get(cacheKey);
|
||||
let settingInstance: T = new type();
|
||||
if (settings == null) {
|
||||
settings = await this.getSettingByKey(key);
|
||||
settingInstance = _.merge(settingInstance, settings);
|
||||
await this.cache.set(key, settingInstance);
|
||||
const settings: T = await this.cache.get(cacheKey);
|
||||
if (settings) {
|
||||
return settings;
|
||||
}
|
||||
return settingInstance;
|
||||
let newSetting: T = new type();
|
||||
const savedSettings = await this.getSettingByKey(key);
|
||||
newSetting = _.merge(newSetting, savedSettings);
|
||||
await this.cache.set(cacheKey, newSetting);
|
||||
return newSetting;
|
||||
}
|
||||
|
||||
async saveSetting<T extends BaseSettings>(bean: T) {
|
||||
|
||||
Reference in New Issue
Block a user