|
@@ -111,7 +111,7 @@ namespace TEAMModelOS.Controllers
|
|
|
}
|
|
|
}
|
|
|
if (!HttpContext.Items.TryGetValue("Standard", out object standard)) return BadRequest();
|
|
|
- await StatisticsService.SendServiceBus($"{standard}", $"{_tmdid}", $"{school}", StatisticsService.TeacherAility,0, _configuration, _serviceBus);
|
|
|
+ await StatisticsService.SendServiceBus(new List<(string standard, string tmdid, string school, List<string> update, int statistics)> { ($"{standard}", $"{_tmdid}", $"{school}",new List<string> { StatisticsService.TeacherAility }, 0) }, _configuration, _serviceBus);
|
|
|
return Ok(new { abilityIds });
|
|
|
}
|
|
|
catch (Exception ex)
|
|
@@ -391,9 +391,10 @@ namespace TEAMModelOS.Controllers
|
|
|
|
|
|
abilitySubTasks.Add(client.GetContainer(Constant.TEAMModelOS, "Teacher").ReplaceItemAsync(sub, sub.id, new PartitionKey(sub.code)));
|
|
|
});
|
|
|
- List<Task> tasks = new List<Task>();
|
|
|
+ List<(string standard, string tmdid, string school, List<string> update, int statistics)> list = new List<(string standard, string tmdid, string school, List<string> update, int statistics)>();
|
|
|
tmdids.ForEach(x => {
|
|
|
- tasks.Add(StatisticsService.SendServiceBus($"{standard}", $"{x}", $"{school}", StatisticsService.TeacherAility, 1, _configuration, _serviceBus));
|
|
|
+ list.Add(($"{standard}", $"{x}", $"{school}", new List<string> { StatisticsService.TeacherAility }, 1));
|
|
|
+
|
|
|
});
|
|
|
int pagesize = 50;
|
|
|
if (abilitySubTasks.Count <= pagesize)
|
|
@@ -409,19 +410,7 @@ namespace TEAMModelOS.Controllers
|
|
|
await Task.WhenAll(lists);
|
|
|
}
|
|
|
}
|
|
|
- if (tasks.Count <= pagesize)
|
|
|
- {
|
|
|
- await Task.WhenAll(tasks);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- int pages = (tasks.Count + pagesize) / pagesize; //256是批量操作最大值,pages = (total + max -1) / max;
|
|
|
- for (int i = 0; i < pages; i++)
|
|
|
- {
|
|
|
- var listssb = tasks.Skip((i) * pagesize).Take(pagesize).ToList();
|
|
|
- await Task.WhenAll(listssb);
|
|
|
- }
|
|
|
- }
|
|
|
+ await StatisticsService.SendServiceBus(list, _configuration, _serviceBus);
|
|
|
return Ok(new { status = 200 });
|
|
|
}
|
|
|
}
|
|
@@ -513,7 +502,7 @@ namespace TEAMModelOS.Controllers
|
|
|
abilitySub.exerciseScore = int.Parse($"{_exercise}");
|
|
|
await client.GetContainer("TEAMModelOS", "Teacher").ReplaceItemAsync<AbilitySub>(abilitySub, $"{_abilityId}", new PartitionKey(code));
|
|
|
status = 1;
|
|
|
- await StatisticsService.SendServiceBus($"{standard}", $"{_tmdid}", $"{_school}", StatisticsService.TeacherAility, 1, _configuration, _serviceBus);
|
|
|
+ await StatisticsService.SendServiceBus(new List<(string standard, string tmdid, string school, List<string> update, int statistics)> { ($"{standard}", $"{_tmdid}", $"{_school}",new List<string> { StatisticsService.TeacherAility }, 1) }, _configuration, _serviceBus);
|
|
|
return Ok(new { status });
|
|
|
}
|
|
|
else
|
|
@@ -561,7 +550,7 @@ namespace TEAMModelOS.Controllers
|
|
|
abilitySub.selfTime = now;
|
|
|
await client.GetContainer("TEAMModelOS", "Teacher").ReplaceItemAsync<AbilitySub>(abilitySub, $"{_abilityId}", new PartitionKey(code));
|
|
|
status = 1;
|
|
|
- await StatisticsService.SendServiceBus($"{standard}", $"{_tmdid}", $"{_school}", StatisticsService.TeacherAility, 0, _configuration, _serviceBus);
|
|
|
+ await StatisticsService.SendServiceBus(new List<(string standard, string tmdid, string school, List<string> update, int statistics)> { ($"{standard}", $"{_tmdid}", $"{_school}", new List<string> { StatisticsService.TeacherAility }, 0) }, _configuration, _serviceBus);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -742,8 +731,8 @@ namespace TEAMModelOS.Controllers
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
- await client.GetContainer("TEAMModelOS", "Teacher").ReplaceItemAsync<AbilitySub>(abilitySub, $"{_abilityId}", new PartitionKey(code));
|
|
|
- await StatisticsService.SendServiceBus($"{standard}", $"{_tmdid}", $"{_school}", StatisticsService.TeacherAility, 1, _configuration, _serviceBus);
|
|
|
+ await client.GetContainer("TEAMModelOS", "Teacher").ReplaceItemAsync<AbilitySub>(abilitySub, $"{_abilityId}", new PartitionKey(code));
|
|
|
+ await StatisticsService.SendServiceBus(new List<(string standard, string tmdid, string school, List<string> update, int statistics)> { ($"{standard}", $"{_tmdid}", $"{_school}", new List<string> { StatisticsService.TeacherAility }, 1) }, _configuration, _serviceBus);
|
|
|
status = 1;
|
|
|
}
|
|
|
return Ok(new { status, abilitySub });
|
|
@@ -899,7 +888,7 @@ namespace TEAMModelOS.Controllers
|
|
|
await client.GetContainer("TEAMModelOS", "Teacher").CreateItemAsync<TeacherFile>(teacherFile, new PartitionKey($"TeacherFile-{_school}"));
|
|
|
}
|
|
|
if (fileRcds.Exists(x => x.type.Equals("video"))) {
|
|
|
- await StatisticsService.SendServiceBus($"{standard}", $"{_tmdid}", $"{_school}", StatisticsService.TeacherAility, 1, _configuration, _serviceBus);
|
|
|
+ await StatisticsService.SendServiceBus(new List<(string standard, string tmdid, string school, List<string> update, int statistics)> { ($"{standard}", $"{_tmdid}", $"{_school}", new List<string> { StatisticsService.TeacherAility }, 1) }, _configuration, _serviceBus);
|
|
|
}
|
|
|
//获取视文件学习记录
|
|
|
List<dynamic> _files = new List<dynamic>();
|
|
@@ -948,7 +937,7 @@ namespace TEAMModelOS.Controllers
|
|
|
urls.Add(new { ability = file, view = x.view, hash = x.hash, done = x.done });
|
|
|
}
|
|
|
});
|
|
|
- abilityFiles.Add(new { view, urls , abilityId= abid });
|
|
|
+ abilityFiles.Add(new { view, abilityId= abid });
|
|
|
}
|
|
|
return Ok(new { status, files, abilityFiles });
|
|
|
} catch (Exception ex) {
|