From bfda98d254bb410fe5fff70d72d6f5983cdd41bb Mon Sep 17 00:00:00 2001
From: "{872297557@qq.com}" <872297557@qq.com>
Date: Wed, 4 Jan 2023 14:48:42 +0800
Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E6=9E=90=20Request=20Header=20=20tria?=
=?UTF-8?q?lId?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../BusinessFilter/TrialResourceFilter.cs | 36 ++++++++++++++++++-
.../IRaCIS.Core.Application.xml | 7 +++-
.../Service/Doctor/DoctorListService.cs | 1 +
.../Service/Document/TrialDocumentService.cs | 1 +
4 files changed, 43 insertions(+), 2 deletions(-)
diff --git a/IRaCIS.Core.Application/BusinessFilter/TrialResourceFilter.cs b/IRaCIS.Core.Application/BusinessFilter/TrialResourceFilter.cs
index 64964e14a..65bfc4bc0 100644
--- a/IRaCIS.Core.Application/BusinessFilter/TrialResourceFilter.cs
+++ b/IRaCIS.Core.Application/BusinessFilter/TrialResourceFilter.cs
@@ -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
diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
index 6f64259b6..292419d36 100644
--- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
+++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
@@ -2408,6 +2408,11 @@
是否获取预览
+
+
+ 问题标识
+
+
序号标记
@@ -9294,7 +9299,7 @@
-
+
获取子元素
diff --git a/IRaCIS.Core.Application/Service/Doctor/DoctorListService.cs b/IRaCIS.Core.Application/Service/Doctor/DoctorListService.cs
index 9bc73c8cd..25fb24457 100644
--- a/IRaCIS.Core.Application/Service/Doctor/DoctorListService.cs
+++ b/IRaCIS.Core.Application/Service/Doctor/DoctorListService.cs
@@ -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)
diff --git a/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs b/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs
index b71db865f..1f4327746 100644
--- a/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs
+++ b/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs
@@ -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
{