https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/privacy_config/set_privacy_setting.html
这里需要自定义`owner_setting`下的`ext_file_media_id`,请求接口时具体用哪个`Content-Type`
`multipart/form-data` 返回 data format error
`application/json` 返回 `owner_setting` 未传值
由于是第三方平台的本地我不能用postman展示,代码用的guzzle 7.4
```php
$owenSetting = [
'contact_email' => config('system.open_platform.contact_email'),
'ext_file_media_id' => strval($mediaId),
'notice_method' => '弹窗',
];
$settingList = [
[
'privacy_key' => 'PhoneNumber',
'privacy_text' => '登录绑定手机为后续提供服务使用'
]
];
$setting = [
'owner_setting' => $owenSetting,
'setting_list' => $settingList,
'privacy_ver' => $privacyVer,
];
$client = new Client();
$response = $client->request(
'POST',
$url,
[
// application/x-www-form-urlencoded 返回 data format error
// 'form_params' => $setting,
// application/json 返回 owner_setting必填字段字段缺失 ?
// 'json' => $setting,
// application/json 返回 data format error
'json' => json_encode($setting),
// raw 返回 owner_setting必填字段字段缺失 ?
// 'body' => json_encode($setting)
],
);
$response = $response->getBody();
```
```sh
# 以json格式 encode后提交的报错
错误data format error rid: 61bd4e4f-3275e9cd-2e612332
```
用json,postman截图看一下
https://developers.weixin.qq.com/community/minihome/doc/0000a6037a4fe8707b0d86ca356c00
参考了下之前的`application/json`没问题报字段缺失是 `contact_email`4选1的没有填写