|
@@ -60,14 +60,8 @@ namespace TEAMModelOS.Controllers
|
|
/// 查询活动所有活动类型的列表,学生端
|
|
/// 查询活动所有活动类型的列表,学生端
|
|
/// </summary>
|
|
/// </summary>
|
|
/// <param name="request">
|
|
/// <param name="request">
|
|
- ///加入的班级信息 ?classes:[{"classid":"S-C-00001","scope":"school"},{"classid":"P-C-00004","scope":"private"}]
|
|
|
|
- ///活动类型 ?"type":"Vote"/"Exam"/"Homework"/"Learn"/"Survey"" // Vote投票 Survey问卷 Exam评测 Learn学习活动 Homework作业活动
|
|
|
|
- ///时间筛选范围开始时间 默认30天之前 ?"stime":1608274766154
|
|
|
|
- ///时间筛选范围结束时间 默认当前时间 ?"etime":1608274766666
|
|
|
|
- ///是否展示列表的 Tips ? "tips":true/false
|
|
|
|
- ///每页大小 ?"count":10/null/Undefined
|
|
|
|
- ///分页Token ?"continuationToken":Undefined/null/"[{\"token\":\"+RID:~omxMAP3ipcSEEwAAAAAAAA==#RT:2#TRC:20#ISV:2#IEO:65551#QCF:1#FPC:AYQTAAAAAAAAiRMAAAAAAAA=\",\"range\":{\"min\":\"\",\"max\":\"FF\"}}]"
|
|
|
|
- /// 当前状态 ?"progress":Undefined/null/"" 表示两种状态都要查询/ "going"/"finish" 表示查询进行中/ 或者已完成 学生端只能查询正在进行或已经结束 going 已发布|finish 已结束
|
|
|
|
|
|
+ /// userid
|
|
|
|
+ /// school
|
|
/// </param>
|
|
/// </param>
|
|
///
|
|
///
|
|
/// <returns></returns>
|
|
/// <returns></returns>
|
|
@@ -76,7 +70,6 @@ namespace TEAMModelOS.Controllers
|
|
// [AuthToken(Roles = "student")]
|
|
// [AuthToken(Roles = "student")]
|
|
public async Task<IActionResult> StuCourse(JsonElement request)
|
|
public async Task<IActionResult> StuCourse(JsonElement request)
|
|
{
|
|
{
|
|
-
|
|
|
|
var (id, name, pic, school) = HttpContext.GetAuthTokenInfo();
|
|
var (id, name, pic, school) = HttpContext.GetAuthTokenInfo();
|
|
if (string.IsNullOrWhiteSpace(id))
|
|
if (string.IsNullOrWhiteSpace(id))
|
|
{
|
|
{
|
|
@@ -98,26 +91,11 @@ namespace TEAMModelOS.Controllers
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
- /// tmdid, schoolid
|
|
|
|
- var userType = "tmdid";
|
|
|
|
- if (request.TryGetProperty("userType", out JsonElement usertype))
|
|
|
|
- {
|
|
|
|
- if (!usertype.ValueKind.Equals(JsonValueKind.Undefined) && !usertype.ValueKind.Equals(JsonValueKind.Null) && usertype.ValueKind.Equals(JsonValueKind.String))
|
|
|
|
- {
|
|
|
|
- userType = usertype.GetString();
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
string containerId = "Teacher";
|
|
string containerId = "Teacher";
|
|
- string PartitionKey = $"Course-{id}";
|
|
|
|
|
|
+ string PartitionKey = $"StuCourse-{id}";
|
|
if (!string.IsNullOrEmpty(school)) {
|
|
if (!string.IsNullOrEmpty(school)) {
|
|
containerId = "Student";
|
|
containerId = "Student";
|
|
- PartitionKey = $"Course-{school}-{id}";
|
|
|
|
- }
|
|
|
|
- /// tmdid, schoolid
|
|
|
|
- if (userType.Equals("tmdid"))
|
|
|
|
- {
|
|
|
|
- containerId = "Teacher";
|
|
|
|
- PartitionKey = $"Course-{id}";
|
|
|
|
|
|
+ PartitionKey = $"StuCourse-{school}-{id}";
|
|
}
|
|
}
|
|
List<StuCourse> stus = new List<StuCourse>();
|
|
List<StuCourse> stus = new List<StuCourse>();
|
|
await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer("TEAMModelOS", containerId).GetItemQueryIterator<StuCourse>(queryText: $"select value(c) from c ",
|
|
await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer("TEAMModelOS", containerId).GetItemQueryIterator<StuCourse>(queryText: $"select value(c) from c ",
|