CrazyIter_Bin 1 年之前
父節點
當前提交
dbcd6b6f6d
共有 1 個文件被更改,包括 21 次插入13 次删除
  1. 21 13
      TEAMModelOS/Controllers/School/SchoolController.cs

+ 21 - 13
TEAMModelOS/Controllers/School/SchoolController.cs

@@ -1942,7 +1942,7 @@ namespace TEAMModelOS.Controllers
                                 }
                                 }
                                 else
                                 else
                                 {
                                 {
-                                    t.status = "invite";
+                                    t.status = "join";
                                     teacher = new SchoolTeacher
                                     teacher = new SchoolTeacher
                                     {
                                     {
                                         id = t.id,
                                         id = t.id,
@@ -1951,7 +1951,8 @@ namespace TEAMModelOS.Controllers
                                         picture = t.picture,
                                         picture = t.picture,
                                         job = null,
                                         job = null,
                                         roles = new List<string> { "teacher" },
                                         roles = new List<string> { "teacher" },
-                                        status = "invite",
+                                       // status = "invite",
+                                        status = "join",
                                         createTime = now,
                                         createTime = now,
                                         size = 0,
                                         size = 0,
                                         subjectIds = new List<string>(),
                                         subjectIds = new List<string>(),
@@ -1970,12 +1971,17 @@ namespace TEAMModelOS.Controllers
                                         {
                                         {
                                             if (school == null)
                                             if (school == null)
                                             {
                                             {
-                                                teacherBase.schools.Add(new Teacher.TeacherSchool { schoolId = schoolBase.id, name = schoolBase.name, picture = schoolBase.picture, areaId = schoolBase.areaId, time = now, status = "invite" });
+                                                teacherBase.schools.Add(new Teacher.TeacherSchool { 
+                                                    schoolId = schoolBase.id, name = schoolBase.name, picture = schoolBase.picture, areaId = schoolBase.areaId, time = now, // status = "invite",
+                                                    status = "join",
+                                                });
                                             }
                                             }
                                         }
                                         }
                                         else
                                         else
                                         {
                                         {
-                                            teacherBase.schools = new List<Teacher.TeacherSchool> { new Teacher.TeacherSchool { schoolId = schoolBase.id, name = schoolBase.name, picture = schoolBase.picture, areaId = schoolBase.areaId, time = now, status = "invite" } };
+                                            teacherBase.schools = new List<Teacher.TeacherSchool> { new Teacher.TeacherSchool { 
+                                                schoolId = schoolBase.id, name = schoolBase.name, picture = schoolBase.picture, areaId = schoolBase.areaId, time = now,  // status = "invite",
+                                        status = "join",} };
                                         }
                                         }
                                         await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Teacher).ReplaceItemAsync(teacherBase, teacherBase.id, new PartitionKey("Base"));
                                         await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Teacher).ReplaceItemAsync(teacherBase, teacherBase.id, new PartitionKey("Base"));
                                     }
                                     }
@@ -1993,7 +1999,8 @@ namespace TEAMModelOS.Controllers
                                             schools = new List<Teacher.TeacherSchool> {
                                             schools = new List<Teacher.TeacherSchool> {
                                                 new Teacher.TeacherSchool {
                                                 new Teacher.TeacherSchool {
                                                     schoolId= schoolBase.id,
                                                     schoolId= schoolBase.id,
-                                                    name= schoolBase.name,picture= schoolBase.picture, areaId= schoolBase.areaId,time=now,status= "invite" },
+                                                    name= schoolBase.name,picture= schoolBase.picture, areaId= schoolBase.areaId,time=now, // status = "invite",
+                                        status = "join", },
                                             }
                                             }
                                         };
                                         };
                                         inviteids.Add(new IdNameCode { id = teacherBase.id, name = teacherBase.name, code = teacherBase.lang });
                                         inviteids.Add(new IdNameCode { id = teacherBase.id, name = teacherBase.name, code = teacherBase.lang });
@@ -2011,7 +2018,7 @@ namespace TEAMModelOS.Controllers
                         teacherImport = JsonDocument.Parse(response.Content).RootElement.Deserialize<TeacherImport>();
                         teacherImport = JsonDocument.Parse(response.Content).RootElement.Deserialize<TeacherImport>();
                         if (teacherImport != null && teacherImport.teachers.Any())
                         if (teacherImport != null && teacherImport.teachers.Any())
                         {
                         {
-                            teachers.ForEach(x =>
+                            foreach (var x in teachers)
                             {
                             {
                                 ImportTeacher tch = null;
                                 ImportTeacher tch = null;
                                 if (string.IsNullOrWhiteSpace(x.id))
                                 if (string.IsNullOrWhiteSpace(x.id))
@@ -2051,7 +2058,8 @@ namespace TEAMModelOS.Controllers
                                         id = x.id
                                         id = x.id
                                     });
                                     });
                                 }
                                 }
-                            });
+                            }
+                           
                             await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.School).ReplaceItemAsync(teacherImport, $"{_schoolId}", new PartitionKey("TeacherImport"));
                             await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.School).ReplaceItemAsync(teacherImport, $"{_schoolId}", new PartitionKey("TeacherImport"));
                         }
                         }
                         else
                         else
@@ -2067,12 +2075,12 @@ namespace TEAMModelOS.Controllers
                     }
                     }
 
 
 
 
-                    if (inviteids.Any())
-                    {
-                        string bizcode = "invite";
-                        _coreAPIHttpService.PushNotify(inviteids, $"{bizcode}_school", Constant.NotifyType_IES5_Management,
-                        new Dictionary<string, object> { { "tmdname", adminName }, { "schoolName", schoolBase.name }, { "schoolId", $"{_schoolId}" }, { "tmdid", adminId } }, _option.Location, _configuration, _dingDing, _environment.ContentRootPath);
-                    }
+                    //if (inviteids.Any())
+                    //{
+                    //    string bizcode = "invite";
+                    //    _coreAPIHttpService.PushNotify(inviteids, $"{bizcode}_school", Constant.NotifyType_IES5_Management,
+                    //    new Dictionary<string, object> { { "tmdname", adminName }, { "schoolName", schoolBase.name }, { "schoolId", $"{_schoolId}" }, { "tmdid", adminId } }, _option.Location, _configuration, _dingDing, _environment.ContentRootPath);
+                    //}
                     break;
                     break;
             }
             }
             return Ok(new { teacherImport });
             return Ok(new { teacherImport });