|
@@ -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();
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
}
|