mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-11-03 21:59:05 +08:00
🆕 #1902 【企业微信】增加获取加入企业二维码的接口
This commit is contained in:
@ -183,5 +183,20 @@ public interface WxCpUserService {
|
||||
*/
|
||||
WxCpExternalContactInfo getExternalContact(String userId) throws WxErrorException;
|
||||
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
*
|
||||
* 获取加入企业二维码。
|
||||
*
|
||||
* 请求方式:GET(HTTPS)
|
||||
* 请求地址:https://qyapi.weixin.qq.com/cgi-bin/corp/get_join_qrcode?access_token=ACCESS_TOKEN&size_type=SIZE_TYPE
|
||||
*
|
||||
* 文档地址:https://work.weixin.qq.com/api/doc/90000/90135/91714
|
||||
* </pre>
|
||||
*
|
||||
* @param sizeType qrcode尺寸类型,1: 171 x 171; 2: 399 x 399; 3: 741 x 741; 4: 2052 x 2052
|
||||
* @return join_qrcode 二维码链接,有效期7天
|
||||
* @throws WxErrorException .
|
||||
*/
|
||||
String getJoinQrCode(int sizeType) throws WxErrorException;
|
||||
}
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
package me.chanjar.weixin.cp.api.impl;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.gson.*;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonPrimitive;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
@ -198,4 +200,12 @@ public class WxCpUserServiceImpl implements WxCpUserService {
|
||||
String responseContent = this.mainService.get(url, null);
|
||||
return WxCpExternalContactInfo.fromJson(responseContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getJoinQrCode(int sizeType) throws WxErrorException {
|
||||
String url = this.mainService.getWxCpConfigStorage().getApiUrl(GET_JOIN_QR_CODE + sizeType);
|
||||
String responseContent = this.mainService.get(url, null);
|
||||
JsonObject tmpJson = GsonParser.parse(responseContent);
|
||||
return tmpJson.get("join_qrcode").getAsString();
|
||||
}
|
||||
}
|
||||
|
||||
@ -161,6 +161,7 @@ public final class WxCpApiPathConsts {
|
||||
public static final String USER_CONVERT_TO_USERID = "/cgi-bin/user/convert_to_userid";
|
||||
public static final String GET_USER_ID = "/cgi-bin/user/getuserid";
|
||||
public static final String GET_EXTERNAL_CONTACT = "/cgi-bin/crm/get_external_contact?external_userid=";
|
||||
public static final String GET_JOIN_QR_CODE = "/cgi-bin/corp/get_join_qrcode?size_type=";
|
||||
}
|
||||
|
||||
@UtilityClass
|
||||
|
||||
Reference in New Issue
Block a user