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 {
183
183
*/
184
184
WxCpExternalContactInfo getExternalContact (String userId ) throws WxErrorException ;
185
185
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 ;
187
202
}
Original file line number Diff line number Diff line change 1
1
package me .chanjar .weixin .cp .api .impl ;
2
2
3
3
import 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 ;
5
7
import com .google .gson .reflect .TypeToken ;
6
8
import lombok .RequiredArgsConstructor ;
7
9
import me .chanjar .weixin .common .error .WxErrorException ;
@@ -198,4 +200,12 @@ public WxCpExternalContactInfo getExternalContact(String userId) throws WxErrorE
198
200
String responseContent = this .mainService .get (url , null );
199
201
return WxCpExternalContactInfo .fromJson (responseContent );
200
202
}
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
+ }
201
211
}
Original file line number Diff line number Diff line change @@ -161,6 +161,7 @@ public static class User {
161
161
public static final String USER_CONVERT_TO_USERID = "/cgi-bin/user/convert_to_userid" ;
162
162
public static final String GET_USER_ID = "/cgi-bin/user/getuserid" ;
163
163
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=" ;
164
165
}
165
166
166
167
@ UtilityClass
You can’t perform that action at this time.
0 commit comments