Uat_Study
hang 2023-04-06 11:17:42 +08:00
parent 8f745481f0
commit dc10030a67
2 changed files with 43 additions and 66 deletions

View File

@ -1,16 +1,13 @@
{ {
"ConnectionStrings": {
"hang": "Server=ZHOU;Database=IRaCIS;User ID=sa;Password=sa123456;"
},
"JwtSetting": { "JwtSetting": {
"SecurityKey": "3e6dbfa227234a03977a2f421bdb7f4f", // "SecurityKey": "3e6dbfa227234a03977a2f421bdb7f4f",
"Issuer": "IRaCIS", // "Issuer": "IRaCIS",
"Audience": "ZhiZhun", // "Audience": "ZhiZhun",
"TokenExpireDays": "7" // 7day "TokenExpireDays": "7"
}, },
"IpRateLimiting": { "IpRateLimiting": {
"EnableEndpointRateLimiting": true, //False: globally executed, true: executed for each "EnableEndpointRateLimiting": true,
"StackBlockedRequests": false, // set to false, rejected calls are not added to the throttle counter "StackBlockedRequests": false,
"RealIpHeader": "X-Real-IP", "RealIpHeader": "X-Real-IP",
"ClientIdHeader": "X-ClientId", "ClientIdHeader": "X-ClientId",
"QuotaExceededResponse": { "QuotaExceededResponse": {
@ -19,12 +16,10 @@
"StatusCode": 429 "StatusCode": 429
}, },
"HttpStatusCode": 429, "HttpStatusCode": 429,
//"IpWhitelist": [ "127.0.0.1", "::1/10", "192.168.0.0/24" ], "EndpointWhitelist": [
"EndpointWhitelist": [ "post:/study/archivestudy/*" ], "post:/study/archivestudy/*"
//"EndpointWhitelist": [ ], ],
//"EndpointWhitelist": ["post:/trial/getTrialList"], //demo
"IpWhitelist": [], "IpWhitelist": [],
//"ClientWhitelist": [ "dev-id-1", "dev-id-2" ],
"GeneralRules": [ "GeneralRules": [
{ {
"Endpoint": "*", "Endpoint": "*",
@ -48,7 +43,6 @@
} }
] ]
}, },
"easycaching": { "easycaching": {
"inmemory": { "inmemory": {
"MaxRdSecond": 120, "MaxRdSecond": 120,
@ -63,30 +57,19 @@
} }
} }
}, },
"UpdateConfig": {
"test": "123456",
"test1": "12345678"
},
"IRaCISBasicConfig": { "IRaCISBasicConfig": {
"DoctorCodePrefix": "RE", "DoctorCodePrefix": "RE",
"UserCodePrefix": "U", "UserCodePrefix": "U",
"QCChallengeCodePrefix": "Q", "QCChallengeCodePrefix": "Q",
"NoneDicomStudyCodePrefix": "NST", "NoneDicomStudyCodePrefix": "NST",
"DicomStudyCodePrefix": "ST", "DicomStudyCodePrefix": "ST",
"SystemSiteCodePrefix": "S", "SystemSiteCodePrefix": "S",
"DefaultPassword": "123456", "DefaultPassword": "123456",
"DefaultInternalOrganizationName": "ExtImaging", "DefaultInternalOrganizationName": "ExtImaging",
"ImageShareExpireDays": 10 "ImageShareExpireDays": 10
} }
//访 dicom ... ip
} }

View File

