CrazyIter_Bin %!s(int64=2) %!d(string=hai) anos
pai
achega
a07ee832b9

+ 18 - 4
TEAMModelOS.SDK/DI/CoreAPI/CoreAPIHttpService.cs

@@ -167,7 +167,7 @@ namespace TEAMModelOS.SDK
         /// <param name="_configuration"></param>
         /// <param name="_dingDing"></param>
         /// <returns></returns>
-        public     void PushNotify(List<IdNameCode> toTeachers ,  string notifyCode,string notifyType,Dictionary<string, object> replaceData, 
+        public       void PushNotify(List<IdNameCode> toTeachers ,  string notifyCode,string notifyType,Dictionary<string, object> replaceData, 
             string location, IConfiguration _configuration, DI.DingDing _dingDing,string rootPath) {
             /*
              * IES5_Management  shift-assist_school  DelBeforeCopyAbility-mark_start  copyAbility-mark_finish  copyAbility-mark_start 
@@ -232,7 +232,13 @@ namespace TEAMModelOS.SDK
                 }
                 else { replaceData.Add("scope", "private"); }
                 var token = CoreTokenExtensions.CreateAccessToken(clientID, clientSecret, location).Result;
-                if (_httpClient.DefaultRequestHeaders.Contains("Authorization")) {
+                if (_httpClient.DefaultRequestHeaders.Contains("Authorization"))
+                {
+                    _httpClient.DefaultRequestHeaders.Remove("Authorization");
+                    _httpClient.DefaultRequestHeaders.Add("Authorization", $"Bearer {token.AccessToken}");
+                }
+                else
+                {
                     _httpClient.DefaultRequestHeaders.Add("Authorization", $"Bearer {token.AccessToken}");
                 }
                 foreach (var group in groups)
@@ -308,12 +314,20 @@ namespace TEAMModelOS.SDK
                                 });
                                 notifyData.body = msgs[1];
                             }
-                           
+                            string result = "";
                             HttpResponseMessage responseMessage = _httpClient.PostAsJsonAsync($"{url}/service/PushNotify", notifyData).Result;
                             if (responseMessage.StatusCode == HttpStatusCode.OK)
                             {
-                                string content =   responseMessage.Content.ReadAsStringAsync().Result;
+                                string content = responseMessage.Content.ReadAsStringAsync().Result;
+                                result = content;
+                            }
+                            else
+                            {
+                                result = $"{responseMessage.StatusCode},推送返回的状态码。";
+
                             }
+                            _dingDing.SendBotMsg($"{location}站点发送消息:\n{url}/service/PushNotify \nheader:  {token.AccessToken} \nresult:{result}\n params:{notifyData.ToJsonString()}", GroupNames.成都开发測試群組).GetAwaiter().GetResult();
+
                         }
                     }
                 }

+ 0 - 1
TEAMModelOS/Controllers/School/ArtReviewController.cs

@@ -239,7 +239,6 @@ namespace TEAMModelOS.Controllers
                     score=allScore,
                     allSubjectQuotas= allSubjectQuotas.ToList()
                 };
-                
                 studentPdfs.Add(studentPdf);
             });
             return Ok(new { studentPdfs = studentPdfs });

+ 21 - 21
TEAMModelOS/Controllers/Third/Sc/ScDataInitController.cs

@@ -228,27 +228,27 @@ namespace TEAMModelOS.Controllers.Third
             //未保存在数据库的。
             var asin = a.Except(s).ToList();
             string json_asin = asin.ToJsonString();
-            var aa =a.Except(asin);
-            if (aa.Any()) {
-                List<ScTeacher> newTeachers = new List<ScTeacher>();
-                var allScteacher = json.ToObject<List<ScTeacher>>(new JsonSerializerOptions { PropertyNameCaseInsensitive = false });
-                aa.ToList().ForEach(a => {
-                    var newTeacher = allScteacher.Find(x => $"{x.TID}".Equals(a));
-                    if (newTeacher != null) {
-                       var schoolInfo = ScSchools.Find(x => x.schoolid == newTeacher.SchoolID);
-                        if (schoolInfo != null) {
-                            newTeacher.status = 1; 
-                            newTeacher.areaId = $"{areaId}";
-                            newTeacher.PartitionKey = "ScTeacher";
-                            newTeacher.tmdid = null;
-                            newTeacher.schoolCode = schoolInfo?.schoolCode;
-                            newTeacher.RowKey = $"{newTeacher.PXID}";
-                            newTeachers.Add(newTeacher);
-                        }
-                    }
-                });
-                 await table.SaveOrUpdateAll(newTeachers);
-            }
+            //var aa =a.Except(asin);
+            //if (aa.Any()) {
+            //    List<ScTeacher> newTeachers = new List<ScTeacher>();
+            //    var allScteacher = json.ToObject<List<ScTeacher>>(new JsonSerializerOptions { PropertyNameCaseInsensitive = false });
+            //    aa.ToList().ForEach(a => {
+            //        var newTeacher = allScteacher.Find(x => $"{x.TID}".Equals(a));
+            //        if (newTeacher != null) {
+            //           var schoolInfo = ScSchools.Find(x => x.schoolid == newTeacher.SchoolID);
+            //            if (schoolInfo != null) {
+            //                newTeacher.status = 1; 
+            //                newTeacher.areaId = $"{areaId}";
+            //                newTeacher.PartitionKey = "ScTeacher";
+            //                newTeacher.tmdid = null;
+            //                newTeacher.schoolCode = schoolInfo?.schoolCode;
+            //                newTeacher.RowKey = $"{newTeacher.PXID}";
+            //                newTeachers.Add(newTeacher);
+            //            }
+            //        }
+            //    });
+            //     await table.SaveOrUpdateAll(newTeachers);
+            //}
             #region 省平台获取到最新的教师,并添加到Table中。
             var adds = teachers.FindAll(x => asin.Contains($"{x.TID}"));