Browse Source

Merge branch 'develop6.0-tmd' of http://52.130.252.100:10000/TEAMMODEL/TEAMModelOS into develop6.0-tmd

Li 3 years ago
parent
commit
ab0da8f6f2

+ 6 - 6
TEAMModelOS/Controllers/School/SchoolController.cs

@@ -1568,7 +1568,7 @@ namespace TEAMModelOS.Controllers
                         keys.AddRange(emails);
                         keys.AddRange(emails);
                     }
                     }
                    
                    
-                    teachers.ForEach(x => { x.status = "import";x.time = now; });
+                    teachers.ForEach(x => { x.status = "import";x.time = now;x.iname = x.name;x.name = null; });
                     if (keys.Any()) {
                     if (keys.Any()) {
                         try
                         try
                         {
                         {
@@ -1603,7 +1603,7 @@ namespace TEAMModelOS.Controllers
                                 if (coreUser != null)
                                 if (coreUser != null)
                                 {
                                 {
                                     t.id = coreUser.id;
                                     t.id = coreUser.id;
-                                    t.cname = coreUser.name;
+                                    t.name = coreUser.name;
                                     t.picture=coreUser.picture;
                                     t.picture=coreUser.picture;
                                     t.tmdid=coreUser.id;
                                     t.tmdid=coreUser.id;
                                     if (!string.IsNullOrWhiteSpace(coreUser.mobile)) { 
                                     if (!string.IsNullOrWhiteSpace(coreUser.mobile)) { 
@@ -1623,7 +1623,7 @@ namespace TEAMModelOS.Controllers
                                     if (coreUser != null)
                                     if (coreUser != null)
                                     {
                                     {
                                         t.id = coreUser.id; 
                                         t.id = coreUser.id; 
-                                        t.cname = coreUser.name;
+                                        t.name = coreUser.name;
                                         t.picture = coreUser.picture;
                                         t.picture = coreUser.picture;
                                         t.tmdid = coreUser.id;
                                         t.tmdid = coreUser.id;
                                         if (!string.IsNullOrWhiteSpace(coreUser.mobile))
                                         if (!string.IsNullOrWhiteSpace(coreUser.mobile))
@@ -1645,7 +1645,7 @@ namespace TEAMModelOS.Controllers
                                     if (coreUser != null)
                                     if (coreUser != null)
                                     {
                                     {
                                         t.id = coreUser.id;
                                         t.id = coreUser.id;
-                                        t.cname = coreUser.name;
+                                        t.name = coreUser.name;
                                         t.picture = coreUser.picture;
                                         t.picture = coreUser.picture;
                                         t.tmdid = coreUser.id;
                                         t.tmdid = coreUser.id;
                                         if (!string.IsNullOrWhiteSpace(coreUser.mobile))
                                         if (!string.IsNullOrWhiteSpace(coreUser.mobile))
@@ -1670,7 +1670,7 @@ namespace TEAMModelOS.Controllers
                                     t.status = "invite";
                                     t.status = "invite";
                                     teacher = new SchoolTeacher {
                                     teacher = new SchoolTeacher {
                                         id = t.id,
                                         id = t.id,
-                                        name = t.cname,
+                                        name = t.name,
                                         permissions = new List<string>(),
                                         permissions = new List<string>(),
                                         picture = t.picture,
                                         picture = t.picture,
                                         job = null,
                                         job = null,
@@ -1700,7 +1700,7 @@ namespace TEAMModelOS.Controllers
                                         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"));
                                     }
                                     }
                                     else {
                                     else {
-                                        Teacher teacherBase = new Teacher { id = t.id, name = t.cname, picture = t.picture, size = 2,code="Base",pk="Base", schools = new List<TeacherSchool> {
+                                        Teacher teacherBase = new Teacher { id = t.id, name = t.name, picture = t.picture, size = 2,code="Base",pk="Base", schools = new List<TeacherSchool> {
                                             new TeacherSchool {schoolId= schoolBase.id,name= schoolBase.name,picture= schoolBase.picture, areaId= schoolBase.areaId,time=now,status= "invite" },
                                             new TeacherSchool {schoolId= schoolBase.id,name= schoolBase.name,picture= schoolBase.picture, areaId= schoolBase.areaId,time=now,status= "invite" },
                                         } };
                                         } };
                                         await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Teacher).CreateItemAsync(teacherBase, new PartitionKey("Base"));
                                         await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Teacher).CreateItemAsync(teacherBase, new PartitionKey("Base"));

+ 2 - 24
TEAMModelOS/Controllers/School/SchoolTeacherController.cs

@@ -937,31 +937,9 @@ namespace TEAMModelOS.Controllers
         [Authorize(Roles = "IES")]
         [Authorize(Roles = "IES")]
         public async Task<IActionResult> GetUserFromCoreID(JsonElement request)
         public async Task<IActionResult> GetUserFromCoreID(JsonElement request)
         {
         {
-
-
             var content = new StringContent(request.ToString(), Encoding.UTF8, "application/json");
             var content = new StringContent(request.ToString(), Encoding.UTF8, "application/json");
-            string a = await  _coreAPIHttpService.GetUserInfos(content);
-            return Ok(a.ToObject<JsonElement>());
-            try
-            {
-                string url = _configuration.GetValue<string>("HaBookAuth:CoreId:userinfo"); 
-                HttpClient client = new HttpClient();
-              //  var content = new StringContent(request.ToString(), Encoding.UTF8, "application/json");
-                HttpResponseMessage responseMessage = await client.PostAsync(url, content);
-                if(responseMessage.StatusCode == HttpStatusCode.OK)
-                {
-                    string responseBody = responseMessage.Content.ReadAsStringAsync().Result;
-                    return Ok(responseBody);
-                }
-                else
-                {
-                    return BadRequest();
-                }
-            }
-            catch (Exception ex)
-            {
-                return BadRequest();
-            }
+            string json = await  _coreAPIHttpService.GetUserInfos(content);
+            return Ok(json.ToObject<JsonElement>());
         }
         }
     }
     }
 }
 }

+ 1 - 1
TEAMModelOS/Controllers/Teacher/InitController.cs

@@ -848,7 +848,7 @@ namespace TEAMModelOS.Controllers
                                 tch.status = $"{grant_type}";
                                 tch.status = $"{grant_type}";
                                 tch.time = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
                                 tch.time = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
                                 tch.tmdid = id;
                                 tch.tmdid = id;
-                                tch.cname = $"{name }";
+                                tch.name = $"{name }";
                                 await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.School).ReplaceItemAsync(teacherImport, $"{school_code}", new PartitionKey("TeacherImport"));
                                 await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.School).ReplaceItemAsync(teacherImport, $"{school_code}", new PartitionKey("TeacherImport"));
                             }
                             }
                         }
                         }