修改拦截规则

Uat_Study
{872297557@qq.com} 2023-01-06 16:42:41 +08:00
parent 27f40962f7
commit c416cc1e9a
1 changed files with 15 additions and 2 deletions

View File

@ -115,13 +115,25 @@ namespace IRaCIS.Core.Application.Filter
if (trialIdIndex > -1)
{
// (?<="trialId" *: *").*?(?=",)
//使用正则 [0-9a-fA-F]{8}(-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}
var matchResult = Regex.Match(contentFromBody.Substring(trialIdIndex), @"[0-9a-fA-F]{8}(-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}");
if (matchResult.Success)
{
trialIdStr = matchResult.Value;
//有可能匹配错误 "trialId":"","documentId":"b8180000-3e2c-0016-9fe0-08da33f96236" 从缓存里面验证下
var cacheResultDic = _provider.GetAll<string>(new[] { matchResult.Value });
var trialStatusStr = cacheResultDic[matchResult.Value].Value;
if (!string.IsNullOrWhiteSpace(trialStatusStr))
{
trialIdStr = matchResult.Value;
}
}
else
{
@ -136,7 +148,7 @@ namespace IRaCIS.Core.Application.Filter
}
//通过path 或者body 找到trialId 了
if (trialIdStr != string.Empty)
if ( !string.IsNullOrWhiteSpace(trialIdStr))
{
//如果没缓存数据,可能定时任务没执行或者缓存丢失 在此重新缓存
@ -170,6 +182,7 @@ namespace IRaCIS.Core.Application.Filter
}
}
//添加项目 签名系统文档的时候 不做拦截 但是更新项目 签名项目文档的时候需要拦截
else if (_trialOptList.Any(t => t == TrialOpt.AddOrUpdateTrial ||t ==TrialOpt.SignSystemDocNoTrialId))
{
await next.Invoke();