CrazyIter_Bin 1 éve
szülő
commit
ab865d767b

+ 2 - 2
TEAMModelOS.FunctionV4/ServiceBus/ActiveTaskTopic.cs

@@ -695,10 +695,10 @@ namespace TEAMModelOS.FunctionV4.ServiceBus
                     {
                         artResult.pdf.prime = false;//此处的作用是判断是否已经生成OK.
                     }
-                    await _azureRedis.GetRedisClient(8).HashSetAsync($"ArtPDF:{_artId}", artResult.studentId, artResult.ToJsonString());
+                    await _azureRedis.GetRedisClient(8).HashSetAsync($"ArtPDF:{_artId}:{_schoolCode}", artResult.studentId, artResult.ToJsonString());
                 }
                 //2个小时。
-                await _azureRedis.GetRedisClient(8).KeyExpireAsync($"ArtPDF:{_artId}", new TimeSpan(2, 0, 0));
+                await _azureRedis.GetRedisClient(8).KeyExpireAsync($"ArtPDF:{_artId}:{_schoolCode}", new TimeSpan(2, 0, 0));
                 List<Task<string>> uploads = new List<Task<string>>();
                 studentPdfs.ForEach(x => {
                     x.blob = $"art/{x.artId}/report/{x.studentId}.json";

+ 25 - 1
TEAMModelOS.TEST/Program.cs

@@ -1,6 +1,8 @@
 using HTEXLib.COMM.Helpers;
 using Newtonsoft.Json;
+using System.Security.Policy;
 using System.Text;
+using System.Web;
 using TEAMModelOS.SDK.Extension;
 using TEAMModelOS.SDK.Models;
 using TEAMModelOS.SDK.Models.Cosmos.OpenEntity;
@@ -13,8 +15,30 @@ namespace TEAMModelOS.TEST
         static void Main(string[] args)
         {
 
+            //
+            var uri = HttpUtility.UrlDecode("https://teammodeltest.blob.core.chinacloudapi.cn/hbcn/art/e9a5ec36-7299-45dc-9517-7457960346c4/report/202106005.pdf");
+            var paths = uri.Split("/art/");
+            if (paths.Length == 2)
+            {
+                var ps = paths[1].Split("/");
+                if (ps.Length == 3)
+                {
+                    Uri uris = new Uri(paths[0]);
+
+                    // 获取URL的Segments属性,这是一个String数组,包含URL中的每个部分
+                    string[] segments = uris.Segments;
+                    string key = $"ArtPDF:{ps[0]}";
+                    // 确保segments数组至少有一个元素
+                    if (segments.Length > 0)
+                    {
+                        // 获取数组中的最后一个元素,即最后一个'/'之后的部分
+                        string lastSegment = segments[segments.Length - 1];
+                        key = $"ArtPDF:{ps[0]}:{lastSegment}";
+                    }
+                }
+            }
 
-            List<Dictionary<string, object>> jsonData = new List<Dictionary<string, object>>
+        List<Dictionary<string, object>> jsonData = new List<Dictionary<string, object>>
         {
             new Dictionary<string, object> { { "user", "A" }, { "time", 1711414573130 } },
             new Dictionary<string, object> { { "user", "A" }, { "time", 1711414673130 } },

+ 13 - 5
TEAMModelOS/Controllers/School/ArtReviewController.cs

@@ -75,11 +75,12 @@ namespace TEAMModelOS.Controllers
         /// <param name="request"></param>
         /// <returns></returns>
         [ProducesDefaultResponseType]
-        [AuthToken(Roles = "teacher,admin")]
+       
         [HttpPost("gen-pdf-process")]
-         
+
 
 #if !DEBUG
+ [AuthToken(Roles = "teacher,admin")]
         [Authorize(Roles = "IES")]
 #endif
         public async Task<IActionResult> GenPDFProcess(JsonElement request) {
@@ -88,13 +89,19 @@ namespace TEAMModelOS.Controllers
             {
                 return BadRequest();
             }
+
+            if (!request.TryGetProperty("schoolId", out JsonElement _schoolId))
+            {
+                return BadRequest();
+            }
+
             List<RedisValue> studentIds = new List<RedisValue>();
             if (request.TryGetProperty("studentIds", out JsonElement _studentIds) && _studentIds.ValueKind.Equals(JsonValueKind.Array))
             {
               var   studentIdS = _studentIds.ToObject<List<string>>();
                 studentIdS.ForEach(z => { studentIds.Add(z); }) ;
             }
-            string key = $"ArtPDF:{_artId}";
+            string key = $"ArtPDF:{_artId}:{_schoolId}";
             List<StudentArtResult> results= new List<StudentArtResult>();
             if (studentIds.IsNotEmpty())
             {
@@ -130,11 +137,12 @@ namespace TEAMModelOS.Controllers
         /// <param name="request"></param>
         /// <returns></returns>
         [ProducesDefaultResponseType]
-        [AuthToken(Roles = "teacher,admin")]
+     
         [HttpPost("gen-pdf")]
-        
+
 
 #if !DEBUG
+        [AuthToken(Roles = "teacher,admin")]
         [Authorize(Roles = "IES")]
 #endif
         public async Task<IActionResult> GenPDF(JsonElement request)

+ 1 - 1
TEAMModelOS/JsonFile/Core/LangConfigV3.json

@@ -80,7 +80,7 @@
         "Score": "配分",
         "Point": "知識點",
         "Taxonomy": "認知層次",
-        "Filed": "記憶|理解|應用|分析|評|創造",
+        "Filed": "記憶|理解|應用|分析|評|創造",
         "Judge": "對|錯",
         "Ended": "結束",
         "Level": "難度",