浏览代码

题目数量统计

CrazyIter_Bin 3 年之前
父节点
当前提交
00d1503b9d

+ 33 - 42
TEAMModelFunction/MonitorServicesBus.cs

@@ -393,63 +393,54 @@ namespace TEAMModelFunction
         {
         {
             try
             try
             {
             {
+                var client = _azureCosmos.GetCosmosClient();
                 var jsonMsg = JsonDocument.Parse(msg);
                 var jsonMsg = JsonDocument.Parse(msg);
-                if (jsonMsg.RootElement.ValueKind.Equals(JsonValueKind.Array))
+                await _dingDing.SendBotMsg($"{Environment.GetEnvironmentVariable("Option:Location")}-ServiceBus,ItemCond()\n题库数据变更:{msg}", GroupNames.醍摩豆服務運維群組);
+                List<ItemCondDto> itemCondDtos = msg.ToObject<List<ItemCondDto>>();
+                foreach (var itemCondDto in itemCondDtos)
                 {
                 {
-                    List<ItemCondDto> itemCondDtos = msg.ToObject<List<ItemCondDto>>();
-                    foreach (var itemCondDto in itemCondDtos)
-                    {
-                        var value = await _azureRedis.GetRedisClient(8).HashGetAsync($"ItemCond:{itemCondDto.key}", $"{itemCondDto.filed}");
+                    if (itemCondDto.scope.Equals("school")) {
                         ItemCond itemCond = null;
                         ItemCond itemCond = null;
-                        var client = _azureCosmos.GetCosmosClient();
-                        string containerId = itemCondDto.scope.Equals("private") ? "Teacher" : "School";
-                        if (value != default && !value.IsNullOrEmpty)
+                        List<ItemInfo> items = new List<ItemInfo>();
+                        var queryslt = $"SELECT c.gradeIds,c.subjectId,c.periodId,c.type,c.level,c.field ,c.scope FROM c where   c.periodId='{itemCondDto.filed}' and c.pid= null  ";
+                        await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIterator<ItemInfo>(queryText: queryslt, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Item-{itemCondDto.key}") }))
                         {
                         {
-
-                            itemCond = value.ToString().ToObject<ItemCond>();
+                            items.Add(item);
                         }
                         }
-                        else
+                        itemCond = new ItemCond()
                         {
                         {
-                            try
-                            {
-                                itemCond = await client.GetContainer(Constant.TEAMModelOS, containerId).ReadItemAsync<ItemCond>(itemCondDto.filed, new PartitionKey($"{itemCondDto.key}"));
-                            }
-                            catch (CosmosException)
-                            {
-                                itemCond = new ItemCond() { id = itemCondDto.filed, code = $"{itemCondDto.key}", pk = "ItemCond", ttl = -1, count = 0, grades = new List<GradeCount>(), subjects = new List<SubjectCount>() };
-                            };
-                        }
-                        ItemService.CountItemCond(itemCondDto.newItem, itemCondDto.odlItem, itemCond);
-                        await client.GetContainer(Constant.TEAMModelOS, containerId).UpsertItemAsync<ItemCond>(itemCond, new PartitionKey(itemCond.code));
+                            id = $"{itemCondDto.filed}",
+                            code = $"ItemCond-{itemCondDto.key}",
+                            pk = "ItemCond",
+                            ttl = -1,
+                            count = items.Count,
+                            grades = new List<GradeCount>(),
+                            subjects = new List<SubjectCount>()
+                        };
+                        items.ForEach(z =>
+                        {
+                            ItemService.CountItemCond(z, null, itemCond);
+                        });
                         await _azureRedis.GetRedisClient(8).HashSetAsync($"ItemCond:{itemCondDto.key}", $"{itemCondDto.filed}", itemCond.ToJsonString());
                         await _azureRedis.GetRedisClient(8).HashSetAsync($"ItemCond:{itemCondDto.key}", $"{itemCondDto.filed}", itemCond.ToJsonString());
                     }
                     }
-                }
-                else {
-                    ItemCondDto itemCondDto = msg.ToObject< ItemCondDto>();
-                    var value = await _azureRedis.GetRedisClient(8).HashGetAsync($"ItemCond:{itemCondDto.key}", $"{itemCondDto.filed}");
-                    ItemCond itemCond = null;
-                    var client = _azureCosmos.GetCosmosClient();
-                    string containerId = itemCondDto.scope.Equals("private") ? "Teacher" : "School";
-                    if (value != default && !value.IsNullOrEmpty)
-                    {
-
-                        itemCond = value.ToString().ToObject<ItemCond>();
-                    }
                     else
                     else
                     {
                     {
-                        try
+                        ItemCond itemCond = null;
+                        List<ItemInfo> items = new List<ItemInfo>();
+                        var queryslt = $"SELECT c.gradeIds,c.subjectId,c.periodId,c.type,c.level,c.field ,c.scope FROM c where c.pid= null  ";
+                        await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Teacher").GetItemQueryIterator<ItemInfo>(queryText: queryslt, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Item-{itemCondDto.filed}") }))
                         {
                         {
-                            itemCond = await client.GetContainer(Constant.TEAMModelOS, containerId).ReadItemAsync<ItemCond>(itemCondDto.filed, new PartitionKey($"{itemCondDto.key}"));
+                            items.Add(item);
                         }
                         }
-                        catch (CosmosException)
+                        itemCond = new ItemCond() { id = $"{itemCondDto.filed}", code = $"ItemCond", pk = "ItemCond", ttl = -1, count = items.Count };
+                        items.ForEach(z =>
                         {
                         {
-                            itemCond = new ItemCond() { id = itemCondDto.filed, code = $"{itemCondDto.key}", pk = "ItemCond", ttl = -1, count = 0, grades = new List<GradeCount>(), subjects = new List<SubjectCount>() };
-                        };
+                            ItemService.CountItemCond(z, null, itemCond);
+                        });
+                        await _azureRedis.GetRedisClient(8).HashSetAsync($"ItemCond:ItemCond", $"{itemCondDto.filed}", itemCond.ToJsonString());
                     }
                     }
-                    ItemService.CountItemCond(itemCondDto.newItem, itemCondDto.odlItem, itemCond);
-                    await client.GetContainer(Constant.TEAMModelOS, containerId).UpsertItemAsync<ItemCond>(itemCond, new PartitionKey(itemCond.code));
-                    await _azureRedis.GetRedisClient(8).HashSetAsync($"ItemCond:{itemCondDto.key}", $"{itemCondDto.filed}", itemCond.ToJsonString());
                 }
                 }
+                 
             }
             }
             catch (CosmosException ex )
             catch (CosmosException ex )
             {
             {

+ 1 - 2
TEAMModelOS.SDK/Models/Dtos/ItemCondDto.cs

@@ -6,8 +6,7 @@ namespace TEAMModelOS.SDK.Models
 {
 {
     public  class ItemCondDto
     public  class ItemCondDto
     {
     {
-        public ItemInfo newItem { get; set; }
-        public ItemInfo odlItem { get; set; }
+  
         public string key { get; set; }
         public string key { get; set; }
         public string filed { get; set; }
         public string filed { get; set; }
         public string scope { get; set; }
         public string scope { get; set; }

+ 189 - 97
TEAMModelOS/Controllers/Item/ItemController.cs

@@ -34,8 +34,10 @@ namespace TEAMModelOS.Controllers
         private readonly Option _option;
         private readonly Option _option;
         private readonly AzureStorageFactory _azureStorage;
         private readonly AzureStorageFactory _azureStorage;
         private readonly AzureServiceBusFactory _serviceBus;
         private readonly AzureServiceBusFactory _serviceBus;
+        private readonly AzureRedisFactory _azureRedis;
         public IConfiguration _configuration { get; set; }
         public IConfiguration _configuration { get; set; }
-        public ItemController(AzureCosmosFactory azureCosmos, SnowflakeId snowflakeId, DingDing dingDing, IOptionsSnapshot<Option> option, AzureStorageFactory azureStorage, AzureServiceBusFactory serviceBus, IConfiguration configuration)
+        public ItemController(AzureCosmosFactory azureCosmos, SnowflakeId snowflakeId, DingDing dingDing, IOptionsSnapshot<Option> option, AzureStorageFactory azureStorage,
+             AzureRedisFactory azureRedis,AzureServiceBusFactory serviceBus, IConfiguration configuration)
         {
         {
             _azureCosmos = azureCosmos;
             _azureCosmos = azureCosmos;
             _snowflakeId = snowflakeId;
             _snowflakeId = snowflakeId;
@@ -44,6 +46,7 @@ namespace TEAMModelOS.Controllers
             _azureStorage = azureStorage;
             _azureStorage = azureStorage;
             _serviceBus = serviceBus;
             _serviceBus = serviceBus;
             _configuration = configuration;
             _configuration = configuration;
+            _azureRedis = azureRedis;
         }
         }
         /// <summary>
         /// <summary>
         /// 参数{"periodId":"学段id","schoolCode":"学校编码"} 其中periodId 不填则是全部学段的。
         /// 参数{"periodId":"学段id","schoolCode":"学校编码"} 其中periodId 不填则是全部学段的。
@@ -61,49 +64,79 @@ namespace TEAMModelOS.Controllers
                 request.TryGetProperty("tmdid", out JsonElement tmdid);
                 request.TryGetProperty("tmdid", out JsonElement tmdid);
                 if (!string.IsNullOrEmpty($"{periodId}") && !string.IsNullOrEmpty($"{schoolCode}"))
                 if (!string.IsNullOrEmpty($"{periodId}") && !string.IsNullOrEmpty($"{schoolCode}"))
                 {
                 {
-                    // ItemCond itemCond = await client.GetContainer(Constant.TEAMModelOS, "School").ReadItemAsync<ItemCond>($"{periodId}", new PartitionKey($"ItemCond-{schoolCode}"));
-                    // return Ok(new { itemConds = new List<ItemCond>() { itemCond } });
-
-                    List<ItemInfo> items = new List<ItemInfo>();
-                    var queryslt = $"SELECT c.gradeIds,c.subjectId,c.periodId,c.type,c.level,c.field ,c.scope FROM c where   c.periodId='{periodId}' and c.pid= null  ";
-                    await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIterator<ItemInfo>(queryText: queryslt, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Item-{schoolCode}") }))
+                    var value = await _azureRedis.GetRedisClient(8).HashGetAsync($"ItemCond:{schoolCode}", $"{periodId}");
+                    ItemCond itemCond = null;
+                    if (value != default && !value.IsNullOrEmpty)
                     {
                     {
-                        items.Add(item);
+
+                        itemCond = value.ToString().ToObject<ItemCond>();
+                    }
+                    else {
+                        List<ItemInfo> items = new List<ItemInfo>();
+                        var queryslt = $"SELECT c.gradeIds,c.subjectId,c.periodId,c.type,c.level,c.field ,c.scope FROM c where   c.periodId='{periodId}' and c.pid= null  ";
+                        await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIterator<ItemInfo>(queryText: queryslt, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Item-{schoolCode}") }))
+                        {
+                            items.Add(item);
+                        }
+                        itemCond = new ItemCond()
+                        {
+                            id = $"{periodId}",
+                            code = $"ItemCond-{schoolCode}",
+                            pk = "ItemCond",
+                            ttl = -1,
+                            count = items.Count,
+                            grades = new List<GradeCount>(),
+                            subjects = new List<SubjectCount>()
+                        };
+                        items.ForEach(z =>
+                        {
+                            ItemService.CountItemCond(z, null, itemCond);
+                        });
+                        await _azureRedis.GetRedisClient(8).HashSetAsync($"ItemCond:{schoolCode}", $"{periodId}", itemCond.ToJsonString());
                     }
                     }
-                    ItemCond itemCond = new ItemCond() { 
-                        id = $"{periodId}",
-                        code = $"ItemCond-{schoolCode}", 
-                        pk = "ItemCond", 
-                        ttl = -1, 
-                        count = items.Count, 
-                        grades = new List<GradeCount>(), 
-                        subjects = new List<SubjectCount>()
-                    };
-                    items.ForEach(z =>
-                    {
-                        ItemService.CountItemCond(z, null, itemCond);
-                    });
                     return Ok(new { itemConds = new List<ItemCond>() { itemCond } });
                     return Ok(new { itemConds = new List<ItemCond>() { itemCond } });
                 }
                 }
                 else if (!string.IsNullOrEmpty($"{schoolCode}"))
                 else if (!string.IsNullOrEmpty($"{schoolCode}"))
                 {
                 {
+                    List<ItemCond> itemConds = new List<ItemCond>();
                     School school =await client.GetContainer(Constant.TEAMModelOS, "School").ReadItemAsync<School>($"{schoolCode}", new PartitionKey("Base"));
                     School school =await client.GetContainer(Constant.TEAMModelOS, "School").ReadItemAsync<School>($"{schoolCode}", new PartitionKey("Base"));
+                    List<string> nocachePeriods = new List<string>();
+                    foreach (var period in school.period) {
+                        var value = await _azureRedis.GetRedisClient(8).HashGetAsync($"ItemCond:{schoolCode}", $"{period.id}");
+                        ItemCond itemCond = null;
+                        if (value != default && !value.IsNullOrEmpty)
+                        {
+
+                            itemCond = value.ToString().ToObject<ItemCond>();
+                            itemConds.Add(itemCond);
+                        }
+                        else {
+                            nocachePeriods.Add(period.id);
+                        }
+                    }
+                    string nocachePeriodsql = "";
+                    if (nocachePeriods.IsNotEmpty())
+                    { 
+                        string  sql =   string.Join(',', nocachePeriods.Select(x => $"'{x}'"));
+                        nocachePeriodsql = $" and  c.periodId in ({sql})";
+                    }
+
                     List <ItemInfo> items = new List<ItemInfo>();
                     List <ItemInfo> items = new List<ItemInfo>();
-                    var queryslt = $"SELECT c.gradeIds,c.subjectId,c.periodId,c.type,c.level,c.field,c.scope FROM c where    c.pid= null  ";
+                    var queryslt = $"SELECT c.gradeIds,c.subjectId,c.periodId,c.type,c.level,c.field,c.scope FROM c where    c.pid= null  {nocachePeriodsql}";
                     await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIterator<ItemInfo>(queryText: queryslt, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Item-{schoolCode}") }))
                     await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIterator<ItemInfo>(queryText: queryslt, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Item-{schoolCode}") }))
                     {
                     {
                         items.Add(item);
                         items.Add(item);
                     }
                     }
-                    List<ItemCond> itemConds = new List<ItemCond>();
-                    items.GroupBy(x => x.periodId).Select(y => new { key = y.Key, list = y.ToList() }).ToList().ForEach(z =>
-                    {
+                    var list =   items.GroupBy(x => x.periodId).Select(y => new { key = y.Key, list = y.ToList() }).ToList();
+                    foreach (var z in list) {
                         ItemCond cond = new ItemCond() { id = z.key, code = $"ItemCond-{school.id}", pk = "ItemCond", ttl = -1, count = z.list.Count, grades = new List<GradeCount>(), subjects = new List<SubjectCount>() };
                         ItemCond cond = new ItemCond() { id = z.key, code = $"ItemCond-{school.id}", pk = "ItemCond", ttl = -1, count = z.list.Count, grades = new List<GradeCount>(), subjects = new List<SubjectCount>() };
                         z.list.ForEach(y =>
                         z.list.ForEach(y =>
                         {
                         {
                             ItemService.CountItemCond(y, null, cond);
                             ItemService.CountItemCond(y, null, cond);
                         });
                         });
+                        await _azureRedis.GetRedisClient(8).HashSetAsync($"ItemCond:{schoolCode}", $"{z.key}", cond.ToJsonString());
                         itemConds.Add(cond);
                         itemConds.Add(cond);
-                    });
+                    }
                     if (school != null) {
                     if (school != null) {
                         foreach (var period in school.period) {
                         foreach (var period in school.period) {
                            var cond= itemConds.Find(x => x.id.Equals(period.id));
                            var cond= itemConds.Find(x => x.id.Equals(period.id));
@@ -113,28 +146,31 @@ namespace TEAMModelOS.Controllers
                             }
                             }
                         }
                         }
                     }
                     }
-                    //var queryslt = $"SELECT  value(c) FROM c ";
-                    //await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIterator<ItemCond>(queryText: queryslt, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"ItemCond-{schoolCode}") }))
-                    //{
-                    //    items.Add(item);
-                    //}
-
                     return Ok(new { itemConds = itemConds });
                     return Ok(new { itemConds = itemConds });
                 }
                 }
                 else if (!string.IsNullOrEmpty($"{tmdid}"))
                 else if (!string.IsNullOrEmpty($"{tmdid}"))
                 {
                 {
-                    List<ItemInfo> items = new List<ItemInfo>();
-                    var queryslt = $"SELECT c.gradeIds,c.subjectId,c.periodId,c.type,c.level,c.field ,c.scope FROM c where c.pid= null  ";
-                    await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Teacher").GetItemQueryIterator<ItemInfo>(queryText: queryslt, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Item-{tmdid}") }))
+                    var value = await _azureRedis.GetRedisClient(8).HashGetAsync($"ItemCond:ItemCond", $"{tmdid}");
+                    ItemCond itemCond = null;
+                    if (value != default && !value.IsNullOrEmpty)
                     {
                     {
-                        items.Add(item);
+
+                        itemCond = value.ToString().ToObject<ItemCond>();
+                    }
+                    else {
+                        List<ItemInfo> items = new List<ItemInfo>();
+                        var queryslt = $"SELECT c.gradeIds,c.subjectId,c.periodId,c.type,c.level,c.field ,c.scope FROM c where c.pid= null  ";
+                        await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Teacher").GetItemQueryIterator<ItemInfo>(queryText: queryslt, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Item-{tmdid}") }))
+                        {
+                            items.Add(item);
+                        }
+                        itemCond = new ItemCond() { id = $"{tmdid}", code = $"ItemCond", pk = "ItemCond", ttl = -1, count = items.Count };
+                        items.ForEach(z =>
+                        {
+                            ItemService.CountItemCond(z, null, itemCond);
+                        });
+                        await _azureRedis.GetRedisClient(8).HashSetAsync($"ItemCond:ItemCond", $"{tmdid}", itemCond.ToJsonString());
                     }
                     }
-                    ItemCond itemCond = new ItemCond() { id = $"{tmdid}", code = $"ItemCond", pk = "ItemCond", ttl = -1, count = items.Count };
-                    items.ForEach(z =>
-                    {
-                        ItemService.CountItemCond(z, null, itemCond);
-                    });
-                    //ItemCond itemCond = await client.GetContainer(Constant.TEAMModelOS, "Teacher").ReadItemAsync<ItemCond>($"{tmdid}", new PartitionKey($"ItemCond"));
                     return Ok(new { itemConds = new List<ItemCond>() { itemCond } });
                     return Ok(new { itemConds = new List<ItemCond>() { itemCond } });
                 }
                 }
                 else
                 else
