File tree Expand file tree Collapse file tree 3 files changed +28
-2
lines changed
weixin-java-cp/src/main/java/me/chanjar/weixin/cp Expand file tree Collapse file tree 3 files changed +28
-2
lines changed Original file line number Diff line number Diff line change @@ -183,5 +183,20 @@ public interface WxCpUserService {
183183 */
184184 WxCpExternalContactInfo getExternalContact (String userId ) throws WxErrorException ;
185185
186-
186+ /**
187+ * <pre>
188+ *
189+ * 获取加入企业二维码。
190+ *
191+ * 请求方式:GET(HTTPS)
192+ * 请求地址:https://qyapi.weixin.qq.com/cgi-bin/corp/get_join_qrcode?access_token=ACCESS_TOKEN&size_type=SIZE_TYPE
193+ *
194+ * 文档地址:https://work.weixin.qq.com/api/doc/90000/90135/91714
195+ * </pre>
196+ *
197+ * @param sizeType qrcode尺寸类型,1: 171 x 171; 2: 399 x 399; 3: 741 x 741; 4: 2052 x 2052
198+ * @return join_qrcode 二维码链接,有效期7天
199+ * @throws WxErrorException .
200+ */
201+ String getJoinQrCode (int sizeType ) throws WxErrorException ;
187202}
Original file line number Diff line number Diff line change 11package me .chanjar .weixin .cp .api .impl ;
22
33import com .google .common .collect .Maps ;
4- import com .google .gson .*;
4+ import com .google .gson .JsonArray ;
5+ import com .google .gson .JsonObject ;
6+ import com .google .gson .JsonPrimitive ;
57import com .google .gson .reflect .TypeToken ;
68import lombok .RequiredArgsConstructor ;
79import me .chanjar .weixin .common .error .WxErrorException ;
@@ -198,4 +200,12 @@ public WxCpExternalContactInfo getExternalContact(String userId) throws WxErrorE
198200 String responseContent = this .mainService .get (url , null );
199201 return WxCpExternalContactInfo .fromJson (responseContent );
200202 }
203+
204+ @ Override
205+ public String getJoinQrCode (int sizeType ) throws WxErrorException {
206+ String url = this .mainService .getWxCpConfigStorage ().getApiUrl (GET_JOIN_QR_CODE + sizeType );
207+ String responseContent = this .mainService .get (url , null );
208+ JsonObject tmpJson = GsonParser .parse (responseContent );
209+ return tmpJson .get ("join_qrcode" ).getAsString ();
210+ }
201211}
Original file line number Diff line number Diff line change @@ -161,6 +161,7 @@ public static class User {
161161 public static final String USER_CONVERT_TO_USERID = "/cgi-bin/user/convert_to_userid" ;
162162 public static final String GET_USER_ID = "/cgi-bin/user/getuserid" ;
163163 public static final String GET_EXTERNAL_CONTACT = "/cgi-bin/crm/get_external_contact?external_userid=" ;
164+ public static final String GET_JOIN_QR_CODE = "/cgi-bin/corp/get_join_qrcode?size_type=" ;
164165 }
165166
166167 @ UtilityClass
You can’t perform that action at this time.
0 commit comments