mirror of
https://gitee.com/zoujingli/WeChatDeveloper.git
synced 2025-04-06 03:58:03 +08:00
Update BasicWePay.php
This commit is contained in:
parent
5d8955a41d
commit
049de7d325
@ -71,6 +71,22 @@ abstract class BasicWePay
|
|||||||
throw new InvalidArgumentException("Missing Config -- [cert_public]");
|
throw new InvalidArgumentException("Missing Config -- [cert_public]");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (stripos($options['cert_public'], '-----BEGIN CERTIFICATE-----') === false) {
|
||||||
|
if (file_exists($options['cert_public'])) {
|
||||||
|
$options['cert_public'] = file_get_contents($options['cert_public']);
|
||||||
|
} else {
|
||||||
|
throw new InvalidArgumentException("File Non-Existent -- [cert_public]");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stripos($options['cert_private'], '-----BEGIN PRIVATE KEY-----') === false) {
|
||||||
|
if (file_exists($options['cert_private'])) {
|
||||||
|
$options['cert_private'] = file_get_contents($options['cert_private']);
|
||||||
|
} else {
|
||||||
|
throw new InvalidArgumentException("File Non-Existent -- [cert_private]");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$this->config['appid'] = isset($options['appid']) ? $options['appid'] : '';
|
$this->config['appid'] = isset($options['appid']) ? $options['appid'] : '';
|
||||||
$this->config['mch_id'] = $options['mch_id'];
|
$this->config['mch_id'] = $options['mch_id'];
|
||||||
$this->config['mch_v3_key'] = $options['mch_v3_key'];
|
$this->config['mch_v3_key'] = $options['mch_v3_key'];
|
||||||
@ -88,7 +104,7 @@ abstract class BasicWePay
|
|||||||
* @param array $config
|
* @param array $config
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public static function instance(array $config)
|
public static function instance($config)
|
||||||
{
|
{
|
||||||
$key = md5(get_called_class() . serialize($config));
|
$key = md5(get_called_class() . serialize($config));
|
||||||
if (isset(self::$cache[$key])) return self::$cache[$key];
|
if (isset(self::$cache[$key])) return self::$cache[$key];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user