|
@@ -580,7 +580,7 @@ namespace Hotline.Api.Controllers
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
[HttpGet("knowledge-status-data")]
|
|
|
- public async Task<object> KnowledgeStatus()
|
|
|
+ public async Task<Dictionary<string, dynamic>> KnowledgeStatus()
|
|
|
{
|
|
|
var tabNames = new List<KeyValuePair<int, string>>
|
|
|
{
|
|
@@ -591,7 +591,7 @@ namespace Hotline.Api.Controllers
|
|
|
};
|
|
|
|
|
|
return _baseDataApplication
|
|
|
- .FileType(0)
|
|
|
+ .FileType(EFileType.excel | EFileType.pdf)
|
|
|
.Add("tabNames", tabNames)
|
|
|
.Build();
|
|
|
}
|
|
@@ -640,6 +640,7 @@ namespace Hotline.Api.Controllers
|
|
|
var hotspot = await _hotspotTypeRepository.GetAsync(x => x.Id == dto.HotspotId);
|
|
|
hotspotHotSpotFullName = hotspot?.HotSpotFullName;
|
|
|
}
|
|
|
+
|
|
|
var sugar = _knowledgeRepository
|
|
|
.Queryable(false, false, false)
|
|
|
.Includes(x => x.User)
|
|
@@ -672,6 +673,12 @@ namespace Hotline.Api.Controllers
|
|
|
exp.Or(m => m.Content.Contains(keyword));
|
|
|
if (dto.RetrievalType == EKnowledgeRetrievalType.Summary)
|
|
|
exp.Or(m => m.Summary != null && m.Summary.Contains(keyword));
|
|
|
+ if (dto.RetrievalType == EKnowledgeRetrievalType.KeyWord)
|
|
|
+ {
|
|
|
+ var keywordEntity = await _knowledgeWordRepository.GetAsync(m => m.Tag == keyword && m.IsEnable == 0);
|
|
|
+ if (keywordEntity is null) continue;
|
|
|
+ exp.Or(m => SqlFunc.JsonArrayAny(m.Keywords, keywordEntity.Id));
|
|
|
+ }
|
|
|
}
|
|
|
sugar.Where(exp.ToExpression());
|
|
|
}
|
|
@@ -679,7 +686,7 @@ namespace Hotline.Api.Controllers
|
|
|
switch (dto.Sort)
|
|
|
{
|
|
|
case "2":
|
|
|
- sugar = sugar.OrderByDescending(p => p.Score);
|
|
|
+ sugar = sugar.OrderByDescending(p => p.CollectCount);
|
|
|
break;
|
|
|
case "3":
|
|
|
sugar = sugar.OrderByDescending(p => p.CreationTime);
|
|
@@ -692,6 +699,18 @@ namespace Hotline.Api.Controllers
|
|
|
return new PagedDto<KnowledgeRetrievalDataDto>(total, _mapper.Map<IReadOnlyList<KnowledgeRetrievalDataDto>>(temp));
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 知识检索页面基础数据
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpGet("knowretrieval/base_data")]
|
|
|
+ public async Task<Dictionary<string, dynamic>> GetKnowretrievalBaseData()
|
|
|
+ {
|
|
|
+ return _baseDataApplication
|
|
|
+ .KnowledgeRetrievalType(new[] { 3, 4})
|
|
|
+ .Build();
|
|
|
+ }
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 获取知识审批信息
|
|
|
/// </summary>
|
|
@@ -1285,6 +1304,13 @@ namespace Hotline.Api.Controllers
|
|
|
var collectNew = _mapper.Map<KnowledgeCollect>(dto);
|
|
|
await _knowledgeCollectRepository.AddAsync(collectNew, HttpContext.RequestAborted);
|
|
|
}
|
|
|
+ var count = await _knowledgeCollectRepository.Queryable()
|
|
|
+ .Where(m => m.KnowledgeId == dto.KnowledgeId && m.Collect == true).CountAsync();
|
|
|
+
|
|
|
+ await _knowledgeRepository.Updateable()
|
|
|
+ .Where(m => m.Id == dto.KnowledgeId)
|
|
|
+ .SetColumns(m => m.CollectCount == count)
|
|
|
+ .ExecuteCommandAsync();
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -1493,6 +1519,19 @@ namespace Hotline.Api.Controllers
|
|
|
await _knowApplication.AddKnowledgeHotWordAsync(dto, HttpContext.RequestAborted);
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 新增热词页面基础数据
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpGet("hotword/basedata")]
|
|
|
+ public async Task<Dictionary<string, dynamic>> AddKnowledgeHotWordBaseDataAsync()
|
|
|
+ {
|
|
|
+ return _baseDataApplication
|
|
|
+ .KnowledgeHotWordType()
|
|
|
+ .Build();
|
|
|
+ }
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 热词集合
|
|
|
/// </summary>
|