|
@@ -925,15 +925,32 @@ namespace TEAMModelOS.Controllers
|
|
|
case "ReadSelfFileRcd":
|
|
|
//获取视文件学习记录
|
|
|
List<dynamic> files = new List<dynamic>();
|
|
|
+ List<dynamic> abilityFiles = new List<dynamic>();
|
|
|
try {
|
|
|
TeacherFile teacherFilercd = await client.GetContainer("TEAMModelOS", "Teacher").ReadItemAsync<TeacherFile>($"{_tmdid}", new PartitionKey($"TeacherFile-{_school}"));
|
|
|
+ HashSet<string> abilityIds= teacherFilercd.fileRecords.SelectMany(x => x.files).Select(x => x.abilityId).ToHashSet() ;
|
|
|
teacherFilercd.fileRecords.ForEach(x => {
|
|
|
var file = x.files.FindAll(y => y.abilityId.Equals($"{_abilityId}"));
|
|
|
if (file.IsNotEmpty()) {
|
|
|
files.Add(new { ability =file,view=x.view,hash=x.hash,done=x.done });
|
|
|
}
|
|
|
});
|
|
|
- return Ok(new { status, files });
|
|
|
+
|
|
|
+ foreach (var abid in abilityIds) {
|
|
|
+ var record= teacherFilercd.fileRecords.FindAll(x => x.files.Where(y => y.abilityId.Equals(abid)).Count() > 0);
|
|
|
+ long view = 0;
|
|
|
+ List<dynamic> urls = new List<dynamic>();
|
|
|
+ record.ForEach(x => {
|
|
|
+ var file= x.files.FindAll(y => y.abilityId.Equals($"{abid}"));
|
|
|
+ if (file.IsNotEmpty())
|
|
|
+ {
|
|
|
+ view += x.view;
|
|
|
+ urls.Add(new { ability = file, view = x.view, hash = x.hash, done = x.done });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ abilityFiles.Add(new { view, urls , abilityId= abid });
|
|
|
+ }
|
|
|
+ return Ok(new { status, files, abilityFiles });
|
|
|
} catch (Exception ex) {
|
|
|
|
|
|
}
|