main
黄海 2 years ago
parent bb9a0a0b29
commit e35eea0e43

@ -4,21 +4,18 @@ import com.dingtalk.api.DefaultDingTalkClient;
import com.dingtalk.api.DingTalkClient;
import com.dingtalk.api.request.OapiGettokenRequest;
import com.dingtalk.api.response.OapiGettokenResponse;
import com.jfinal.kit.PropKit;
import com.taobao.api.ApiException;
public class TestDingTalk {
public static final String corpId = "ding0b95901147fc6be0f2c783f7214b6d69";
public static final long agentId = 2619270936L;
public static final String appKey = "dingr94qyhpr8bflyxqz";
public static final String appSecret = "hnxZ93QqkGJpRyBziaR2vlbOPZo1U9eeqj73DfFuFnIxIUHNPbMR2DkIol9oGteh";
/*
Token,72002
2023-06-06
*/
public static String getToken() throws ApiException {
public static String getToken(String appKey, String appSecret) throws ApiException {
DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/gettoken");
OapiGettokenRequest request = new OapiGettokenRequest();
request.setAppkey(appKey);
@ -29,6 +26,12 @@ public class TestDingTalk {
}
public static void main(String[] args_) throws Exception {
System.out.println(getToken());
PropKit.use("dingtalk.properties");
String corpId = PropKit.get("corpId");
long agentId = PropKit.getInt("agentId");
final String appKey = PropKit.get("appKey");
String appSecret = PropKit.get("appSecret");
System.out.println(getToken(appKey, appSecret));
}
}

@ -0,0 +1,9 @@
# 公司ID
corpId = "ding0b95901147fc6be0f2c783f7214b6d69";
# 这是啥?
agentId = 2619270936L;
# AK SK
appKey = "dingr94qyhpr8bflyxqz";
appSecret = "hnxZ93QqkGJpRyBziaR2vlbOPZo1U9eeqj73DfFuFnIxIUHNPbMR2DkIol9oGteh";

@ -0,0 +1,9 @@
# 公司ID
corpId = "ding0b95901147fc6be0f2c783f7214b6d69";
# 这是啥?
agentId = 2619270936L;
# AK SK
appKey = "dingr94qyhpr8bflyxqz";
appSecret = "hnxZ93QqkGJpRyBziaR2vlbOPZo1U9eeqj73DfFuFnIxIUHNPbMR2DkIol9oGteh";
Loading…
Cancel
Save