|
@@ -80,12 +80,12 @@ namespace TEAMModelFunction
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
- ItemResponse<StuCourse> stuCourse = await client.GetContainer(Constant.TEAMModelOS, "Teacher").ReadItemAsync<StuCourse>(courseChange.id, new PartitionKey($"StuCourse-{tmd.id}"));
|
|
|
+ ItemResponse<StuCourse> stuCourse = await client.GetContainer(Constant.TEAMModelOS, "Student").ReadItemAsync<StuCourse>(courseChange.id, new PartitionKey($"StuCourse-{tmd.id}"));
|
|
|
if (!stuCourse.Value.classId.Contains(cls))
|
|
|
{
|
|
|
stuCourse.Value.classId.Add(cls);
|
|
|
}
|
|
|
- await client.GetContainer(Constant.TEAMModelOS, "Teacher").ReplaceItemAsync<StuCourse>(stuCourse, courseChange.id, new PartitionKey($"StuCourse-{tmd.id}"));
|
|
|
+ await client.GetContainer(Constant.TEAMModelOS, "Student").ReplaceItemAsync<StuCourse>(stuCourse, courseChange.id, new PartitionKey($"StuCourse-{tmd.id}"));
|
|
|
}
|
|
|
catch (CosmosException ex)
|
|
|
{
|
|
@@ -104,7 +104,7 @@ namespace TEAMModelFunction
|
|
|
pk = "StuCourse",
|
|
|
createTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds()
|
|
|
};
|
|
|
- await client.GetContainer(Constant.TEAMModelOS, "Teacher").CreateItemAsync(course, new PartitionKey(course.code));
|
|
|
+ await client.GetContainer(Constant.TEAMModelOS, "Student").CreateItemAsync(course, new PartitionKey(course.code));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -149,11 +149,11 @@ namespace TEAMModelFunction
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
- ItemResponse<StuCourse> stuCourse = await client.GetContainer(Constant.TEAMModelOS, "Teacher").ReadItemAsync<StuCourse>(courseChange.id, new PartitionKey($"StuCourse-{tmd.id}"));
|
|
|
+ ItemResponse<StuCourse> stuCourse = await client.GetContainer(Constant.TEAMModelOS, "Student").ReadItemAsync<StuCourse>(courseChange.id, new PartitionKey($"StuCourse-{tmd.id}"));
|
|
|
if (!stuCourse.Value.stulist.Contains(list))
|
|
|
{
|
|
|
stuCourse.Value.stulist.Add(list);
|
|
|
- await client.GetContainer(Constant.TEAMModelOS, "Teacher").ReplaceItemAsync<StuCourse>(stuCourse, courseChange.id, new PartitionKey($"StuCourse-{tmd.id}"));
|
|
|
+ await client.GetContainer(Constant.TEAMModelOS, "Student").ReplaceItemAsync<StuCourse>(stuCourse, courseChange.id, new PartitionKey($"StuCourse-{tmd.id}"));
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -174,7 +174,7 @@ namespace TEAMModelFunction
|
|
|
pk = "StuCourse",
|
|
|
createTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds()
|
|
|
};
|
|
|
- await client.GetContainer(Constant.TEAMModelOS, "Teacher").CreateItemAsync(course, new PartitionKey(course.code));
|
|
|
+ await client.GetContainer(Constant.TEAMModelOS, "Student").CreateItemAsync(course, new PartitionKey(course.code));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -212,7 +212,7 @@ namespace TEAMModelFunction
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
- ItemResponse<StuCourse> stuCourse = await client.GetContainer(Constant.TEAMModelOS, "Teacher").ReadItemAsync<StuCourse>(courseChange.id, new PartitionKey($"StuCourse-{tmd.id}"));
|
|
|
+ ItemResponse<StuCourse> stuCourse = await client.GetContainer(Constant.TEAMModelOS, "Student").ReadItemAsync<StuCourse>(courseChange.id, new PartitionKey($"StuCourse-{tmd.id}"));
|
|
|
|
|
|
if (stuCourse.Value.classId.Contains(delCls))
|
|
|
{
|
|
@@ -222,11 +222,11 @@ namespace TEAMModelFunction
|
|
|
if (!stuCourse.Value.classId.IsNotEmpty() && !stuCourse.Value.stulist.IsNotEmpty())
|
|
|
{
|
|
|
//当两个列表都不存在时则直接删除
|
|
|
- await client.GetContainer(Constant.TEAMModelOS, "Teacher").DeleteItemAsync<StuCourse>(courseChange.id, new PartitionKey($"StuCourse-{tmd.id}"));
|
|
|
+ await client.GetContainer(Constant.TEAMModelOS, "Student").DeleteItemAsync<StuCourse>(courseChange.id, new PartitionKey($"StuCourse-{tmd.id}"));
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- await client.GetContainer(Constant.TEAMModelOS, "Teacher").ReplaceItemAsync<StuCourse>(stuCourse, courseChange.id, new PartitionKey($"StuCourse-{tmd.id}"));
|
|
|
+ await client.GetContainer(Constant.TEAMModelOS, "Student").ReplaceItemAsync<StuCourse>(stuCourse, courseChange.id, new PartitionKey($"StuCourse-{tmd.id}"));
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -270,7 +270,7 @@ namespace TEAMModelFunction
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
- ItemResponse<StuCourse> stuCourse = await client.GetContainer(Constant.TEAMModelOS, "Teacher").ReadItemAsync<StuCourse>(courseChange.id, new PartitionKey($"StuCourse-{tmd.id}"));
|
|
|
+ ItemResponse<StuCourse> stuCourse = await client.GetContainer(Constant.TEAMModelOS, "Student").ReadItemAsync<StuCourse>(courseChange.id, new PartitionKey($"StuCourse-{tmd.id}"));
|
|
|
|
|
|
if (stuCourse.Value.stulist.Contains(delList))
|
|
|
{
|
|
@@ -280,11 +280,11 @@ namespace TEAMModelFunction
|
|
|
if (!stuCourse.Value.classId.IsNotEmpty() && !stuCourse.Value.stulist.IsNotEmpty())
|
|
|
{
|
|
|
//当两个列表都不存在时则直接删除
|
|
|
- await client.GetContainer(Constant.TEAMModelOS, "Teacher").DeleteItemAsync<StuCourse>(courseChange.id, new PartitionKey($"StuCourse-{tmd.id}"));
|
|
|
+ await client.GetContainer(Constant.TEAMModelOS, "Student").DeleteItemAsync<StuCourse>(courseChange.id, new PartitionKey($"StuCourse-{tmd.id}"));
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- await client.GetContainer(Constant.TEAMModelOS, "Teacher").ReplaceItemAsync<StuCourse>(stuCourse, courseChange.id, new PartitionKey($"StuCourse-{tmd.id}"));
|
|
|
+ await client.GetContainer(Constant.TEAMModelOS, "Student").ReplaceItemAsync<StuCourse>(stuCourse, courseChange.id, new PartitionKey($"StuCourse-{tmd.id}"));
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -294,49 +294,6 @@ namespace TEAMModelFunction
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- ////根据新增名单获取 新增的学生id 及timdid
|
|
|
- //(List<string> addTmdids, List<Students> addStudents) = await TriggerStuActivity.GetStuList(client, _dingDing, courseChange.addList, courseChange.school);
|
|
|
- ////根据删除名单获取 新增的学生id 及timdid
|
|
|
- //(List<string> delTmdids, List<Students> delStudents) = await TriggerStuActivity.GetStuList(client, _dingDing, courseChange.delList, courseChange.school);
|
|
|
- //foreach (var addStu in addStudents)
|
|
|
- //{
|
|
|
- // var course = new StuCourse
|
|
|
- // {
|
|
|
- // id = courseChange.id,
|
|
|
- // scode = courseChange.code,
|
|
|
- // name = courseChange.name,
|
|
|
- // code = $"StuCourse-{courseChange.school}-{addStu.id}",
|
|
|
- // scope = courseChange.scope,
|
|
|
- // school = courseChange.school,
|
|
|
- // creatorId = courseChange.creatorId,
|
|
|
- // pk = "StuCourse"
|
|
|
- // };
|
|
|
- // await client.GetContainer(Constant.TEAMModelOS, "Student").UpsertItemAsync(course, new PartitionKey(course.code));
|
|
|
- //}
|
|
|
- //foreach (var addTmd in addTmdids)
|
|
|
- //{
|
|
|
- // var course = new StuCourse
|
|
|
- // {
|
|
|
- // id = courseChange.id,
|
|
|
- // scode = courseChange.code,
|
|
|
- // name = courseChange.name,
|
|
|
- // code = $"StuCourse-{addTmd}",
|
|
|
- // scope = courseChange.scope,
|
|
|
- // //school = courseChange.school,
|
|
|
- // creatorId = courseChange.creatorId,
|
|
|
- // pk = "StuCourse"
|
|
|
- // };
|
|
|
- // await client.GetContainer(Constant.TEAMModelOS, "Teacher").UpsertItemAsync(course, new PartitionKey(course.code));
|
|
|
- //}
|
|
|
- //foreach (var delStu in delStudents)
|
|
|
- //{
|
|
|
- // await client.GetContainer(Constant.TEAMModelOS, "Student").DeleteItemStreamAsync(courseChange.id, new PartitionKey($"Course-{courseChange.school}-{delStu.id}"));
|
|
|
- //}
|
|
|
- //foreach (var delTmd in delTmdids)
|
|
|
- //{
|
|
|
- // await client.GetContainer(Constant.TEAMModelOS, "Teacher").DeleteItemStreamAsync(courseChange.id, new PartitionKey($"Course-{delTmd}"));
|
|
|
- //}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|