REQ-2453: 更新日志

This commit is contained in:
yanglin 2024-07-05 09:47:56 +08:00
parent 90b1664a56
commit 9894181872

View File

@ -31,19 +31,20 @@ public class PushClient {
String sign = DigestUtils
.md5Hex(("POST" + url + postBody + msg.getCmpAndroidSecret()).getBytes("utf8"));
url = url + "?sign=" + sign;
/* HttpPost post = new HttpPost(url);
post.setHeader("User-Agent", USER_AGENT);
StringEntity se = new StringEntity(postBody, "UTF-8");
post.setEntity(se);
// Send the post request and get the response
HttpResponse response = client.execute(post);*/
//String post1 = HttpUtil.post(url, postBody);
cn.hutool.http.HttpResponse response = HttpUtil.createPost(url).header("User-Agent", USER_AGENT)
.body(postBody).execute().charset("utf-8");
int status = response.getStatus();
String result = response.body();
log.info("push response info, url={}, postBody={}, responseCode={}, responseBody={}, isSuccess={}",
url, postBody, status, result, status == 200);
cn.hutool.http.HttpResponse response = null;
try {
response = HttpUtil.createPost(url).header("User-Agent", USER_AGENT)
.body(postBody).execute().charset("utf-8");
} finally {
int status = -1;
String result = null;
if (response != null) {
status = response.getStatus();
result = response.body();
}
log.info("send push finish. phoneType={}, url={}, postBody={}, responseCode={}, responseBody={}, isSuccess={}",
msg.getClass().getSimpleName(), url, postBody, status, result, status == 200);
}
return true;
}