diff --git a/WeOpen/Service.php b/WeOpen/Service.php index f61f9a5..155e9f6 100644 --- a/WeOpen/Service.php +++ b/WeOpen/Service.php @@ -127,6 +127,27 @@ public function getAuthorizerInfo($authorizerAppid) return $result['authorizer_info']; } + /** + * 确认接受公众号将某权限集高级权限的授权 + * @param string $authorizerAppid 授权公众号或小程序的appid + * @param string $funcscopeCategoryId 权限集ID + * @param string $confirmValue 是否确认(1.确认授权, 2.取消确认) + * @return array + * @throws InvalidResponseException + * @throws \WeChat\Exceptions\LocalCacheException + */ + public function setAuthorization($authorizerAppid, $funcscopeCategoryId, $confirmValue) + { + $componentAccessToken = $this->getComponentAccessToken(); + $url = "https://api.weixin.qq.com/cgi-bin/component/api_confirm_authorization?component_access_token={$componentAccessToken}"; + return $this->httpPostForJson($url, [ + 'confirm_value' => $confirmValue, + 'authorizer_appid' => $authorizerAppid, + 'funcscope_category_id' => $funcscopeCategoryId, + 'component_appid' => $this->config->get('component_appid'), + ]); + } + /** * 设置授权方的选项信息 * @param string $authorizerAppid 授权公众号或小程序的appid