From 57335f98ce284d232c0cc942595c6baa408122b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=80=99=E5=AD=A6=E6=9D=B0?= Date: Thu, 15 Mar 2018 19:44:34 +0800 Subject: [PATCH] bug fix --- src/Client.php | 6 +++--- src/ServiceProvider/InternalApiServiceProvider.php | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Client.php b/src/Client.php index f695e4c..5d52b59 100644 --- a/src/Client.php +++ b/src/Client.php @@ -33,14 +33,14 @@ class Client */ public function call($uri, $params) { - $config = array_merge(['timeout' => 1], + $config = array_merge(['timeout' => 3], $this->config[$this->currentApp]); + $secret = $config['secret']; unset($config['secret']); $client = new \GuzzleHttp\Client($config); $params['appid'] = $config['appid']; $params['timestamp'] = time(); - $key = $this->config[$this->currentApp]['secret']; - $params['sign'] = sign($params, $key); + $params['sign'] = sign($params, $secret); $resp = $client->post($uri, ['form_params' => $params]); if ($resp->getStatusCode() == 200) { return \GuzzleHttp\json_decode($resp->getBody(), true); diff --git a/src/ServiceProvider/InternalApiServiceProvider.php b/src/ServiceProvider/InternalApiServiceProvider.php index 4417e15..afbfe0c 100644 --- a/src/ServiceProvider/InternalApiServiceProvider.php +++ b/src/ServiceProvider/InternalApiServiceProvider.php @@ -18,9 +18,9 @@ class InternalApiServiceProvider extends ServiceProvider $this->app->singleton('internal.api', function () { return new Client(config('internal_api.client')); }); - foreach (config('internal_api.client') as $appid => $config) { - $this->app->singleton('internal.api.' . $appid, function () use ($appid) { - return $this->app['internal.api']->app($appid); + foreach (config('internal_api.client') as $key => $config) { + $this->app->singleton('internal.api.' . $key, function () use ($key) { + return $this->app['internal.api']->app($key); }); }