@@ -231,6 +231,20 @@ public String post(String uri, String postData, String accessTokenKey) throws Wx
231
231
}
232
232
}
233
233
234
+ @ Override
235
+ public String post (String uri , String postData , String accessTokenKey , String accessToken ) throws WxErrorException {
236
+ String uriWithComponentAccessToken = uri + (uri .contains ("?" ) ? "&" : "?" ) + accessTokenKey + "=" + accessToken ;
237
+ try {
238
+ return getWxOpenService ().post (uriWithComponentAccessToken , postData );
239
+ } catch (WxErrorException e ) {
240
+ WxError error = e .getError ();
241
+ if (error .getErrorCode () != 0 ) {
242
+ throw new WxErrorException (error , e );
243
+ }
244
+ return error .getErrorMsg ();
245
+ }
246
+ }
247
+
234
248
@ Override
235
249
public String get (String uri ) throws WxErrorException {
236
250
return get (uri , "component_access_token" );
@@ -398,22 +412,24 @@ public WxOpenAuthorizerListResult getAuthorizerList(int begin, int len) throws W
398
412
399
413
@ Override
400
414
public WxOpenAuthorizerOptionResult getAuthorizerOption (String authorizerAppid , String optionName ) throws WxErrorException {
415
+ String authorizerAccessToken = this .getAuthorizerAccessToken (authorizerAppid , false );
401
416
JsonObject jsonObject = new JsonObject ();
402
417
jsonObject .addProperty ("component_appid" , getWxOpenConfigStorage ().getComponentAppId ());
403
418
jsonObject .addProperty ("authorizer_appid" , authorizerAppid );
404
419
jsonObject .addProperty ("option_name" , optionName );
405
- String responseContent = post (GET_AUTHORIZER_OPTION_URL , jsonObject .toString ());
420
+ String responseContent = post (GET_AUTHORIZER_OPTION_URL , jsonObject .toString (), "access_token" , authorizerAccessToken );
406
421
return WxOpenGsonBuilder .create ().fromJson (responseContent , WxOpenAuthorizerOptionResult .class );
407
422
}
408
423
409
424
@ Override
410
425
public void setAuthorizerOption (String authorizerAppid , String optionName , String optionValue ) throws WxErrorException {
426
+ String authorizerAccessToken = this .getAuthorizerAccessToken (authorizerAppid , false );
411
427
JsonObject jsonObject = new JsonObject ();
412
428
jsonObject .addProperty ("component_appid" , getWxOpenConfigStorage ().getComponentAppId ());
413
429
jsonObject .addProperty ("authorizer_appid" , authorizerAppid );
414
430
jsonObject .addProperty ("option_name" , optionName );
415
431
jsonObject .addProperty ("option_value" , optionValue );
416
- post (SET_AUTHORIZER_OPTION_URL , jsonObject .toString ());
432
+ post (SET_AUTHORIZER_OPTION_URL , jsonObject .toString (), "access_token" , authorizerAccessToken );
417
433
}
418
434
419
435
@ Override
0 commit comments