提交 2253a929 authored 作者: 000516's avatar 000516

飞书应用添加卤币学院

上级 d4447c4f
...@@ -44,7 +44,10 @@ public class FeiShuUtil { ...@@ -44,7 +44,10 @@ public class FeiShuUtil {
private String appId; private String appId;
@Value("${feishu.luzx.app_secret}") @Value("${feishu.luzx.app_secret}")
private String appSecret; private String appSecret;
@Value("${feishu.lbxy.app_id}")
private String lbxyAppId;
@Value("${feishu.lbxy.app_secret}")
private String lbxyAppSecret;
@Value("${feishu.bot_1.app_id}") @Value("${feishu.bot_1.app_id}")
private String botAppId1; private String botAppId1;
@Value("${feishu.bot_1.app_secret}") @Value("${feishu.bot_1.app_secret}")
...@@ -53,7 +56,8 @@ public class FeiShuUtil { ...@@ -53,7 +56,8 @@ public class FeiShuUtil {
//飞书获取用户信息,注意值:最后的斜杆 //飞书获取用户信息,注意值:最后的斜杆
@Value("${feishu.redirectUri}") @Value("${feishu.redirectUri}")
private String redirectUri; private String redirectUri;
public static final String APP_LUZX = "luzx";
public static final String APP_LBXY = "lbxy";
private static final String UTF_8 = "UTF-8"; private static final String UTF_8 = "UTF-8";
private static final String CONTENT_TYPE = "application/json; charset=utf-8"; private static final String CONTENT_TYPE = "application/json; charset=utf-8";
...@@ -70,12 +74,12 @@ public class FeiShuUtil { ...@@ -70,12 +74,12 @@ public class FeiShuUtil {
* 根据用户的登录临时code获取useraccessToken * 根据用户的登录临时code获取useraccessToken
* 应用:链路中心 * 应用:链路中心
*/ */
public String createUserAccessToken(String code) { public String createUserAccessToken(String code,String app) {
try { try {
HashMap<String, String> bodyMap = new HashMap<>(); HashMap<String, String> bodyMap = new HashMap<>();
bodyMap.put("grant_type", "authorization_code"); bodyMap.put("grant_type", "authorization_code");
bodyMap.put("client_id", "cli_a7dbe3ec7d9e5013"); bodyMap.put("client_id", APP_LUZX.equals(app) ? appId : lbxyAppId);
bodyMap.put("client_secret", "WxiT7uIJNDbDpEGfVCXEwNNfN1A3RgUo"); bodyMap.put("client_secret", APP_LUZX.equals(app) ? appSecret : lbxyAppSecret);
bodyMap.put("redirect_uri", redirectUri); bodyMap.put("redirect_uri", redirectUri);
bodyMap.put("code", code); bodyMap.put("code", code);
...@@ -98,9 +102,9 @@ public class FeiShuUtil { ...@@ -98,9 +102,9 @@ public class FeiShuUtil {
/** /**
* 根据用户的userAccessToken获取用户信息 * 根据用户的userAccessToken获取用户信息
*/ */
public GetUserInfoRespBody getUserInfo(String userAccessToken) { public GetUserInfoRespBody getUserInfo(String userAccessToken,String app) {
try { try {
Client client = getClientLUZX(); Client client = APP_LUZX.equals(app) ? getClientLUZX() : getClientLBXY();
GetUserInfoResp resp = client.authen().userInfo().get(RequestOptions.newBuilder() GetUserInfoResp resp = client.authen().userInfo().get(RequestOptions.newBuilder()
.userAccessToken(userAccessToken) .userAccessToken(userAccessToken)
.build()); .build());
...@@ -328,6 +332,13 @@ public class FeiShuUtil { ...@@ -328,6 +332,13 @@ public class FeiShuUtil {
public Client getClientLUZX() { public Client getClientLUZX() {
return Client.newBuilder(appId, appSecret).build(); return Client.newBuilder(appId, appSecret).build();
} }
/**
* 创建飞书客户端
* 应用:卤币学院
*/
public Client getClientLBXY() {
return Client.newBuilder(lbxyAppId, lbxyAppSecret).build();
}
/** /**
* 创建飞书客户端 * 创建飞书客户端
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论