修改 Startup 加载 和Module 加载

This commit is contained in:
chfei committed 2026-09-23 18:47:54 +08:00
1 parent c732ecb1d2
commit c7fb447034
17 files changed
+462 -383

No files matched your search

@@ -246,6 +246,65 @@ namespace Store.Modules.CloudProduct.Controllers
return await _searchService.GetStatusAsync();
}
/// <summary>
/// 检查搜索索引是否存在。
/// </summary>
[HttpGet]
public async Task<bool> IndexExists()
{
return await _searchService.IndexExistsAsync();
}
/// <summary>
/// 检查索引映射(分析器)是否符合当前服务要求。
/// </summary>
[HttpGet]
public async Task<bool> IndexMappingHealthy()
{
return await _searchService.IsIndexMappingHealthyAsync();
}
/// <summary>
/// 创建搜索索引(含 IK 分词映射,已存在且映射正常时跳过)。
/// </summary>
[HttpPost]
public async Task<bool> CreateIndex()
{
return await _searchService.CreateIndexAsync();
}
/// <summary>
/// 删除搜索索引。
/// </summary>
[HttpPost]
public async Task DeleteIndex()
{
await _searchService.DeleteIndexAsync();
}
/// <summary>
/// 手动刷新搜索索引,使最新写入立即可搜索。
/// </summary>
[HttpPost]
public async Task RefreshIndex()
{
await _searchService.RefreshIndexAsync();
}
/// <summary>
/// 手动新增或覆盖一条搜索文档。
/// </summary>
[HttpPost]
public async Task AddSearchDocument([FromBody] GoodsSearchDocument document)
{
if (document == null || document.Id <= 0)
{
throw new AppException("请提供有效的搜索文档", ResultCode.ValidationError);
}
await _searchService.AddDocumentAsync(document);
}
/// <summary>
/// 读取指定商品详情:解压缩原始数据并返回 JSON。
/// </summary>