@@ -155,14 +191,14 @@ namespace TEAMModelOS.Controllers
         [HttpPost("upsert-all")]
         [HttpPost("upsert-all")]
         public async Task<IActionResult> UpsertAll(JsonElement request)
         public async Task<IActionResult> UpsertAll(JsonElement request)
         {
         {
-           // var ItemCondQueue = _configuration.GetValue<string>("Azure:ServiceBus:ItemCondQueue");
+            var ItemCondQueue = _configuration.GetValue<string>("Azure:ServiceBus:ItemCondQueue");
             var client = _azureCosmos.GetCosmosClient();
             var client = _azureCosmos.GetCosmosClient();
             List<ItemInfo> itemInfos = null;
             List<ItemInfo> itemInfos = null;
             if (!request.TryGetProperty("itemInfos", out JsonElement items)) return BadRequest();
             if (!request.TryGetProperty("itemInfos", out JsonElement items)) return BadRequest();
             if (!request.TryGetProperty("option", out JsonElement option)) return BadRequest();
             if (!request.TryGetProperty("option", out JsonElement option)) return BadRequest();
             try
             try
             {
             {
-              //  List<ItemCondDto> itemCondDtos = new List<ItemCondDto>();
+                Dictionary<string, ItemCondDto> dict = new Dictionary<string, ItemCondDto>();
                 itemInfos = items.ToObject<List<ItemInfo>>();
                 itemInfos = items.ToObject<List<ItemInfo>>();
                 foreach (var itemInfo in itemInfos) {
                 foreach (var itemInfo in itemInfos) {
                     itemInfo.ttl = -1;
                     itemInfo.ttl = -1;
@@ -187,20 +223,25 @@ namespace TEAMModelOS.Controllers
                         {
                         {
                             if (itemInfo.scope.Equals("private"))
                             if (itemInfo.scope.Equals("private"))
                             {
                             {
-                                //if (string.IsNullOrEmpty(itemInfo.pid)) {
-                                //    ItemCondDto itemCondDto = new ItemCondDto { newItem = itemInfo, key = "ItemCond", filed = itemInfo.code.Replace("Item-", ""), scope = "private" };
-                                //    itemCondDtos.Add(itemCondDto);
-                                //}
+                                if (string.IsNullOrEmpty(itemInfo.pid))
+                                {
+                                    if (!dict.ContainsKey($"{itemInfo.code.Replace("Item-", "")}"))
+                                    {
+                                        dict.Add($"{itemInfo.code.Replace("Item-", "")}", new ItemCondDto { key = $"{itemInfo.code.Replace("Item-", "")}",filed= $"{itemInfo.code.Replace("Item-", "")}", scope= "private" });
+                                    }
+                                }
                                 await client.GetContainer(Constant.TEAMModelOS, "Teacher").CreateItemAsync(itemInfo, new PartitionKey($"{itemInfo.code}"));
                                 await client.GetContainer(Constant.TEAMModelOS, "Teacher").CreateItemAsync(itemInfo, new PartitionKey($"{itemInfo.code}"));
                             }
                             }
                             else
                             else
                             {
                             {
-                                //if (string.IsNullOrEmpty(itemInfo.pid))
-                                //{
-                                //    ItemCondDto itemCondDto = new ItemCondDto { newItem = itemInfo, key = $"ItemCond-{itemInfo.code.Replace("Item-", "")}", filed = itemInfo.periodId, scope = "school" };
-                                //    itemCondDtos.Add(itemCondDto);
-                                //}
-                                 await client.GetContainer(Constant.TEAMModelOS, "School").CreateItemAsync(itemInfo, new PartitionKey($"{itemInfo.code}"));
+                                if (string.IsNullOrEmpty(itemInfo.pid))
+                                {
+                                    if (!dict.ContainsKey($"{itemInfo.code.Replace("Item-", "")}-{itemInfo.periodId}"))
+                                    {
+                                        dict.Add($"{itemInfo.code.Replace("Item-", "")}-{itemInfo.periodId}", new ItemCondDto { key = $"{itemInfo.code.Replace("Item-", "")}",filed=$"{itemInfo.periodId}", scope = "school" });
+                                    }
+                                }
+                                await client.GetContainer(Constant.TEAMModelOS, "School").CreateItemAsync(itemInfo, new PartitionKey($"{itemInfo.code}"));
 
 
                             }
                             }
                         }
                         }
@@ -214,13 +255,18 @@ namespace TEAMModelOS.Controllers
                             {
                             {
                                 itemInfo.code = "Item-" + itemInfo.code;
                                 itemInfo.code = "Item-" + itemInfo.code;
                             }
                             }
-                            //if (string.IsNullOrEmpty(itemInfo.pid))
-                            //{
-                            //    string condId = itemInfo.code.Replace("Item-", "");
-                            //    ItemInfo olditemInfo = await client.GetContainer(Constant.TEAMModelOS, "Teacher").ReadItemAsync<ItemInfo>(itemInfo.id, new PartitionKey($"{itemInfo.code}"));
-                            //    ItemCondDto itemCondDto = new ItemCondDto { newItem = itemInfo, odlItem = olditemInfo, key = "ItemCond", filed = itemInfo.code.Replace("Item-", ""), scope = "private" };
-                            //    itemCondDtos.Add(itemCondDto);
-                            //}
+                            if (string.IsNullOrEmpty(itemInfo.pid))
+                            {
+                                if (!dict.ContainsKey($"{itemInfo.code.Replace("Item-", "")}"))
+                                {
+                                    dict.Add($"{itemInfo.code.Replace("Item-", "")}", new ItemCondDto { key = $"{itemInfo.code.Replace("Item-", "")}", filed = $"{itemInfo.code.Replace("Item-", "")}", scope = "private" });
+                                }
+                                ItemInfo olditemInfo = await client.GetContainer(Constant.TEAMModelOS, "Teacher").ReadItemAsync<ItemInfo>(itemInfo.id, new PartitionKey($"{itemInfo.code}"));
+                                if (!dict.ContainsKey($"{olditemInfo.code.Replace("Item-", "")}"))
+                                {
+                                    dict.Add($"{olditemInfo.code.Replace("Item-", "")}", new ItemCondDto { key = $"{olditemInfo.code.Replace("Item-", "")}", filed = $"{olditemInfo.code.Replace("Item-", "")}", scope = "private" });
+                                }
+                            }
                             await client.GetContainer(Constant.TEAMModelOS, "Teacher").ReplaceItemAsync(itemInfo, itemInfo.id, new PartitionKey($"{itemInfo.code}"));
                             await client.GetContainer(Constant.TEAMModelOS, "Teacher").ReplaceItemAsync(itemInfo, itemInfo.id, new PartitionKey($"{itemInfo.code}"));
 
 
                         }
                         }
@@ -230,21 +276,28 @@ namespace TEAMModelOS.Controllers
                             {
                             {
                                 itemInfo.code = "Item-" + itemInfo.code;
                                 itemInfo.code = "Item-" + itemInfo.code;
                             }
                             }
-                            //if (string.IsNullOrEmpty(itemInfo.pid))
-                            //{
-                            //    ItemInfo olditemInfo = await client.GetContainer(Constant.TEAMModelOS, "School").ReadItemAsync<ItemInfo>(itemInfo.id, new PartitionKey($"{itemInfo.code}"));
-                            //    ItemCondDto itemCondDto = new ItemCondDto { newItem = itemInfo, odlItem = olditemInfo, key = $"ItemCond-{itemInfo.code.Replace("Item-", "")}", filed = itemInfo.periodId, scope = "school" };
-                            //    itemCondDtos.Add(itemCondDto);
-                            //}
+                            if (string.IsNullOrEmpty(itemInfo.pid))
+                            {
+                                if (!dict.ContainsKey($"{itemInfo.code.Replace("Item-", "")}-{itemInfo.periodId}"))
+                                {
+                                    dict.Add($"{itemInfo.code.Replace("Item-", "")}-{itemInfo.periodId}", new ItemCondDto { key = $"{itemInfo.code.Replace("Item-", "")}", filed = $"{itemInfo.periodId}", scope = "school" });
+                                }
+                                ItemInfo olditemInfo = await client.GetContainer(Constant.TEAMModelOS, "School").ReadItemAsync<ItemInfo>(itemInfo.id, new PartitionKey($"{itemInfo.code}"));
+                                if (!dict.ContainsKey($"{olditemInfo.code.Replace("Item-", "")}-{olditemInfo.periodId}"))
+                                {
+                                    dict.Add($"{olditemInfo.code.Replace("Item-", "")}-{olditemInfo.periodId}", new ItemCondDto { key = $"{olditemInfo.code.Replace("Item-", "")}", filed = $"{olditemInfo.periodId}", scope = "school" });
+                                }
+
+                            }
                             await client.GetContainer(Constant.TEAMModelOS, "School").ReplaceItemAsync(itemInfo, itemInfo.id, new PartitionKey($"{itemInfo.code}"));
                             await client.GetContainer(Constant.TEAMModelOS, "School").ReplaceItemAsync(itemInfo, itemInfo.id, new PartitionKey($"{itemInfo.code}"));
 
 
                         }
                         }
                     }
                     }
                 }
                 }
