zhouj1203@hotmail.com 1 year ago
parent
commit
e2dfad9545

+ 2 - 0
TEAMModelOS.SDK/Models/Cosmos/Student/ArtAttachment.cs

@@ -51,6 +51,8 @@ namespace TEAMModelOS.SDK.Models.Cosmos.Student
         //0 艺术作品 1 等级证书
         public int artType { get; set; }
         // 0 校级 1 区级 2 市级 3 省级 4 国家级
+        //音乐:0艺术体验、1艺术特长、2艺术考级、3艺术评比、4观看演出、5社会学习、6合唱表演、7乐器演奏、8个人演唱
+        //美术:0艺术体验、1艺术特长、2艺术考级、3艺术评比、4观看展览、5社会学习、6书画创作
         public int level { get; set; }
         public long uploadTime { get; set; }
         public long updateTime { get; set; }

+ 13 - 1
TEAMModelOS/Controllers/Client/AClassONEController.cs

@@ -963,7 +963,7 @@ namespace TEAMModelOS.Controllers
                     c.period,
                     c.periodType,
                     c.zymusicstds,c.code,
-                    count = artAttachments.Where(z => z.artId.Equals(c.id)).SelectMany(k => k.files).ToList().Count
+                    count = artAttachments.Where(z => z.artId.Equals(c.id)).ToList().Count
 
                 });
                 return Ok(new { arts = newArts ,token});
@@ -1075,6 +1075,18 @@ namespace TEAMModelOS.Controllers
                 var client = _azureCosmos.GetCosmosClient();
                 if (!element.TryGetProperty("id", out JsonElement id)) return BadRequest();
                 if (!element.TryGetProperty("code", out JsonElement code)) return BadRequest();
+                ArtAttachment attachment = new();
+                var res = await client.GetContainer(Constant.TEAMModelOS, "Student").ReadItemStreamAsync(id.ToString(), new PartitionKey($"ArtAttachment-{code}"));
+                if (res.Status == 200)
+                {
+                    using var json = await JsonDocument.ParseAsync(res.ContentStream);
+                    attachment = json.ToObject<ArtAttachment>();
+
+                }
+                List<Attachment> atts = attachment.files;
+                foreach (Attachment att in atts) {
+                    await _azureStorage.GetBlobServiceClient().DeleteBlobs(_dingDing, code.GetString(), new List<string> { $"{att.blob}" });
+                }
                 await client.GetContainer("TEAMModelOS", "Student").DeleteItemStreamAsync(id.GetString(), new PartitionKey($"ArtAttachment-{code}"));
                 return Ok();
             }