Browse Source

学生课程列表

CrazyIter_Bin 4 years ago
parent
commit
f7fdd2ffd4

+ 4 - 4
TEAMModelFunction/CourseServiceBus.cs

@@ -52,11 +52,11 @@ namespace TEAMModelFunction
                         id = courseChange.id,
                         scode = courseChange.code,
                         name = courseChange.name,
-                        code = $"Course-{courseChange.school}-{addStu.id}",
+                        code = $"StuCourse-{courseChange.school}-{addStu.id}",
                         scope = courseChange.scope,
                         school = courseChange.school,
                         creatorId = courseChange.creatorId,
-                        pk = "Course"
+                        pk = "StuCourse"
                     };
                     await client.GetContainer("TEAMModelOS", "Student").UpsertItemAsync(course, new PartitionKey(course.code));
                 }
@@ -67,11 +67,11 @@ namespace TEAMModelFunction
                         id = courseChange.id,
                         scode = courseChange.code,
                         name = courseChange.name,
-                        code = $"Course-{addTmd}",
+                        code = $"StuCourse-{addTmd}",
                         scope = courseChange.scope,
                         //school = courseChange.school,
                         creatorId = courseChange.creatorId,
-                        pk = "Course"
+                        pk = "StuCourse"
                     };
                     await client.GetContainer("TEAMModelOS", "Teacher").UpsertItemAsync(course, new PartitionKey(course.code));
                 }

+ 4 - 4
TEAMModelFunction/StuListServiceBus.cs

@@ -163,11 +163,11 @@ namespace TEAMModelFunction
                         id = course.id,
                         scode = course.code,
                         name = course.name,
-                        code = $"Course-{course.school}-{students.id}",
+                        code = $"StuCourse-{course.school}-{students.id}",
                         scope = course.scope,
                         school = course.school,
                         creatorId = course.creatorId,
-                        pk = "Course"
+                        pk = "StuCourse"
                     };
                     await client.GetContainer("TEAMModelOS", "Student").UpsertItemAsync(stucourse, new PartitionKey(stucourse.code));
                 }
@@ -179,11 +179,11 @@ namespace TEAMModelFunction
                         id = course.id,
                         scode = course.code,
                         name = course.name,
-                        code = $"Course-{tmdid}",
+                        code = $"StuCourse-{tmdid}",
                         scope = course.scope,
                         school = course.school,
                         creatorId = course.creatorId,
-                        pk = "Course"
+                        pk = "StuCourse"
                     };
                     await client.GetContainer("TEAMModelOS", "Teacher").UpsertItemAsync(stucourse, new PartitionKey(stucourse.code));
                 }

+ 4 - 26
TEAMModelOS/Controllers/School/StudentCommonController.cs

@@ -60,14 +60,8 @@ namespace TEAMModelOS.Controllers
         /// 查询活动所有活动类型的列表,学生端
         /// </summary>
         /// <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>
         /// 
         /// <returns></returns>
@@ -76,7 +70,6 @@ namespace TEAMModelOS.Controllers
         // [AuthToken(Roles = "student")]
         public async Task<IActionResult> StuCourse(JsonElement request)
         {
-
             var (id, name, pic, school) = HttpContext.GetAuthTokenInfo();
             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 PartitionKey = $"Course-{id}";
+            string PartitionKey = $"StuCourse-{id}";
             if (!string.IsNullOrEmpty(school)) {
                   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>();
             await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer("TEAMModelOS", containerId).GetItemQueryIterator<StuCourse>(queryText: $"select value(c) from c ",