Skip to content

Commit 446008b

Browse files
authored
Merge pull request #176 from XueSiLf/2.x
up:1.fix contentSecurity api of miniProgram. 2.add private interface …
2 parents c4f3e56 + 3b2050a commit 446008b

File tree

6 files changed

+11
-15
lines changed

6 files changed

+11
-15
lines changed

src/MiniProgram/Application.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ class Application extends ServiceContainer
8181
Auth\ServiceProvider::class,
8282
Base\ServiceProvider::class,
8383
Broadcast\ServiceProvider::class,
84+
ContentSecurity\ServiceProvider::class,
8485
CustomerService\ServiceProvider::class,
8586
DataCube\ServiceProvider::class,
8687
Express\ServiceProvider::class,

src/OpenPlatform/Authorizer/MiniProgram/Application.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* @property Domain\Client $domain
1414
* @property Material\Client $material
1515
* @property PrivacyConfig\Client $privacyConfig
16+
* @property PrivacyInterface\Client $privacyInterface
1617
* @property QrCodeJump\Client $qrCodeJump
1718
* @property Setting\Client $setting
1819
* @property Tester\Client $tester
@@ -26,6 +27,7 @@ class Application extends MiniProgram
2627
const Material = 'material';
2728
const OpenAuth = 'openAuth';
2829
const PrivacyConfig = 'privacyConfig';
30+
const PrivacyInterface = 'privacyInterface';
2931
const QrCodeJump = 'qrCodeJump';
3032
const Setting = 'setting';
3133
const Tester = 'tester';
@@ -40,6 +42,7 @@ public function __construct(array $config = null, string $name = null, array $va
4042
Domain\ServiceProvider::class,
4143
Material\ServiceProvider::class,
4244
PrivacyConfig\ServiceProvider::class,
45+
PrivacyInterface\ServiceProvider::class,
4346
QrCodeJump\ServiceProvider::class,
4447
Setting\ServiceProvider::class,
4548
Tester\ServiceProvider::class

src/OpenPlatform/Authorizer/MiniProgram/PrivacyConfig/Client.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
11
<?php
2-
/**
3-
* Created by PhpStorm.
4-
* User: XueSi <[email protected]>
5-
* Date: 2022/5/16
6-
* Time: 11:56 下午
7-
*/
8-
declare(strict_types=1);
92

103
namespace EasySwoole\WeChat\OpenPlatform\Authorizer\MiniProgram\PrivacyConfig;
114

@@ -38,7 +31,7 @@ public function setPrivacySetting(
3831
}
3932

4033
$params = [
41-
'privacy_ver' => $privacyVer,
34+
'privacy_ver' => $privacyVer,
4235
'owner_setting' => $ownerSetting,
4336
];
4437
if ($privacyVer === 2) {
@@ -53,6 +46,7 @@ public function setPrivacySetting(
5346

5447
$response = $this->getClient()
5548
->setMethod("POST")
49+
->setHeaders(['content-type' => 'application/json'])
5650
->setBody($this->jsonDataToStream($params))
5751
->send($this->buildUrl(
5852
"/cgi-bin/component/setprivacysetting",
@@ -83,6 +77,7 @@ public function getPrivacySetting(int $privacyVer = 2)
8377

8478
$response = $this->getClient()
8579
->setMethod("POST")
80+
->setHeaders(['content-type' => 'application/json'])
8681
->setBody($this->jsonDataToStream($params))
8782
->send($this->buildUrl(
8883
"/cgi-bin/component/getprivacysetting",

src/OpenPlatform/Authorizer/MiniProgram/PrivacyConfig/ServiceProvider.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
11
<?php
2-
/**
3-
* Created by PhpStorm.
4-
* User: XueSi <[email protected]>
5-
* Date: 2022/5/16
6-
* Time: 11:56 下午
7-
*/
8-
declare(strict_types=1);
92

103
namespace EasySwoole\WeChat\OpenPlatform\Authorizer\MiniProgram\PrivacyConfig;
114

tests/MiniProgram/ApplicationTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ public function testProperties()
3636

3737
$this->assertInstanceOf(\EasySwoole\WeChat\OfficialAccount\CustomerService\Client::class, $app->customerService);
3838

39+
$this->assertInstanceOf(\EasySwoole\WeChat\MiniProgram\ContentSecurity\Client::class, $app->contentSecurity);
40+
3941
$this->assertInstanceOf(\EasySwoole\WeChat\MiniProgram\DataCube\Client::class, $app->dataCube);
4042

4143
$this->assertInstanceOf(\EasySwoole\WeChat\MiniProgram\Express\Client::class, $app->express);

tests/OpenPlatform/Authorizer/MiniProgram/ApplicationTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ public function testProperties()
2828

2929
$this->assertInstanceOf(\EasySwoole\WeChat\OpenPlatform\Authorizer\MiniProgram\PrivacyConfig\Client::class, $miniProgram->privacyConfig);
3030

31+
$this->assertInstanceOf(\EasySwoole\WeChat\OpenPlatform\Authorizer\MiniProgram\PrivacyInterface\Client::class, $miniProgram->privacyInterface);
32+
3133
$this->assertInstanceOf(\EasySwoole\WeChat\OpenPlatform\Authorizer\MiniProgram\QrCodeJump\Client::class, $miniProgram->qrCodeJump);
3234

3335
$this->assertInstanceOf(\EasySwoole\WeChat\OpenPlatform\Authorizer\MiniProgram\Setting\Client::class, $miniProgram->setting);

0 commit comments

Comments
 (0)