From d5fb9d2b307251c7faedcb61758119bcb5b836d0 Mon Sep 17 00:00:00 2001 From: Anyon Date: Wed, 23 May 2018 15:29:30 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=9B=B4=E6=96=B0]=E5=A2=9E=E5=8A=A0=E7=A1=AE?= =?UTF-8?q?=E8=AE=A4=E6=8E=A5=E5=8F=97=E5=85=AC=E4=BC=97=E5=8F=B7=E5=B0=86?= =?UTF-8?q?=E6=9F=90=E6=9D=83=E9=99=90=E9=9B=86=E9=AB=98=E7=BA=A7=E6=9D=83?= =?UTF-8?q?=E9=99=90=E7=9A=84=E6=8E=88=E6=9D=83=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WeOpen/Service.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) 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