feat(config): 添加配置数据种子和根据key查询配置功能

- 添加初始密码配置项的种子数据 (sys.user.initPassword: 123456)
- 在 ConfigService 中新增 GetConfigKeyAsync 方法支持根据key查询配置值
This commit is contained in:
wcg
2026-01-04 10:13:51 +08:00
parent a50c45f7a3
commit fe7c1763ba
2 changed files with 64 additions and 0 deletions

View File

@@ -1,3 +1,4 @@
using Microsoft.AspNetCore.Mvc;
using SqlSugar;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
@@ -61,5 +62,18 @@ namespace Yi.Framework.Rbac.Application.Services
throw new UserFriendlyException(ConfigConst.Exist);
}
}
/// <summary>
/// 根据key查配置
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
///
[Route("config/config-key/{configKey}")]
public async Task<string> GetConfigKeyAsync(string configKey)
{
var entity = await _repository.GetAsync(x => x.ConfigKey == configKey);
return entity.ConfigValue;
}
}
}