Skip to content

⚡ 新增获取加入企业二维码接口 #1902

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -198,4 +200,12 @@ public WxCpExternalContactInfo getExternalContact(String userId) throws WxErrorE
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();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ public static class User {
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
Expand Down