zhouj1203@hotmail.com 1 年間 前
コミット
5af36126b4
1 ファイル変更52 行追加0 行削除
  1. 52 0
      TEAMModelOS.SDK/Models/Service/StudentService.cs

+ 52 - 0
TEAMModelOS.SDK/Models/Service/StudentService.cs

@@ -57,7 +57,9 @@ namespace TEAMModelOS.SDK
             public Custom examType { get; set; } = new Custom();
 
             public List<ExamSubject> subjects { get; set; } = new List<ExamSubject>();
+            //返回科目内容
             public List<string> subs { get; set; } = new List<string>();
+            //返回字段
             public List<string> classIds { get; set; } = new List<string>();
             public List<string> classes { get; set; } = new List<string>();
             public List<string> stuLists { get; set; } = new List<string>();
@@ -306,11 +308,61 @@ namespace TEAMModelOS.SDK
                 if (userScope.Equals(Constant.ScopeStudent) && !string.IsNullOrWhiteSpace(school))
                 {
                     var resultSchool = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Common).GetList<StudentActivity>($"{SQL.ToString()}  and c.owner='school' ", $"Homework-{school}");
+                    if (resultSchool.list.Count > 0)
+                    {
+                        foreach (var work in resultSchool.list)
+                        {
+                            work.classIds = work.classes;
+                            work.scode = work.code;
+                            List<string> sub = new();
+                            if (work.tchLists.Count == 0)
+                            {
+                                if (work.targets.Count > 0)
+                                {
+                                    foreach (var course in work.targets)
+                                    {
+                                        var info = course.ToObject<List<string>>();
+                                        if (info.Count > 1)
+                                        {
+                                            sub.Add(info[0]);
+                                        }
+                                    }
+                                }
+                            }
+                            work.subs = sub;
+
+                        }
+                    }
                     datas.AddRange(resultSchool.list);
                 }
                 //获取教师发布的活动(个人名单,学校名单)
                 {
                     var resultTeacher = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Common).GetList<StudentActivity>($"{SQL.ToString()}  and c.owner='teacher' ");
+                    if (resultTeacher.list.Count > 0)
+                    {
+                        foreach (var work in resultTeacher.list)
+                        {
+                            work.scode = work.code;
+                            work.classIds = work.classes;
+                            List<string> sub = new();
+                            if (work.tchLists.Count == 0)
+                            {
+                                if (work.targets.Count > 0)
+                                {
+                                    foreach (var course in work.targets)
+                                    {
+                                        var info = course.ToObject<List<string>>();
+                                        if (info.Count > 1)
+                                        {
+                                            sub.Add(info[0]);
+                                        }
+                                    }
+                                }
+                            }
+                            work.subs = sub;
+
+                        }
+                    }
                     datas.AddRange(resultTeacher.list);
                 }
             }