@@ -231,6 +231,20 @@ public String post(String uri, String postData, String accessTokenKey) throws Wx
231231 }
232232 }
233233
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+
234248 @ Override
235249 public String get (String uri ) throws WxErrorException {
236250 return get (uri , "component_access_token" );
@@ -398,22 +412,24 @@ public WxOpenAuthorizerListResult getAuthorizerList(int begin, int len) throws W
398412
399413 @ Override
400414 public WxOpenAuthorizerOptionResult getAuthorizerOption (String authorizerAppid , String optionName ) throws WxErrorException {
415+ String authorizerAccessToken = this .getAuthorizerAccessToken (authorizerAppid , false );
401416 JsonObject jsonObject = new JsonObject ();
402417 jsonObject .addProperty ("component_appid" , getWxOpenConfigStorage ().getComponentAppId ());
403418 jsonObject .addProperty ("authorizer_appid" , authorizerAppid );
404419 jsonObject .addProperty ("option_name" , optionName );
405- String responseContent = post (API_GET_AUTHORIZER_OPTION_URL , jsonObject .toString ());
420+ String responseContent = post (GET_AUTHORIZER_OPTION_URL , jsonObject .toString (), "access_token" , authorizerAccessToken );
406421 return WxOpenGsonBuilder .create ().fromJson (responseContent , WxOpenAuthorizerOptionResult .class );
407422 }
408423
409424 @ Override
410425 public void setAuthorizerOption (String authorizerAppid , String optionName , String optionValue ) throws WxErrorException {
426+ String authorizerAccessToken = this .getAuthorizerAccessToken (authorizerAppid , false );
411427 JsonObject jsonObject = new JsonObject ();
412428 jsonObject .addProperty ("component_appid" , getWxOpenConfigStorage ().getComponentAppId ());
413429 jsonObject .addProperty ("authorizer_appid" , authorizerAppid );
414430 jsonObject .addProperty ("option_name" , optionName );
415431 jsonObject .addProperty ("option_value" , optionValue );
416- post (API_SET_AUTHORIZER_OPTION_URL , jsonObject .toString ());
432+ post (SET_AUTHORIZER_OPTION_URL , jsonObject .toString (), "access_token" , authorizerAccessToken );
417433 }
418434
419435 @ Override
0 commit comments