提交 a1e644d5 编写于 作者: sq3536's avatar sq3536

代码表

上级 ed74d664
...@@ -75,7 +75,7 @@ public class UserDingtalkRegisterService { ...@@ -75,7 +75,7 @@ public class UserDingtalkRegisterService {
*/ */
public JSONObject requestDingtalkUserByCode(String code, long currentTimeMillis, String dingTalkAppId, String dingTalkAppSecret) { public JSONObject requestDingtalkUserByCode(String code, long currentTimeMillis, String dingTalkAppId, String dingTalkAppSecret) {
JSONObject returnObj = null; JSONObject returnObj = null;
CloseableHttpClient client = null;
try { try {
// 根据timestamp, appSecret计算签名值 // 根据timestamp, appSecret计算签名值
String stringToSign = String.valueOf(currentTimeMillis); String stringToSign = String.valueOf(currentTimeMillis);
...@@ -91,7 +91,7 @@ public class UserDingtalkRegisterService { ...@@ -91,7 +91,7 @@ public class UserDingtalkRegisterService {
+ "&signature=" + urlEncodeSignature; + "&signature=" + urlEncodeSignature;
// 创建httpclient对象 // 创建httpclient对象
CloseableHttpClient client = HttpClients.createDefault(); client = HttpClients.createDefault();
// 创建post方式请求对象 // 创建post方式请求对象
HttpPost httpPost = new HttpPost(url); HttpPost httpPost = new HttpPost(url);
...@@ -134,6 +134,14 @@ public class UserDingtalkRegisterService { ...@@ -134,6 +134,14 @@ public class UserDingtalkRegisterService {
} catch (IOException e) { } catch (IOException e) {
throw new BadRequestAlertException("连接钉钉服务端失败", "UserDingtalkRegisterService", ""); throw new BadRequestAlertException("连接钉钉服务端失败", "UserDingtalkRegisterService", "");
} }
finally {
if(client != null) {
try {
client.close();
} catch (IOException e) {
}
}
}
return returnObj; return returnObj;
} }
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册