From e25e4a1f549bfa9ec53310b018cb1d0d3fcda225 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=94=E5=A7=AC=E6=A1=91?= Date: Tue, 8 Sep 2020 06:49:15 +0800 Subject: [PATCH] =?UTF-8?q?implode()=20=E7=AD=89=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E8=A7=84=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Gateways/Alipay/AppCharge.php | 2 +- src/Gateways/Alipay/Notify.php | 2 +- src/Gateways/Alipay/QrCharge.php | 2 +- src/Gateways/Alipay/WapCharge.php | 2 +- src/Gateways/Alipay/WebCharge.php | 2 +- src/Gateways/CMBank/AppCharge.php | 2 +- src/Gateways/CMBank/LiteCharge.php | 2 +- src/Gateways/CMBank/QrCharge.php | 2 +- src/Gateways/CMBank/WapCharge.php | 2 +- src/Gateways/CMBank/WebCharge.php | 2 +- src/Helpers/Rsa2Encrypt.php | 4 ++-- src/Helpers/RsaEncrypt.php | 4 ++-- src/Helpers/StrUtil.php | 2 +- 13 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/Gateways/Alipay/AppCharge.php b/src/Gateways/Alipay/AppCharge.php index 3932b317..77b35215 100644 --- a/src/Gateways/Alipay/AppCharge.php +++ b/src/Gateways/Alipay/AppCharge.php @@ -74,7 +74,7 @@ protected function getBizContent(array $requestParams) //'enable_pay_channels' => '', 'store_id' => $requestParams['store_id'] ?? '', 'specified_channel' => 'pcredit', - 'disable_pay_channels' => implode(self::$config->get('limit_pay', ''), ','), + 'disable_pay_channels' => implode(',', self::$config->get('limit_pay', '')), 'ext_user_info' => $requestParams['ext_user_info'] ?? '', 'business_params' => $requestParams['business_params'] ?? '', ]; diff --git a/src/Gateways/Alipay/Notify.php b/src/Gateways/Alipay/Notify.php index e5acefd0..3a403adc 100644 --- a/src/Gateways/Alipay/Notify.php +++ b/src/Gateways/Alipay/Notify.php @@ -35,7 +35,7 @@ public function request() throw new GatewayException('the notify data is empty', Payment::NOTIFY_DATA_EMPTY); } - if (isset($resArr['notify_type']) && isset($resArr['trade_status'])) { + if (isset($resArr['notify_type'], $resArr['trade_status'])) { $notifyWay = 'async'; // 异步 } else { $notifyWay = 'sync'; // 同步 diff --git a/src/Gateways/Alipay/QrCharge.php b/src/Gateways/Alipay/QrCharge.php index 4ef2f810..a4273f49 100644 --- a/src/Gateways/Alipay/QrCharge.php +++ b/src/Gateways/Alipay/QrCharge.php @@ -51,7 +51,7 @@ protected function getBizContent(array $requestParams) 'body' => $requestParams['body'] ?? '', 'operator_id' => $requestParams['operator_id'] ?? '', 'store_id' => $requestParams['store_id'] ?? '', - 'disable_pay_channels' => implode(self::$config->get('limit_pay', ''), ','), + 'disable_pay_channels' => implode(',', self::$config->get('limit_pay', '')), // 使用禁用列表 //'enable_pay_channels' => '', 'terminal_id' => $requestParams['terminal_id'] ?? '', diff --git a/src/Gateways/Alipay/WapCharge.php b/src/Gateways/Alipay/WapCharge.php index d3d966dd..60d8fac8 100644 --- a/src/Gateways/Alipay/WapCharge.php +++ b/src/Gateways/Alipay/WapCharge.php @@ -56,7 +56,7 @@ protected function getBizContent(array $requestParams) 'extend_params' => $requestParams['extend_params'] ?? '', // 使用禁用列表 //'enable_pay_channels' => '', - 'disable_pay_channels' => implode(self::$config->get('limit_pay', ''), ','), + 'disable_pay_channels' => implode(',', self::$config->get('limit_pay', '')), 'store_id' => $requestParams['store_id'] ?? '', 'specified_channel' => $requestParams['specified_channel'] ?? '', 'business_params' => $requestParams['business_params'] ?? '', diff --git a/src/Gateways/Alipay/WebCharge.php b/src/Gateways/Alipay/WebCharge.php index 9e373949..5606891e 100644 --- a/src/Gateways/Alipay/WebCharge.php +++ b/src/Gateways/Alipay/WebCharge.php @@ -76,7 +76,7 @@ protected function getBizContent(array $requestParams) // 使用禁用列表 //'enable_pay_channels' => '', 'store_id' => $requestParams['store_id'] ?? '', - 'disable_pay_channels' => implode(self::$config->get('limit_pay', ''), ','), + 'disable_pay_channels' => implode(',', self::$config->get('limit_pay', '')), 'qr_pay_mode' => $requestParams['qr_pay_mode'] ?? '2', 'qrcode_width' => $requestParams['qrcode_width'] ?? '', 'settle_info' => $requestParams['settle_info'] ?? '', diff --git a/src/Gateways/CMBank/AppCharge.php b/src/Gateways/CMBank/AppCharge.php index 178185e9..f62e2d36 100644 --- a/src/Gateways/CMBank/AppCharge.php +++ b/src/Gateways/CMBank/AppCharge.php @@ -43,7 +43,7 @@ protected function getRequestParams(array $requestParams) { $nowTime = time(); $timeExpire = $requestParams['time_expire'] ?? 0; - $timeExpire = $timeExpire - $nowTime; + $timeExpire -= $nowTime; if ($timeExpire < 3) { $timeExpire = 30; // 如果设置不合法,默认改为30 } diff --git a/src/Gateways/CMBank/LiteCharge.php b/src/Gateways/CMBank/LiteCharge.php index 96745afe..4e7dd601 100644 --- a/src/Gateways/CMBank/LiteCharge.php +++ b/src/Gateways/CMBank/LiteCharge.php @@ -54,7 +54,7 @@ protected function getRequestParams(array $requestParams) { $nowTime = time(); $timeExpire = $requestParams['time_expire'] ?? 0; - $timeExpire = $timeExpire - $nowTime; + $timeExpire -= $nowTime; if ($timeExpire < 3) { $timeExpire = 30; // 如果设置不合法,默认改为30 } diff --git a/src/Gateways/CMBank/QrCharge.php b/src/Gateways/CMBank/QrCharge.php index 3da4c2a2..6f7b70c0 100644 --- a/src/Gateways/CMBank/QrCharge.php +++ b/src/Gateways/CMBank/QrCharge.php @@ -54,7 +54,7 @@ protected function getRequestParams(array $requestParams) { $nowTime = time(); $timeExpire = $requestParams['time_expire'] ?? 0; - $timeExpire = $timeExpire - $nowTime; + $timeExpire -= $nowTime; if ($timeExpire < 3) { $timeExpire = 30; // 如果设置不合法,默认改为30 } diff --git a/src/Gateways/CMBank/WapCharge.php b/src/Gateways/CMBank/WapCharge.php index 49a04aaa..803f4057 100644 --- a/src/Gateways/CMBank/WapCharge.php +++ b/src/Gateways/CMBank/WapCharge.php @@ -54,7 +54,7 @@ protected function getRequestParams(array $requestParams) { $nowTime = time(); $timeExpire = $requestParams['time_expire'] ?? 0; - $timeExpire = $timeExpire - $nowTime; + $timeExpire -= $nowTime; if ($timeExpire < 3) { $timeExpire = 30; // 如果设置不合法,默认改为30 } diff --git a/src/Gateways/CMBank/WebCharge.php b/src/Gateways/CMBank/WebCharge.php index 8a9d34ab..a4ada516 100644 --- a/src/Gateways/CMBank/WebCharge.php +++ b/src/Gateways/CMBank/WebCharge.php @@ -54,7 +54,7 @@ protected function getRequestParams(array $requestParams) { $nowTime = time(); $timeExpire = $requestParams['time_expire'] ?? 0; - $timeExpire = $timeExpire - $nowTime; + $timeExpire -= $nowTime; if ($timeExpire < 3) { $timeExpire = 30; // 如果设置不合法,默认改为30 } diff --git a/src/Helpers/Rsa2Encrypt.php b/src/Helpers/Rsa2Encrypt.php index 29020891..aa88fc85 100644 --- a/src/Helpers/Rsa2Encrypt.php +++ b/src/Helpers/Rsa2Encrypt.php @@ -52,7 +52,7 @@ public function encrypt($data) return ''; } - $res = openssl_get_privatekey($this->key); + $res = openssl_pkey_get_private($this->key); if (empty($res)) { throw new \Exception('您使用的私钥格式错误,请检查RSA私钥配置'); } @@ -78,7 +78,7 @@ public function decrypt($content) return ''; } - $res = openssl_get_privatekey($this->key); + $res = openssl_pkey_get_private($this->key); if (empty($res)) { throw new \Exception('您使用的私钥格式错误,请检查RSA私钥配置'); } diff --git a/src/Helpers/RsaEncrypt.php b/src/Helpers/RsaEncrypt.php index 1bd3a1c3..593e6bd8 100644 --- a/src/Helpers/RsaEncrypt.php +++ b/src/Helpers/RsaEncrypt.php @@ -52,7 +52,7 @@ public function encrypt($data) return ''; } - $res = openssl_get_privatekey($this->key); + $res = openssl_pkey_get_private($this->key); if (empty($res)) { throw new \Exception('您使用的私钥格式错误,请检查RSA私钥配置'); } @@ -78,7 +78,7 @@ public function decrypt($content) return ''; } - $res = openssl_get_privatekey($this->key); + $res = openssl_pkey_get_private($this->key); if (empty($res)) { throw new \Exception('您使用的私钥格式错误,请检查RSA私钥配置'); } diff --git a/src/Helpers/StrUtil.php b/src/Helpers/StrUtil.php index ccfebd5d..5af7d895 100644 --- a/src/Helpers/StrUtil.php +++ b/src/Helpers/StrUtil.php @@ -32,7 +32,7 @@ public static function getNonceStr($length = 32) $chars = 'abcdefghijklmnopqrstuvwxyz0123456789'; $str = ''; for ($i = 0; $i < $length; $i++) { - $str .= substr($chars, mt_rand(0, strlen($chars) - 1), 1); + $str .= $chars[mt_rand(0, strlen($chars) - 1)]; } return $str; }