解析 Request Header trialId
parent
d3ea103c85
commit
bfda98d254
|
@ -3,6 +3,7 @@ using IRaCIS.Core.Domain.Share;
|
|||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.Filters;
|
||||
using System.Text.RegularExpressions;
|
||||
using static IRaCIS.Core.Domain.Share.StaticData;
|
||||
|
||||
namespace IRaCIS.Core.Application.Filter
|
||||
|
@ -60,6 +61,25 @@ namespace IRaCIS.Core.Application.Filter
|
|||
var index = context.RouteData.Values.Keys.ToList().IndexOf("trialId");
|
||||
trialIdStr = context.RouteData.Values.Values.ToList()[index] as string;
|
||||
}
|
||||
else if (context.HttpContext.Request.Headers["Referer"].ToString().Contains("trialId"))
|
||||
{
|
||||
var headerStr = context.HttpContext.Request.Headers["Referer"].ToString();
|
||||
|
||||
var trialIdIndex = headerStr.IndexOf("trialId");
|
||||
|
||||
|
||||
var matchResult = Regex.Match(headerStr.Substring(trialIdIndex), @"[0-9a-fA-F]{8}(-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}");
|
||||
|
||||
if (matchResult.Success)
|
||||
{
|
||||
trialIdStr = matchResult.Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
context.Result = new JsonResult(ResponseOutput.NotOk("正则取请求Refer 中trialId 失败,请联系开发人员核查"));
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
#region body 中取数据
|
||||
|
@ -77,7 +97,21 @@ namespace IRaCIS.Core.Application.Filter
|
|||
|
||||
if (trialIdIndex > -1)
|
||||
{
|
||||
trialIdStr = contentFromBody.Substring(trialIdIndex + "TrialId".Length + 4, 36);
|
||||
//使用正则 [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;
|
||||
}
|
||||
else
|
||||
{
|
||||
context.Result = new JsonResult(ResponseOutput.NotOk("正则取请求Refer 中trialId 失败,请联系开发人员核查"));
|
||||
}
|
||||
|
||||
//使用字符串取 如果是swagger 可能有时取的不对 因为空格的原因
|
||||
//trialIdStr = contentFromBody.Substring(trialIdIndex + "TrialId".Length + 4, 36);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -2408,6 +2408,11 @@
|
|||
是否获取预览
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.ReadingTableQuestionAnswerInfo.QuestionMark">
|
||||
<summary>
|
||||
问题标识
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.GetTableAnswerRowInfoOutDto.OrderMark">
|
||||
<summary>
|
||||
序号标记
|
||||
|
@ -9294,7 +9299,7 @@
|
|||
<param name="inDto"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Application.Services.ReadingImageTaskService.FindChildQuestion(IRaCIS.Core.Application.Service.Reading.Dto.TrialReadQuestionData,System.Collections.Generic.List{IRaCIS.Core.Application.Service.Reading.Dto.TrialReadQuestionData},System.Collections.Generic.List{IRaCIS.Core.Application.Service.Reading.Dto.TableQuestionTrial},System.Collections.Generic.List{IRaCIS.Core.Application.Service.Reading.Dto.ReadingTableQuestionAnswerInfo},System.Collections.Generic.List{IRaCIS.Core.Application.Service.Reading.Dto.TableAnsweRowInfo})">
|
||||
<member name="M:IRaCIS.Application.Services.ReadingImageTaskService.FindChildQuestion(IRaCIS.Core.Application.Service.Reading.Dto.TrialReadQuestionData,System.Collections.Generic.List{IRaCIS.Core.Application.Service.Reading.Dto.TrialReadQuestionData},System.Collections.Generic.List{IRaCIS.Core.Application.Service.Reading.Dto.TableQuestionTrial},System.Collections.Generic.List{IRaCIS.Core.Application.Service.Reading.Dto.ReadingTableQuestionAnswerInfo},System.Collections.Generic.List{IRaCIS.Core.Application.Service.Reading.Dto.TableAnsweRowInfo},System.Collections.Generic.List{IRaCIS.Core.Domain.Models.OrganInfo})">
|
||||
<summary>
|
||||
获取子元素
|
||||
</summary>
|
||||
|
|
|
@ -82,6 +82,7 @@ namespace IRaCIS.Application.Services
|
|||
.WhereIf(selectionQuery.DepartmentId != null, t => t.DepartmentId == selectionQuery.DepartmentId)
|
||||
.WhereIf(selectionQuery.SpecialityId != null, t => t.SpecialityId == selectionQuery.SpecialityId)
|
||||
.WhereIf(trialConfig.TrialType == TrialType.NoneOfficial, t => t.IsVirtual ==true)
|
||||
.WhereIf(trialConfig.TrialType != TrialType.NoneOfficial, t => t.IsVirtual == false)
|
||||
.WhereIf(selectionQuery.HospitalId != null, t => t.HospitalId == selectionQuery.HospitalId)
|
||||
.WhereIf(selectionQuery.PositionId != null, t => t.PositionId == selectionQuery.PositionId)
|
||||
.WhereIf(selectionQuery.RankId != null, t => t.RankId == selectionQuery.RankId)
|
||||
|
|
|
@ -10,6 +10,7 @@ using IRaCIS.Core.Application.Contracts;
|
|||
using Microsoft.AspNetCore.Authorization;
|
||||
using IRaCIS.Core.Application.Auth;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using IRaCIS.Core.Application.Filter;
|
||||
|
||||
namespace IRaCIS.Core.Application.Services
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue