CrazyIter_Bin 2 лет назад
Родитель
Сommit
cf8b695ea5
1 измененных файлов с 14 добавлено и 10 удалено
  1. 14 10
      TEAMModelOS.SDK/DI/CoreAPI/CoreAPIHttpService.cs

+ 14 - 10
TEAMModelOS.SDK/DI/CoreAPI/CoreAPIHttpService.cs

@@ -416,19 +416,23 @@ 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;
-                                result = content;
-                            }
-                            else
-                            {
-                                result = $"{responseMessage.StatusCode},推送返回的状态码。";
+                            try {
+                                HttpResponseMessage responseMessage = _httpClient.PostAsJsonAsync($"{url}/service/PushNotify", notifyData).Result;
+                                if (responseMessage.StatusCode == HttpStatusCode.OK)
+                                {
+                                    string content = responseMessage.Content.ReadAsStringAsync().Result;
+                                    result = content;
+                                }
+                                else
+                                {
+                                    result = $"{responseMessage.StatusCode},推送返回的状态码。";
 
+                                }
+                            } catch (Exception exm) {
+                               _= _dingDing.SendBotMsg($"{location}站点发送消息异常,{exm.Message}\n{exm.StackTrace}:\n{url}/service/PushNotify \nheader:  {token.AccessToken} \nresult:{result}\n params:{notifyData.ToJsonString()}", GroupNames.成都开发測試群組);
                             }
                             // _dingDing.SendBotMsg($"{location}站点发送消息:\n{url}/service/PushNotify \nheader:  {token.AccessToken} \nresult:{result}\n params:{notifyData.ToJsonString()}", GroupNames.成都开发測試群組).GetAwaiter().GetResult();
-                           
+
                         }
                     }
                 }