-                //var str = itemCondDtos.ToJsonString();
-                //var messageBlobItemCond = new ServiceBusMessage(str);
-                //await _serviceBus.GetServiceBusClient().SendMessageAsync(ItemCondQueue, messageBlobItemCond);
-                //await _dingDing.SendBotMsg($"OS,{_option.Location},item/upsert()\n{str}", GroupNames.醍摩豆服務運維群組);
+                var itemCondDtos=  dict.Select(x => x.Value).ToList();
+                var str = itemCondDtos.ToJsonString();
+                var messageBlobItemCond = new ServiceBusMessage(str);
+                await _serviceBus.GetServiceBusClient().SendMessageAsync(ItemCondQueue, messageBlobItemCond);
                 return Ok(new { itemInfos });
                 return Ok(new { itemInfos });
             }
             }
             catch (Exception ex)
             catch (Exception ex)
@@ -265,7 +318,8 @@ namespace TEAMModelOS.Controllers
             if (!request.TryGetProperty("option", out JsonElement option)) return BadRequest();
             if (!request.TryGetProperty("option", out JsonElement option)) return BadRequest();
             try
             try
             {
             {
-               // var ItemCondQueue = _configuration.GetValue<string>("Azure:ServiceBus:ItemCondQueue");
+                Dictionary<string, ItemCondDto> dict = new Dictionary<string, ItemCondDto>();
+                var ItemCondQueue = _configuration.GetValue<string>("Azure:ServiceBus:ItemCondQueue");
                 ItemInfo itemInfo;
                 ItemInfo itemInfo;
                 itemInfo = item.ToObject<ItemInfo>();
                 itemInfo = item.ToObject<ItemInfo>();
                 itemInfo.size = await _azureStorage.GetBlobContainerClient(itemInfo.code).GetBlobsSize($"item/{itemInfo.id}");
                 itemInfo.size = await _azureStorage.GetBlobContainerClient(itemInfo.code).GetBlobsSize($"item/{itemInfo.id}");
@@ -289,16 +343,24 @@ namespace TEAMModelOS.Controllers
                     {
                     {
                         if (itemInfo.scope.Equals("private"))
                         if (itemInfo.scope.Equals("private"))
                         {
                         {
-                            //ItemCondDto itemCondDto = new ItemCondDto { newItem = itemInfo, key = "ItemCond", filed = itemInfo.code.Replace("Item-", ""), scope = "private" };
-                            //var messageBlobItemCond = new ServiceBusMessage(itemCondDto.ToJsonString());
-                            //await _serviceBus.GetServiceBusClient().SendMessageAsync(ItemCondQueue, messageBlobItemCond);
+                            if (string.IsNullOrEmpty(itemInfo.pid))
+                            {
+                                if (!dict.ContainsKey($"{itemInfo.code.Replace("Item-", "")}"))
+                                {
+                                    dict.Add($"{itemInfo.code.Replace("Item-", "")}", new ItemCondDto { key = $"{itemInfo.code.Replace("Item-", "")}", filed = $"{itemInfo.code.Replace("Item-", "")}", scope = "private" });
+                                }
+                            }
                             itemInfo = await client.GetContainer(Constant.TEAMModelOS, "Teacher").CreateItemAsync(itemInfo, new PartitionKey($"{itemInfo.code}"));
                             itemInfo = await client.GetContainer(Constant.TEAMModelOS, "Teacher").CreateItemAsync(itemInfo, new PartitionKey($"{itemInfo.code}"));
                         }
                         }
                         else
                         else
                         {
                         {
-                            //ItemCondDto itemCondDto = new ItemCondDto { newItem = itemInfo, key = $"ItemCond-{itemInfo.code.Replace("Item-", "")}", filed = itemInfo.periodId, scope = "school" };
-                            //var messageBlobItemCond = new ServiceBusMessage(itemCondDto.ToJsonString());
-                            //await _serviceBus.GetServiceBusClient().SendMessageAsync(ItemCondQueue, messageBlobItemCond);
+                            if (string.IsNullOrEmpty(itemInfo.pid))
+                            {
+                                if (!dict.ContainsKey($"{itemInfo.code.Replace("Item-", "")}-{itemInfo.periodId}"))
+                                {
+                                    dict.Add($"{itemInfo.code.Replace("Item-", "")}-{itemInfo.periodId}", new ItemCondDto { key = $"{itemInfo.code.Replace("Item-", "")}", filed = $"{itemInfo.periodId}", scope = "school" });
+                                }
+                            }
                             itemInfo = await client.GetContainer(Constant.TEAMModelOS, "School").CreateItemAsync(itemInfo, new PartitionKey($"{itemInfo.code}"));
                             itemInfo = await client.GetContainer(Constant.TEAMModelOS, "School").CreateItemAsync(itemInfo, new PartitionKey($"{itemInfo.code}"));
                           
                           
                         }
                         }
@@ -313,12 +375,18 @@ namespace TEAMModelOS.Controllers
                         {
                         {
                             itemInfo.code = "Item-" + itemInfo.code;
                             itemInfo.code = "Item-" + itemInfo.code;
                         }
                         }
-                        string condId = itemInfo.code.Replace("Item-", "");
-                     
-                        //ItemInfo olditemInfo = await client.GetContainer(Constant.TEAMModelOS, "Teacher").ReadItemAsync<ItemInfo>(itemInfo.id, new PartitionKey($"{itemInfo.code}"));
-                        //ItemCondDto itemCondDto = new ItemCondDto { newItem = itemInfo,odlItem=olditemInfo, key = "ItemCond", filed = itemInfo.code.Replace("Item-", ""), scope = "private" };
-                        //var messageBlobItemCond = new ServiceBusMessage(itemCondDto.ToJsonString());
-                        //await _serviceBus.GetServiceBusClient().SendMessageAsync(ItemCondQueue, messageBlobItemCond);
+                        if (string.IsNullOrEmpty(itemInfo.pid))
+                        {
+                            if (!dict.ContainsKey($"{itemInfo.code.Replace("Item-", "")}"))
+                            {
+                                dict.Add($"{itemInfo.code.Replace("Item-", "")}", new ItemCondDto { key = $"{itemInfo.code.Replace("Item-", "")}", filed = $"{itemInfo.code.Replace("Item-", "")}", scope = "private" });
+                            }
+                            ItemInfo olditemInfo = await client.GetContainer(Constant.TEAMModelOS, "Teacher").ReadItemAsync<ItemInfo>(itemInfo.id, new PartitionKey($"{itemInfo.code}"));
+                            if (!dict.ContainsKey($"{olditemInfo.code.Replace("Item-", "")}"))
+                            {
+                                dict.Add($"{olditemInfo.code.Replace("Item-", "")}", new ItemCondDto { key = $"{olditemInfo.code.Replace("Item-", "")}", filed = $"{olditemInfo.code.Replace("Item-", "")}", scope = "private" });
+                            }
+                        }
                         itemInfo = await client.GetContainer(Constant.TEAMModelOS, "Teacher").ReplaceItemAsync(itemInfo, itemInfo.id, new PartitionKey($"{itemInfo.code}"));
                         itemInfo = await client.GetContainer(Constant.TEAMModelOS, "Teacher").ReplaceItemAsync(itemInfo, itemInfo.id, new PartitionKey($"{itemInfo.code}"));
 
 
                     }
                     }
@@ -328,14 +396,26 @@ namespace TEAMModelOS.Controllers
                         {
                         {
                             itemInfo.code = "Item-" + itemInfo.code;
                             itemInfo.code = "Item-" + itemInfo.code;
                         }
                         }
-                        //ItemInfo olditemInfo = await client.GetContainer(Constant.TEAMModelOS, "School").ReadItemAsync<ItemInfo>( itemInfo.id, new PartitionKey($"{itemInfo.code}"));
-                        //ItemCondDto itemCondDto = new ItemCondDto { newItem = itemInfo,odlItem=olditemInfo, key = $"ItemCond-{itemInfo.code.Replace("Item-", "")}", filed = itemInfo.periodId, scope = "school" };
-                        //var messageBlobItemCond = new ServiceBusMessage(itemCondDto.ToJsonString());
-                        //await _serviceBus.GetServiceBusClient().SendMessageAsync(ItemCondQueue, messageBlobItemCond);
+                        if (string.IsNullOrEmpty(itemInfo.pid))
+                        {
+                            if (!dict.ContainsKey($"{itemInfo.code.Replace("Item-", "")}-{itemInfo.periodId}"))
+                            {
+                                dict.Add($"{itemInfo.code.Replace("Item-", "")}-{itemInfo.periodId}", new ItemCondDto { key = $"{itemInfo.code.Replace("Item-", "")}", filed = $"{itemInfo.periodId}", scope = "school" });
+                            }
+                            ItemInfo olditemInfo = await client.GetContainer(Constant.TEAMModelOS, "School").ReadItemAsync<ItemInfo>(itemInfo.id, new PartitionKey($"{itemInfo.code}"));
+                            if (!dict.ContainsKey($"{olditemInfo.code.Replace("Item-", "")}-{olditemInfo.periodId}"))
+                            {
+                                dict.Add($"{olditemInfo.code.Replace("Item-", "")}-{olditemInfo.periodId}", new ItemCondDto { key = $"{olditemInfo.code.Replace("Item-", "")}", filed = $"{olditemInfo.periodId}", scope = "school" });
+                            }
+                        }
                         itemInfo = await client.GetContainer(Constant.TEAMModelOS, "School").ReplaceItemAsync(itemInfo, itemInfo.id, new PartitionKey($"{itemInfo.code}"));
                         itemInfo = await client.GetContainer(Constant.TEAMModelOS, "School").ReplaceItemAsync(itemInfo, itemInfo.id, new PartitionKey($"{itemInfo.code}"));
 
 
                     }
                     }
                 }
                 }
