diff --git a/app/common/library/wxserver/Server.php b/app/common/library/wxserver/Server.php index 59146fa4..c207f788 100644 --- a/app/common/library/wxserver/Server.php +++ b/app/common/library/wxserver/Server.php @@ -492,6 +492,29 @@ class Server $token = $this->authorizerAccessToken($appid); if ($token) { $url = "https://api.weixin.qq.com/cgi-bin/component/getprivacysetting?access_token=$token"; + $setting_list = [ + ['privacy_key' => 'PhoneNumber', 'privacy_text' => '用于用户一键登录'], + ['privacy_key' => 'Location', 'privacy_text' => '用于用户选择自提点'], + ['privacy_key' => 'AlbumWriteOnly', 'privacy_text' => '用于用户保存海报'], + ['privacy_key' => 'Address', 'privacy_text' => '用于用户快速获取微信地址'], + ['privacy_key' => 'Invoice', 'privacy_text' => '用于用户申请开票'], + ['privacy_key' => 'Album', 'privacy_text' => '用于用户上传图片'], + ['privacy_key' => 'Clipboard', 'privacy_text' => '用于用户复制粘贴'], + ]; + $data['setting_list'] = $setting_list; + $data['owner_setting']['contact_qq'] = '527264601'; + $data['owner_setting']['notice_method'] = '公告'; + $result = $this->curlPost($url, json_encode($data)); + return json_decode($result, true); + } + return []; + } + + public function setPrivacySetting($appid) + { + $token = $this->authorizerAccessToken($appid); + if ($token) { + $url = "https://api.weixin.qq.com/cgi-bin/component/setprivacysetting?access_token=$token"; $data['privacy_ver'] = 1; $result = $this->curlPost($url, json_encode($data)); return json_decode($result, true);