@@ -297,30 +297,48 @@ public void getMediaFile(@NonNull long sdk, @NonNull String sdkfileid, String pr
297297
298298 @ Override
299299 public List <String > getPermitUserList (Integer type ) throws WxErrorException {
300+ // 获取会话存档专用的access token
301+ String msgAuditAccessToken = this .cpService .getMsgAuditAccessToken (false );
300302 final String apiUrl = this .cpService .getWxCpConfigStorage ().getApiUrl (GET_PERMIT_USER_LIST );
303+ // 手动拼接access_token参数
304+ String urlWithToken = apiUrl + (apiUrl .contains ("?" ) ? "&" : "?" ) + "access_token=" + msgAuditAccessToken ;
305+
301306 JsonObject jsonObject = new JsonObject ();
302307 if (type != null ) {
303308 jsonObject .addProperty ("type" , type );
304309 }
305- String responseContent = this .cpService .post (apiUrl , jsonObject .toString ());
310+ // 使用不自动添加access token的post方法
311+ String responseContent = this .cpService .postWithoutToken (urlWithToken , jsonObject .toString ());
306312 return WxCpGsonBuilder .create ().fromJson (GsonParser .parse (responseContent ).getAsJsonArray ("ids" ),
307313 new TypeToken <List <String >>() {
308314 }.getType ());
309315 }
310316
311317 @ Override
312318 public WxCpGroupChat getGroupChat (@ NonNull String roomid ) throws WxErrorException {
319+ // 获取会话存档专用的access token
320+ String msgAuditAccessToken = this .cpService .getMsgAuditAccessToken (false );
313321 final String apiUrl = this .cpService .getWxCpConfigStorage ().getApiUrl (GET_GROUP_CHAT );
322+ // 手动拼接access_token参数
323+ String urlWithToken = apiUrl + (apiUrl .contains ("?" ) ? "&" : "?" ) + "access_token=" + msgAuditAccessToken ;
324+
314325 JsonObject jsonObject = new JsonObject ();
315326 jsonObject .addProperty ("roomid" , roomid );
316- String responseContent = this .cpService .post (apiUrl , jsonObject .toString ());
327+ // 使用不自动添加access token的post方法
328+ String responseContent = this .cpService .postWithoutToken (urlWithToken , jsonObject .toString ());
317329 return WxCpGroupChat .fromJson (responseContent );
318330 }
319331
320332 @ Override
321333 public WxCpAgreeInfo checkSingleAgree (@ NonNull WxCpCheckAgreeRequest checkAgreeRequest ) throws WxErrorException {
334+ // 获取会话存档专用的access token
335+ String msgAuditAccessToken = this .cpService .getMsgAuditAccessToken (false );
322336 String apiUrl = this .cpService .getWxCpConfigStorage ().getApiUrl (CHECK_SINGLE_AGREE );
323- String responseContent = this .cpService .post (apiUrl , checkAgreeRequest .toJson ());
337+ // 手动拼接access_token参数
338+ String urlWithToken = apiUrl + (apiUrl .contains ("?" ) ? "&" : "?" ) + "access_token=" + msgAuditAccessToken ;
339+
340+ // 使用不自动添加access token的post方法
341+ String responseContent = this .cpService .postWithoutToken (urlWithToken , checkAgreeRequest .toJson ());
324342 return WxCpAgreeInfo .fromJson (responseContent );
325343 }
326344
0 commit comments