+                var itemCondDtos = dict.Select(x => x.Value).ToList();
+                var str = itemCondDtos.ToJsonString();
+                var messageBlobItemCond = new ServiceBusMessage(str);
+                await _serviceBus.GetServiceBusClient().SendMessageAsync(ItemCondQueue, messageBlobItemCond);
                 return Ok(new { itemInfo });
                 return Ok(new { itemInfo });
             }
             }
             catch (Exception ex)
             catch (Exception ex)
@@ -444,7 +524,8 @@ namespace TEAMModelOS.Controllers
         {
         {
             try
             try
             {
             {
-                //var ItemCondQueue = _configuration.GetValue<string>("Azure:ServiceBus:ItemCondQueue");
+                Dictionary<string, ItemCondDto> dict = new Dictionary<string, ItemCondDto>();
+                var ItemCondQueue = _configuration.GetValue<string>("Azure:ServiceBus:ItemCondQueue");
                 if (!request.TryGetProperty("id", out JsonElement id)) return BadRequest();
                 if (!request.TryGetProperty("id", out JsonElement id)) return BadRequest();
                 if (!request.TryGetProperty("code", out JsonElement code)) return BadRequest();
                 if (!request.TryGetProperty("code", out JsonElement code)) return BadRequest();
                 if (!request.TryGetProperty("scope", out JsonElement scope)) return BadRequest();
                 if (!request.TryGetProperty("scope", out JsonElement scope)) return BadRequest();
@@ -458,22 +539,33 @@ namespace TEAMModelOS.Controllers
                 await _serviceBus.GetServiceBusClient().SendMessageAsync(ActiveTask, messageBlob);
                 await _serviceBus.GetServiceBusClient().SendMessageAsync(ActiveTask, messageBlob);
                 if (scope.ToString().Equals("school"))
                 if (scope.ToString().Equals("school"))
                 {
                 {
-                    //ItemInfo itemInfo = await client.GetContainer(Constant.TEAMModelOS, "School").ReadItemAsync<ItemInfo>(id.ToString(), new PartitionKey($"{code}"));
-                    //ItemCondDto itemCondDto = new ItemCondDto {  odlItem = itemInfo, key = $"ItemCond-{itemInfo.code.Replace("Item-", "")}", filed = itemInfo.periodId, scope = "school" };
-                    //var messageBlobItemCond = new ServiceBusMessage(itemCondDto.ToJsonString());
-                    //await _serviceBus.GetServiceBusClient().SendMessageAsync(ItemCondQueue, messageBlobItemCond);
+                    ItemInfo olditemInfo = await client.GetContainer(Constant.TEAMModelOS, "School").ReadItemAsync<ItemInfo>($"{id}", new PartitionKey($"{code}"));
+                    if (!dict.ContainsKey($"{olditemInfo.code.Replace("Item-", "")}-{olditemInfo.periodId}"))
+                    {
+                        dict.Add($"{olditemInfo.code.Replace("Item-", "")}-{olditemInfo.periodId}", new ItemCondDto { key = $"{olditemInfo.code.Replace("Item-", "")}", filed = $"{olditemInfo.periodId}", scope = "school" });
+                    }
+                    var itemCondDtos = dict.Select(x => x.Value).ToList();
+                    var str = itemCondDtos.ToJsonString();
+                    var messageBlobItemCond = new ServiceBusMessage(str);
+                    await _serviceBus.GetServiceBusClient().SendMessageAsync(ItemCondQueue, messageBlobItemCond);
                     var response = await client.GetContainer(Constant.TEAMModelOS, "School").DeleteItemStreamAsync(id.ToString(), new PartitionKey($"{code}"));
                     var response = await client.GetContainer(Constant.TEAMModelOS, "School").DeleteItemStreamAsync(id.ToString(), new PartitionKey($"{code}"));
                     return Ok(new { code = response.Status });
                     return Ok(new { code = response.Status });
                 }
                 }
                 else
                 else
                 {
                 {
-                    //ItemInfo olditemInfo = await client.GetContainer(Constant.TEAMModelOS, "Teacher").ReadItemAsync<ItemInfo>($"{id}", new PartitionKey($"{code}"));
-                    //ItemCondDto itemCondDto = new ItemCondDto {  odlItem = olditemInfo, key = "ItemCond", filed = olditemInfo.code.Replace("Item-", ""), scope = "private" };
-                    //var messageBlobItemCond = new ServiceBusMessage(itemCondDto.ToJsonString());
-                    //await _serviceBus.GetServiceBusClient().SendMessageAsync(ItemCondQueue, messageBlobItemCond);
+                    ItemInfo olditemInfo = await client.GetContainer(Constant.TEAMModelOS, "Teacher").ReadItemAsync<ItemInfo>($"{id}", new PartitionKey($"{code}"));
+                    if (!dict.ContainsKey($"{olditemInfo.code.Replace("Item-", "")}"))
+                    {
+                        dict.Add($"{olditemInfo.code.Replace("Item-", "")}", new ItemCondDto { key = $"{olditemInfo.code.Replace("Item-", "")}", filed = $"{olditemInfo.code.Replace("Item-", "")}", scope = "private" });
+                    }
+                    var itemCondDtos = dict.Select(x => x.Value).ToList();
+                    var str = itemCondDtos.ToJsonString();
+                    var messageBlobItemCond = new ServiceBusMessage(str);
+                    await _serviceBus.GetServiceBusClient().SendMessageAsync(ItemCondQueue, messageBlobItemCond);
                     var response = await client.GetContainer(Constant.TEAMModelOS, "Teacher").DeleteItemStreamAsync(id.ToString(), new PartitionKey($"{code}"));
                     var response = await client.GetContainer(Constant.TEAMModelOS, "Teacher").DeleteItemStreamAsync(id.ToString(), new PartitionKey($"{code}"));
                     return Ok(new { code = response.Status });
                     return Ok(new { code = response.Status });
                 }
                 }
+                
             }
             }
             catch (Exception e)
             catch (Exception e)
             {
             {

+ 86 - 24
TEAMModelOS/Controllers/XTest/FixDataController.cs

@@ -65,32 +65,94 @@ namespace TEAMModelOS.Controllers
         [HttpPost("fix-school")]
         [HttpPost("fix-school")]
         public async Task<IActionResult> FixSchool(JsonElement data)
         public async Task<IActionResult> FixSchool(JsonElement data)
         {
         {
-            List<string> arr = new List<string> { "xnygxx",
-            "xcsyxx",
-            "lxxcfx",
-            "gxjrxx",
-            "cdgxsx",
-            "yzxx",
-            "njtsjy",
-            "lrtsxx",
-            "rhsyzx",
-            "wjylxx",
-            "yfps",
-            "kjyxx",
-            "dsgjxx",
-            "ydzt",
-            "hqrh",
-            "czmdzz",
-            "hsbhmz",
-            "cdtmd",
-            "hbcn",
-            "habook"};
+            List<string> arr = new List<string> {
+               "pjzx",
+"pjsazx",
+"pjsywgyxx",
+"pjbjxx",
+"pjhszcjzx",
+"pjcyhzjnzxx",
+"pjxnxx",
+"pjthxx",
+"pjsazsmxx",
+"pjcyxx",
+"pjsazcjzx",
+"pjwxjnzxx",
+"ptsxxpjfx",
+"pjjysxx",
+"pjxlzjnzxx",
+"pjfxxx",
+"pjdtjnzxx",
+"pjgxzjnzxx",
+"pjcjzjnzxx",
+"pjdxjnzxx",
+"pjwjxx",
+"pjzyzx",
+"pjnjyey",
+"pjbjyey",
+"pjcbyey",
+"pjcxyey",
+"pjcnyey",
+"pjxj5hyey",
+"pjxlyey",
+"pjsazxyey",
+"pjsaxcyey",
+"pjthyey",
+"pjsmyey",
+"pjshyey",
+"pjwxyey",
+"pjjysyey",
+"pjfxyey",
+"pjgxyey",
+"pjcjyey",
+"pjcyhyey",
+"pjbyyey",
+"pjdtyey",
+"pjnjyeydxfy",
+"pjcxyeygmfy",
+"pjcbyeygqfy",
+"pjsaxcyeyzqfy",
+"pjxyheyey",
+"pjxhyey",
+"pjxbeyey",
+"pjhhzyey",
+"pjxxyey",
+"sazxgyey",
+"xlzlxyey",
+"dxzxmyey",
+"dtzxmyey",
+"dtzydyey"
+};
             var client = _azureCosmos.GetCosmosClient();
             var client = _azureCosmos.GetCosmosClient();
-          
-            await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIterator<School>(queryText: "SELECT  value(c) FROM c", requestOptions: new QueryRequestOptions { PartitionKey = new PartitionKey("Base") }))
-            {
-                
+            foreach (var ar in arr) {
+                SchoolTeacher teacher = new SchoolTeacher {
+                    id = "1528783259",
+                    code = $"Teacher-{ar}",
+                    picture= "https://corestorageservice.blob.core.windows.net/account/avatar/1528783259",
+                    name= "郭杰",
+                    job="管理员",
+                    roles=new List<string> { "admin", "teacher" },
+                    status="join",
+                    pk= "Teacher",
+                    ttl=-1,
+                    createTime= 1631703528741,
+
+                };
+               await client.GetContainer(Constant.TEAMModelOS, "School").UpsertItemAsync(teacher, partitionKey: new PartitionKey(teacher.code));
             }
             }
+            //await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIterator<School>(queryText: "SELECT  value(c) FROM c", requestOptions: new QueryRequestOptions { PartitionKey = new PartitionKey("Base") }))
+            //{
+            //    if (arr.Contains(item.id)) {
+
+            //        string periodid = Guid.NewGuid().ToString();
+            //        string campuses = Guid.NewGuid().ToString();
+            //        item.period = new List<Period> { new Period { name = "默认学段", id = periodid, campusId = campuses } };
+            //        item.campuses = new List<Campus> { new Campus { name = "本部", id = campuses } };
+            //        item.timeZone.label = "(UTC+08:00) 北京,重庆,香港特别行政区,乌鲁木齐";
+            //        item.timeZone.value = "+08:00";
+            //        await client.GetContainer(Constant.TEAMModelOS, "School").ReplaceItemAsync<School>(item, item.id, new PartitionKey(item.code));
+            //    }
+            //}
             return Ok();
             return Ok();
         }
         }
 
 

+ 1 - 1
TEAMModelOS/Filter/SecurityHeadersAttribute.cs

@@ -18,7 +18,7 @@ namespace TEAMModelOS.Filter
                 // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Content-Type-Options
                 // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Content-Type-Options
                 if (!context.HttpContext.Response.Headers.ContainsKey("X-Content-Type-Options"))
                 if (!context.HttpContext.Response.Headers.ContainsKey("X-Content-Type-Options"))
                 {
                 {
-                    context.HttpContext.Response.Headers.Add("X-Content-Type-Options", "nosniff");
+                  //  context.HttpContext.Response.Headers.Add("X-Content-Type-Options", "nosniff");
                 }
                 }
 
 
                 // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options
                 // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options

+ 3 - 3
TEAMModelOS/TEAMModelOS.csproj

@@ -37,9 +37,9 @@
     <SpaRoot>ClientApp\</SpaRoot>
     <SpaRoot>ClientApp\</SpaRoot>
     <DefaultItemExcludes>$(DefaultItemExcludes);$(SpaRoot)node_modules\**</DefaultItemExcludes>
     <DefaultItemExcludes>$(DefaultItemExcludes);$(SpaRoot)node_modules\**</DefaultItemExcludes>
     <UserSecretsId>078b5d89-7d90-4f6a-88fc-7d96025990a8</UserSecretsId>
     <UserSecretsId>078b5d89-7d90-4f6a-88fc-7d96025990a8</UserSecretsId>
-    <Version>5.2110.15</Version>
-    <AssemblyVersion>5.2110.15.1</AssemblyVersion>
-    <FileVersion>5.2110.15.1</FileVersion>
+    <Version>5.2110.18</Version>
+    <AssemblyVersion>5.2110.18.1</AssemblyVersion>
+    <FileVersion>5.2110.18.1</FileVersion>
     <Description>TEAMModelOS(IES5)</Description>
     <Description>TEAMModelOS(IES5)</Description>
     <PackageReleaseNotes>版本说明</PackageReleaseNotes>
     <PackageReleaseNotes>版本说明</PackageReleaseNotes>
   </PropertyGroup>
   </PropertyGroup>