diff --git a/app/Http/Controllers/Api/TestController.php b/app/Http/Controllers/Api/TestController.php index 16fbe7b..254cd00 100644 --- a/app/Http/Controllers/Api/TestController.php +++ b/app/Http/Controllers/Api/TestController.php @@ -2,6 +2,7 @@ namespace App\Http\Controllers\Api; +use App\Models\AdminSetting; use App\Models\Agent; use App\Service\OpenPlatform; use EasyWeChat\OpenPlatform\Authorizer\MiniProgram\Code\Client; @@ -21,6 +22,9 @@ class TestController $redis_key = 'mini_program_set_host:' . substr(md5(env('APP_URL')), 0, 10); Redis::del($redis_key); + $redis_key = 'mini_program_set_privacy'; + Redis::del($redis_key); + $agent = Agent::find(3); $openPlatform = new OpenPlatform(); $refreshToken = $openPlatform->refreshToken($agent->appid); @@ -35,7 +39,31 @@ class TestController dd('获取code失败'); } - dd($code->httpPostJson('cgi-bin/component/getprivacysetting')); } +// dd($code->httpPostJson('cgi-bin/component/getprivacysetting')); + + $data = [ + 'privacy_ver' => 2, //1表示现网版本;2表示开发版。默认是2开发版 + 'owner_setting' => [ + 'contact_phone' => AdminSetting::val('service_component_phone'), + 'notice_method' => '系统公告', + ], + 'setting_list' => [ + [ + "privacy_key" => "Location", + "privacy_text" => "位置信息", + "privacy_label" => "位置信息", + ], + [ + "privacy_key" => "PhoneNumber", + "privacy_text" => "手机号", + "privacy_label" => "手机号", + ], + ], + ]; + + dd($code->httpPostJson('cgi-bin/component/setprivacysetting', $data)); + + } /** * 模拟登录