From eba1a0068f3b79915debac63180be4b5d44ffcc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=90=8D?= <邮箱> Date: Thu, 3 Aug 2023 13:32:18 +0800 Subject: [PATCH] modify path online --- mobile/plugins/payment/wxpay.php | 89 +--------------------- mobile/source/helpers/dalianpay/config/config.php | 4 +- mobile/source/helpers/dalianpay/demo/dalianpay.php | 16 ++-- mobile/source/helpers/dalianpay/library/Base.php | 6 +- 4 files changed, 14 insertions(+), 101 deletions(-) diff --git a/mobile/plugins/payment/wxpay.php b/mobile/plugins/payment/wxpay.php index 446be83..4a0dedd 100755 --- a/mobile/plugins/payment/wxpay.php +++ b/mobile/plugins/payment/wxpay.php @@ -175,96 +175,9 @@ class wxpay // echo $file . "
"; // } // } - - $directory = 'helpers/dalianpay/demo'; // 替换为您要包含文件的目录路径 - // $this->includeDirectory($directory); - // 打开目录 - if ($handle = opendir($directory)) { - // 遍历目录中的文件和目录 - while (($file = readdir($handle)) !== false) { - // 排除当前目录(.)和上级目录(..) - if ($file != '.' && $file != '..') { - // 检查文件是否为 PHP 文件 - if (pathinfo($file, PATHINFO_EXTENSION) === 'php') { - // 构建文件的完整路径 - $filePath = $directory . '/' . $file; - // 包含 PHP 文件 - include_once $filePath; - echo $filePath . '\n\r'; - } - } - } - // 关闭目录句柄 - closedir($handle); - } - - $directory = 'helpers/dalianpay/cert'; // 替换为您要包含文件的目录路径 - // $this->includeDirectory($directory); - // 打开目录 - if ($handle = opendir($directory)) { - // 遍历目录中的文件和目录 - while (($file = readdir($handle)) !== false) { - // 排除当前目录(.)和上级目录(..) - if ($file != '.' && $file != '..') { - // 构建文件的完整路径 - $filePath = $directory . '/' . $file; - // 包含 PHP 文件 - include_once $filePath; - echo $filePath . '\n\r'; - } - } - // 关闭目录句柄 - closedir($handle); - } - - $directory = 'helpers/dalianpay/config'; // 替换为您要包含文件的目录路径 - // $this->includeDirectory($directory); - // 打开目录 - if ($handle = opendir($directory)) { - // 遍历目录中的文件和目录 - while (($file = readdir($handle)) !== false) { - // 排除当前目录(.)和上级目录(..) - if ($file != '.' && $file != '..') { - // 检查文件是否为 PHP 文件 - if (pathinfo($file, PATHINFO_EXTENSION) === 'php') { - // 构建文件的完整路径 - $filePath = $directory . '/' . $file; - // 包含 PHP 文件 - include_once $filePath; - echo $filePath . '\n\r'; - } - } - } - // 关闭目录句柄 - closedir($handle); - } - - $directory = 'helpers/dalianpay/library'; // 替换为您要包含文件的目录路径 - // $this->includeDirectory($directory); - // 打开目录 - if ($handle = opendir($directory)) { - // 遍历目录中的文件和目录 - while (($file = readdir($handle)) !== false) { - // 排除当前目录(.)和上级目录(..) - if ($file != '.' && $file != '..') { - // 检查文件是否为 PHP 文件 - if (pathinfo($file, PATHINFO_EXTENSION) === 'php') { - // 构建文件的完整路径 - $filePath = $directory . '/' . $file; - // 包含 PHP 文件 - include_once $filePath; - echo $filePath . '\n\r'; - } - } - } - // 关闭目录句柄 - closedir($handle); - } - // require_once(BASE_PATH . 'helpers/dalianpay/demo/dalianpay.php'); - // include_once(BASE_PATH . "../plugins/payment/dalianpay/demo/dalianpay.php"); - + require_once(BASE_PATH . 'helpers/dalianpay/demo/dalianpay.php'); $new_plugin = new dalianpay(); $response_data = $new_plugin->pay($this->encrypt($_SESSION['openid']), $order['order_sn'], $order_amount); diff --git a/mobile/source/helpers/dalianpay/config/config.php b/mobile/source/helpers/dalianpay/config/config.php index 2130425..018c392 100644 --- a/mobile/source/helpers/dalianpay/config/config.php +++ b/mobile/source/helpers/dalianpay/config/config.php @@ -18,9 +18,9 @@ // 加密方式 'signtype' => 'RSA', // 渠道公钥 - 'public_key' => dirname(__FILE__) . '/../cert/channel_public_key.pem', + 'public_key' => BASE_PATH . 'helpers/dalianpay/cert/channel_public_key.pem', // 商户私钥 - 'private_key' => dirname(__FILE__) . '/../cert/cus_private_key.pem', + 'private_key' => BASE_PATH . 'helpers/dalianpay/cert/cus_private_key.pem', // 统一支付接口 测试地址 'pay_url' => 'https://open.dalianpay.cn/payapi/unitorder/pay', diff --git a/mobile/source/helpers/dalianpay/demo/dalianpay.php b/mobile/source/helpers/dalianpay/demo/dalianpay.php index c2ccd8a..d5b1d15 100644 --- a/mobile/source/helpers/dalianpay/demo/dalianpay.php +++ b/mobile/source/helpers/dalianpay/demo/dalianpay.php @@ -44,7 +44,7 @@ class dalianpay{ // var_dump($redirect_url); // 加载基础类 - require_once('../library/Base.php'); + require_once(BASE_PATH . 'helpers/dalianpay/library/Base.php'); $Base = new Base(); // 获取配置信息 @@ -165,13 +165,13 @@ class dalianpay{ } } -echo 'hi there.....\n\r'; -$new_plugin = new dalianpay(); -$openid_crypt = 'oCTanxBeiVFWIekJT_GiPZM2UiGY'; -$order_sn = '2023080355429'; -$order_amount = '600'; -$response_data = $new_plugin->pay($openid_crypt,$order_sn,$order_amount); -echo $response_data; +// echo 'hi there.....\n\r'; +// $new_plugin = new dalianpay(); +// $openid_crypt = 'oCTanxBeiVFWIekJT_GiPZM2UiGY'; +// $order_sn = '2023080355429'; +// $order_amount = '600'; +// $response_data = $new_plugin->pay($openid_crypt,$order_sn,$order_amount); +// echo $response_data; ?> diff --git a/mobile/source/helpers/dalianpay/library/Base.php b/mobile/source/helpers/dalianpay/library/Base.php index 6f11ca4..8c34270 100644 --- a/mobile/source/helpers/dalianpay/library/Base.php +++ b/mobile/source/helpers/dalianpay/library/Base.php @@ -17,12 +17,12 @@ class Base { // 读取配置 - $this->config = require_once('../config/config.php'); + $this->config = require_once(BASE_PATH . 'helpers/dalianpay/config/config.php'); // 实例化加解密类 - require_once('Crypt.php'); + require_once(BASE_PATH . 'helpers/dalianpay/library/Crypt.php'); $this->Crypt = new Crypt($this->config); // 实例化请求类 - require_once('Request.php'); + require_once(BASE_PATH . 'helpers/dalianpay/library/Request.php'); $this->Request = new Request($this->config); }