Skip to content

Commit 6e82d2d

Browse files
committed
[Bug修复](master): 修复多企业时配置错乱问题
1 parent c545ef3 commit 6e82d2d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/WxFinanceSDK.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ class WxFinanceSDK
3131
/**
3232
* @var array
3333
*/
34-
protected static $wxConfig;
34+
protected $wxConfig;
3535

36-
public function __construct(array $config = [])
36+
public function __construct(array $config = [], array $wxConfig = [])
3737
{
3838
$default = [
3939
'default' => 'php-ext',
@@ -53,6 +53,7 @@ public function __construct(array $config = [])
5353
}
5454

5555
$this->config = empty($config) ? $default : array_merge($default, $config);
56+
$this->wxConfig = $wxConfig;
5657
}
5758

5859
public function __call($name, $arguments)
@@ -68,8 +69,7 @@ public function __call($name, $arguments)
6869

6970
public static function init(array $wxConfig = [], array $driverConfig = []): self
7071
{
71-
self::$wxConfig = $wxConfig;
72-
return new self($driverConfig);
72+
return new self($driverConfig, $wxConfig);
7373
}
7474

7575
/**
@@ -82,6 +82,6 @@ public function provider($providerName): ProviderInterface
8282
if (! $this->config['providers'] || ! $this->config['providers'][$providerName]) {
8383
throw new InvalidArgumentException("file configurations are missing {$providerName} options");
8484
}
85-
return (new $this->config['providers'][$providerName]['driver']())->setConfig(self::$wxConfig);
85+
return (new $this->config['providers'][$providerName]['driver']())->setConfig($this->wxConfig);
8686
}
8787
}

0 commit comments

Comments
 (0)