Skip to content

Commit 7f3404a

Browse files
authored
Merge pull request #7 from mochat-cloud/develop
[Bug修复](master): 修复服务商应用参数
2 parents e8a982e + 5d62e00 commit 7f3404a

1 file changed

Lines changed: 23 additions & 8 deletions

File tree

src/Provider/WeWork/AbstractProvider.php

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
namespace MoChat\Framework\Provider\WeWork;
1212

1313
use EasyWeChat\Factory;
14+
use EasyWeChat\Kernel\ServiceContainer;
1415
use EasyWeChat\Work\Application;
1516
use EasyWeChat\OpenWork\Application as OpenWorkApplication;
1617
use GuzzleHttp\Client;
@@ -126,7 +127,11 @@ protected function callbackParams(): array
126127
return [null, null];
127128
}
128129

129-
protected function appRebindServerRequest(Application $app): Application
130+
/**
131+
* @param Application|OpenWorkApplication $app
132+
* @return Application|OpenWorkApplication
133+
*/
134+
protected function appRebindServerRequest($app)
130135
{
131136
if (! isDiRequestInit()) {
132137
return $app;
@@ -151,7 +156,11 @@ protected function appRebindServerRequest(Application $app): Application
151156
return $app;
152157
}
153158

154-
protected function appRebindClientRequest(Application $app): Application
159+
/**
160+
* @param Application|OpenWorkApplication $app
161+
* @return Application|OpenWorkApplication
162+
*/
163+
protected function appRebindClientRequest($app)
155164
{
156165
$handler = new CoroutineHandler();
157166
// 设置 HttpClient,部分接口直接使用了 http_client。
@@ -162,16 +171,22 @@ protected function appRebindClientRequest(Application $app): Application
162171
// 部分接口在请求数据时,会根据 guzzle_handler 重置 Handler
163172
$app['guzzle_handler'] = $handler;
164173

165-
// oauth
166-
$app->oauth->setGuzzleOptions([
167-
'http_errors' => false,
168-
'handler' => $stack,
169-
]);
174+
if ($app instanceof Application) {
175+
// oauth
176+
$app->oauth->setGuzzleOptions([
177+
'http_errors' => false,
178+
'handler' => $stack,
179+
]);
180+
}
170181

171182
return $app;
172183
}
173184

174-
protected function appRebindCache(Application $app): Application
185+
/**
186+
* @param Application|OpenWorkApplication $app
187+
* @return Application|OpenWorkApplication
188+
*/
189+
protected function appRebindCache($app)
175190
{
176191
$app['cache'] = ApplicationContext::getContainer()->get(CacheInterface::class);
177192
return $app;

0 commit comments

Comments
 (0)