chore: 😀代码优化

This commit is contained in:
喵你个旺呀 2025-02-10 10:31:24 +08:00
parent d052b8747c
commit 9edbea7f80
2 changed files with 2 additions and 4 deletions

View File

@ -182,8 +182,7 @@ public class SysConfigService : IDynamicApiController, ITransient
var value = _sysCacheService.Get<string>($"{CacheConst.KeyConfig}{code}");
if (string.IsNullOrEmpty(value))
{
var config = await _sysConfigRep.CopyNew().GetFirstAsync(u => u.Code == code);
value = config != null ? config.Value : default;
value = (await _sysConfigRep.CopyNew().GetFirstAsync(u => u.Code == code))?.Value;
_sysCacheService.Set($"{CacheConst.KeyConfig}{code}", value);
}
if (string.IsNullOrWhiteSpace(value)) return default;

View File

@ -182,8 +182,7 @@ public class SysConfigTenantService : IDynamicApiController, ITransient
var value = _sysCacheService.Get<string>($"{CacheConst.KeyConfig}{code}");
if (string.IsNullOrEmpty(value))
{
var config = await _sysConfigRep.CopyNew().GetFirstAsync(u => u.Code == code);
value = config != null ? config.Value : default;
value = (await _sysConfigRep.CopyNew().GetFirstAsync(u => u.Code == code))?.Value;
_sysCacheService.Set($"{CacheConst.KeyConfig}{code}", value);
}
if (string.IsNullOrWhiteSpace(value)) return default;