提交 c6fac989 authored 作者: 000516's avatar 000516

飞书应用添加卤币学院

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