|
@@ -4224,11 +4224,11 @@ namespace TEAMModelOS.Controllers
|
|
|
{
|
|
|
exams.Add(item);
|
|
|
}
|
|
|
- List<JsonElement> elements = new();
|
|
|
+ List<(JsonElement items, List<string> attachments,int qamode)> elements = new();
|
|
|
if (exams.Count > 0)
|
|
|
{
|
|
|
foreach (errorItemInfo itemInfo in errors) {
|
|
|
- ExamInfo info = exams.Where(c => c.id.Equals(itemInfo.activityId)).FirstOrDefault();
|
|
|
+ ExamInfo info = exams.Where(c => c.id.Equals(itemInfo.activityId)).FirstOrDefault();
|
|
|
List<ExamSubject> subjects = info.subjects;
|
|
|
int index = 0;
|
|
|
foreach (ExamSubject subject in subjects)
|
|
@@ -4245,6 +4245,25 @@ namespace TEAMModelOS.Controllers
|
|
|
List<PaperSimple> simples = info.papers;
|
|
|
string blob = simples[index].blob;
|
|
|
try {
|
|
|
+ List<string> attachments = new();
|
|
|
+ if (info.qamode == 1)
|
|
|
+ {
|
|
|
+ BlobDownloadResult index_json;
|
|
|
+ if (info.scope.Equals("school"))
|
|
|
+ {
|
|
|
+ index_json = await _azureStorage.GetBlobContainerClient($"{info.school}").GetBlobClient($"{blob}/index.json").DownloadContentAsync();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ index_json = await _azureStorage.GetBlobContainerClient($"{info.creatorId}").GetBlobClient($"{blob}/index.json").DownloadContentAsync();
|
|
|
+ }
|
|
|
+ JsonElement RecordingJson = JsonDocument.Parse(new MemoryStream(Encoding.UTF8.GetBytes(index_json.Content.ToString()))).RootElement;
|
|
|
+ attachments = RecordingJson.GetProperty("attachments").ToObject<List<string>>();
|
|
|
+ if (attachments.Count == 0)
|
|
|
+ {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }
|
|
|
BlobDownloadResult index_item_json;
|
|
|
if (info.scope.Equals("school"))
|
|
|
{
|
|
@@ -4255,7 +4274,7 @@ namespace TEAMModelOS.Controllers
|
|
|
index_item_json = await _azureStorage.GetBlobContainerClient($"{info.creatorId}").GetBlobClient($"{blob}/{itemInfo.qId}.json").DownloadContentAsync();
|
|
|
}
|
|
|
JsonElement itemJson = JsonDocument.Parse(new MemoryStream(Encoding.UTF8.GetBytes(index_item_json.Content.ToString()))).RootElement;
|
|
|
- elements.Add(itemJson);
|
|
|
+ elements.Add((itemJson,attachments,info.qamode));
|
|
|
if (itemJson.TryGetProperty("pid", out JsonElement pid))
|
|
|
{
|
|
|
if (!string.IsNullOrEmpty(pid.ToString()))
|
|
@@ -4270,7 +4289,7 @@ namespace TEAMModelOS.Controllers
|
|
|
index_pid_item_json = await _azureStorage.GetBlobContainerClient($"{info.creatorId}").GetBlobClient($"{blob}/{pid}.json").DownloadContentAsync();
|
|
|
}
|
|
|
JsonElement pidJson = JsonDocument.Parse(new MemoryStream(Encoding.UTF8.GetBytes(index_pid_item_json.Content.ToString()))).RootElement;
|
|
|
- elements.Add(pidJson);
|
|
|
+ elements.Add((pidJson, attachments, info.qamode));
|
|
|
}
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
@@ -4283,7 +4302,11 @@ namespace TEAMModelOS.Controllers
|
|
|
{
|
|
|
return BadRequest(new { msg = "暂无数据" });
|
|
|
}
|
|
|
- return Ok(elements);
|
|
|
+ var error = elements.Select(c => new {
|
|
|
+ c.items,
|
|
|
+ c.attachments
|
|
|
+ });
|
|
|
+ return Ok(new { error });
|
|
|
}
|
|
|
|
|
|
}
|