@ -109,9 +109,7 @@ namespace IRaCIS.Core.Application.Service.Common
//jObject.WriteTo(jsonTextWriter); //jObject.WriteTo(jsonTextWriter);
#endregion #endregion
#region test
//var json = File.ReadAllText("appsettings.json"); //var json = File.ReadAllText("appsettings.json");
//var jObject = JToken.Parse(json, new JsonLoadSettings { CommentHandling = CommentHandling.Load,DuplicatePropertyNameHandling=DuplicatePropertyNameHandling.Ignore }); //var jObject = JToken.Parse(json, new JsonLoadSettings { CommentHandling = CommentHandling.Load,DuplicatePropertyNameHandling=DuplicatePropertyNameHandling.Ignore });
@ -149,7 +147,7 @@ namespace IRaCIS.Core.Application.Service.Common
//File.WriteAllText("appsettings.json", updatedJson); //File.WriteAllText("appsettings.json", updatedJson);
// string json = @"{ //string json = @"{
// // This is a comment // // This is a comment
// ""Name"": ""John Smith"", // ""Name"": ""John Smith"",
// ""Age"": 30, // ""Age"": 30,
@ -162,21 +160,19 @@ namespace IRaCIS.Core.Application.Service.Common
// } // }
//}"; //}";
// // 使用 Json.NET 库解析 JSON 字符串 //// 使用 Json.NET 库解析 JSON 字符串
// JObject jObject = JObject.Parse(json,new JsonLoadSettings() { CommentHandling=CommentHandling.Load}); //JObject jObject = JObject.Parse(json, new JsonLoadSettings() { CommentHandling = CommentHandling.Load });
// // 修改属性 //// 修改属性
// jObject["Name"] = "Jane Smith"; //jObject["Name"] = "Jane Smith";
// // 将修改后的 JObject 对象序列化为 JSON 字符串并保留注释
// string newJson = jObject.ToString(Formatting.Indented);
// // 打印修改后的 JSON 字符串
// Console.WriteLine(newJson);
//// 将修改后的 JObject 对象序列化为 JSON 字符串并保留注释
//string newJson = jObject.ToString(Newtonsoft.Json.Formatting.Indented);
//// 打印修改后的 JSON 字符串
//Console.WriteLine(newJson);
#endregion
// 读取 Json 文件 // 读取 Json 文件
@ -184,40 +180,38 @@ namespace IRaCIS.Core.Application.Service.Common
var json = File.ReadAllText("appsettings.json"); var json = File.ReadAllText("appsettings.json");
JObject jsonObject = JObject.Parse(json, new JsonLoadSettings() { CommentHandling=CommentHandling.Load}); JObject jsonObject = JObject.Parse(json, new JsonLoadSettings() { CommentHandling = CommentHandling.Load });
// 获取 UpdateConfig 属性所在的节点 // 获取 UpdateConfig 属性所在的节点
JToken updateConfigNode = jsonObject.SelectToken("UpdateConfig"); JToken updateConfigNode = jsonObject.SelectToken("UpdateConfig");
JProperty updateConfigProperty = (JProperty)updateConfigNode.Parent; JProperty updateConfigProperty = (JProperty)updateConfigNode.Parent;
JObject updateConfigParent = (JObject)updateConfigProperty.Value; JObject updateConfigParent = (JObject)updateConfigProperty.Value;
// 向 updateConfigParent 添加或者属性 // 向 updateConfigParent 添加或者属性
updateConfigParent[key] = newValue; updateConfigParent[key] = newValue;
// 将更改保存回 Json 文件 // 将更改保存回 Json 文件
//File.WriteAllText(jsonFilePath, jsonObject.ToString()); File.WriteAllText(jsonFilePath, jsonObject.ToString());
using (var reader = new JsonTextReader(new StringReader(json))) //using (var reader = new JsonTextReader(new StringReader(json)))
using (var writer = new JsonTextWriter(new StreamWriter("appsettings.json"))) //using (var writer = new JsonTextWriter(new StreamWriter("appsettings.json")))
{ //{
while (reader.Read()) // while (reader.Read())
{ // {
if (reader.TokenType == JsonToken.PropertyName && (string)reader.Value == key) // if (reader.TokenType == JsonToken.PropertyName && (string)reader.Value == key)
{ // {
// Write the updated property value // // Write the updated property value
writer.WritePropertyName(key); // writer.WritePropertyName(key);
writer.WriteValue(newValue); // writer.WriteValue(newValue);
// reader.Read();
// continue;
// }
continue; // // Write all other tokens
} // writer.WriteToken(reader.TokenType, reader.Value);
// }
// Write all other tokens //}
writer.WriteToken(reader.TokenType, reader.Value);
}
}