From 744bfce1e5c0647d4f5e7b613df0b7a4bead9e94 Mon Sep 17 00:00:00 2001 From: elf <360197197@qq.com> Date: Thu, 4 May 2023 23:50:24 +0800 Subject: [PATCH] test --- .gitignore | 1 + ThinkPHP/Library/Org/QzlPay/Api.class.php | 20 ++++++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 968f40c53..428af3ca4 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ Uploads/ /Application/Admin/Controller/access_data_launch.txt .htaccess nginx.htaccess +*/**/.DS_Store diff --git a/ThinkPHP/Library/Org/QzlPay/Api.class.php b/ThinkPHP/Library/Org/QzlPay/Api.class.php index 0a4e42107..224d3d72b 100644 --- a/ThinkPHP/Library/Org/QzlPay/Api.class.php +++ b/ThinkPHP/Library/Org/QzlPay/Api.class.php @@ -7,8 +7,6 @@ use Org\QzlPay\Request\WxH5PayRequest; class Api { - use ApiCommonTrait; - public const CHANNEL_WX_H5 = 'wx_h5'; public const CHANNEL_ALI_H5 = 'ali_h5'; @@ -34,4 +32,22 @@ class Api ]; return self::request('cs.order.query', $params); } + + protected static function getCommonParams($apiName) { + return [ + 'tradeType' => $apiName, + 'version' => '2.0', + 'mchNo' => Config::get('mchNo'), + ]; + } + + protected static function request($apiName, $params) { + $params = array_merge(self::getCommonParams($apiName), $params); + $params[Signer::SIGN_NAME] = Signer::sign($params, Config::get('paySecret')); + return Client::request(self::getUrl(), $params); + } + + protected static function getUrl() { + return Config::get('baseUrl') . '/gateway/api/trade'; + } } \ No newline at end of file