|
|
@@ -32,8 +32,22 @@ class WechatService
|
|
|
|
|
|
public static function options()
|
|
|
{
|
|
|
- $wechat = SystemConfigService::more(['wechat_appid', 'wechat_appsecret', 'wechat_token', 'wechat_encodingaeskey', 'wechat_encode']);
|
|
|
- $payment = SystemConfigService::more(['pay_weixin_mchid', 'pay_weixin_client_cert', 'pay_weixin_client_key', 'pay_weixin_key', 'pay_weixin_open']);
|
|
|
+ $wechat = SystemConfigService::more([
|
|
|
+ 'wechat_appid',
|
|
|
+ 'wechat_appsecret',
|
|
|
+ 'wechat_token',
|
|
|
+ 'wechat_encodingaeskey',
|
|
|
+ 'wechat_encode',
|
|
|
+ ]);
|
|
|
+ $payment = SystemConfigService::more([
|
|
|
+ 'pay_weixin_appid',
|
|
|
+ 'pay_weixin_appsecret',
|
|
|
+ 'pay_weixin_mchid',
|
|
|
+ 'pay_weixin_client_cert',
|
|
|
+ 'pay_weixin_client_key',
|
|
|
+ 'pay_weixin_key',
|
|
|
+ 'pay_weixin_open',
|
|
|
+ ]);
|
|
|
$config = [
|
|
|
'app_id' => isset($wechat['wechat_appid']) ? trim($wechat['wechat_appid']) : '',
|
|
|
'secret' => isset($wechat['wechat_appsecret']) ? trim($wechat['wechat_appsecret']) : '',
|
|
|
@@ -43,10 +57,16 @@ class WechatService
|
|
|
'verify' => false
|
|
|
],
|
|
|
];
|
|
|
- if (isset($wechat['wechat_encode']) && (int)$wechat['wechat_encode'] > 0 && isset($wechat['wechat_encodingaeskey']) && !empty($wechat['wechat_encodingaeskey']))
|
|
|
- $config['aes_key'] = $wechat['wechat_encodingaeskey'];
|
|
|
+ if (isset($wechat['wechat_encode']) &&
|
|
|
+ (int)$wechat['wechat_encode'] > 0 &&
|
|
|
+ isset($wechat['wechat_encodingaeskey']) &&
|
|
|
+ !empty($wechat['wechat_encodingaeskey'])) {
|
|
|
+ $config['aes_key'] = $wechat['wechat_encodingaeskey'];
|
|
|
+ }
|
|
|
+
|
|
|
if (isset($payment['pay_weixin_open']) && $payment['pay_weixin_open'] == 1) {
|
|
|
$config['payment'] = [
|
|
|
+ 'app_id' => trim($payment['pay_weixin_appid']),
|
|
|
'merchant_id' => trim($payment['pay_weixin_mchid']),
|
|
|
'key' => trim($payment['pay_weixin_key']),
|
|
|
'cert_path' => realpath('.' . $payment['pay_weixin_client_cert']),
|