From bbd29dcebb4676733b3a3e9880af93f32efd6f6c Mon Sep 17 00:00:00 2001 From: chenzhi Date: Fri, 31 Jul 2020 14:44:54 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E6=89=93=E6=AC=BE=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Payment/Conf/config.php | 3 ++- Application/Payment/Conf/payconf.php | 8 ++++++ .../ExcelPaymentController.class.php | 4 +-- .../Controller/PaymentController.class.php | 3 ++- ThinkPHP/Library/Vendor/Alipay2020/Fund.php | 27 +++++++++++++------ 5 files changed, 33 insertions(+), 12 deletions(-) create mode 100644 Application/Payment/Conf/payconf.php diff --git a/Application/Payment/Conf/config.php b/Application/Payment/Conf/config.php index 91e30a531..92fc0cf37 100644 --- a/Application/Payment/Conf/config.php +++ b/Application/Payment/Conf/config.php @@ -112,5 +112,6 @@ return array( 'TMPL_EXCEPTION_FILE' => MODULE_PATH.'View/Public/exception.html',// 异常页面的模板文件 /*默认公司名称*/ 'DEFAULT_COMPANY'=>"海南万盟天下科技有限公司", - 'WEB_SITE_TITLE'=>"财务打款系统" + 'WEB_SITE_TITLE'=>"财务打款系统", + 'LOAD_EXT_CONFIG'=>"payconf" ); \ No newline at end of file diff --git a/Application/Payment/Conf/payconf.php b/Application/Payment/Conf/payconf.php new file mode 100644 index 000000000..579810ac0 --- /dev/null +++ b/Application/Payment/Conf/payconf.php @@ -0,0 +1,8 @@ +[ + "appId"=>"2021001150621489", + "alipayUserId"=>"2088731986604211", + "rsaPrivateKey"=>'MIIEogIBAAKCAQEAokaztliXge4pDoNWVVdYNSq6N+Be7xNU2LBKANhhdPfSny1VdCBgn7bbuSXA38ubkVZ8xZ/oFcPHa0LMZ5Ki9hRntU+Ry7vJN5kKwqP1CX8rCVWj2Jx2IuTUNdFA1TzCSLV1UMNvIIkFTFnkJUR++YWoQ2EBDYuQsccSbveZ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fnOFogkBZXh3rDDIvFkh6cccVj9rKtyRSW8EHyx9cZsqUoZTH9EcT1zRXITfGeR7y6/31V60eDk1m1auQOF4VDqvI4fBTY9QeUx8wvh9kzxN640lzmkXZRppHZSWRmduOAgmj58NJqBRAoGAY0qXaL0nDAehVpoxVUDmFdPuallq9oEz5z5Q29A0IXm/dHkbbHEtEdE/MU9WPn3yOIwwGkF21q3cormt4oyi2ro4OlFSKmpQzMtg/I5Tj5XbOz13FYA60IhjYwqZ2pW/l8oEg6ZAIo2vNSjqJudQS/16Q8xu8Gxzl9E9e3LZBeE=' + ] + ); \ No newline at end of file diff --git a/Application/Payment/Controller/ExcelPaymentController.class.php b/Application/Payment/Controller/ExcelPaymentController.class.php index db61dc235..e94ce3af8 100644 --- a/Application/Payment/Controller/ExcelPaymentController.class.php +++ b/Application/Payment/Controller/ExcelPaymentController.class.php @@ -307,7 +307,7 @@ class ExcelPaymentController extends BaseController } public function getAccountMoney(){ Vendor("Alipay2020/Fund"); - $fund = new \Fund(); + $fund = new \Fund(C("ALI_PAYMENT")); $money = $fund->account(); if($money !== -1){ $money = $money['amount']; @@ -333,7 +333,7 @@ class ExcelPaymentController extends BaseController $remark = $_REQUEST['remark']; Vendor("Alipay2020/Fund"); - $fund = new \Fund(); + $fund = new \Fund(C("ALI_PAYMENT")); $dbres = M("ExcelStatementInfo","tab_")->where("id='{$id}'")->find(); $company_info = json_decode($dbres['company_info'],true); diff --git a/Application/Payment/Controller/PaymentController.class.php b/Application/Payment/Controller/PaymentController.class.php index 26b8e8ad6..f20aa1928 100644 --- a/Application/Payment/Controller/PaymentController.class.php +++ b/Application/Payment/Controller/PaymentController.class.php @@ -406,7 +406,7 @@ class PaymentController extends BaseController } public function getAccountMoney(){ Vendor("Alipay2020/Fund"); - $fund = new \Fund(); + $fund = new \Fund(C("ALI_PAYMENT")); $money = $fund->account(); if($money !== -1){ $money = $money['amount']; @@ -433,6 +433,7 @@ class PaymentController extends BaseController Vendor("Alipay2020/Fund"); $fund = new \Fund(); + $fund->setInitConf(C("ALI_PAYMENT")); $dbres = M("company_statement_info","tab_")->where("id='{$id}'")->find(); $company_info = json_decode($dbres['company_info'],true); diff --git a/ThinkPHP/Library/Vendor/Alipay2020/Fund.php b/ThinkPHP/Library/Vendor/Alipay2020/Fund.php index ea76337a1..c19d00dbc 100644 --- a/ThinkPHP/Library/Vendor/Alipay2020/Fund.php +++ b/ThinkPHP/Library/Vendor/Alipay2020/Fund.php @@ -6,14 +6,25 @@ require_once "aop/request/AlipayFundTransOrderQueryRequest.php"; require_once "aop/request/AlipayFundAccountQueryRequest.php"; class Fund { - private $appCertPath = __DIR__ . "/cert/appCertPublicKey_2021001150621489.crt"; - private $alipayCertPath = __DIR__ . "/cert/alipayCertPublicKey_RSA2.crt"; - private $rootCertPath = __DIR__ . "/cert/alipayRootCert.crt"; - private $gatewayUrl = "https://openapi.alipay.com/gateway.do"; - private $appId = "2021001150621489"; - private $alipayUserId = '2088731986604211'; // pid - private $rsaPrivateKey = 'MIIEogIBAAKCAQEAokaztliXge4pDoNWVVdYNSq6N+Be7xNU2LBKANhhdPfSny1VdCBgn7bbuSXA38ubkVZ8xZ/oFcPHa0LMZ5Ki9hRntU+Ry7vJN5kKwqP1CX8rCVWj2Jx2IuTUNdFA1TzCSLV1UMNvIIkFTFnkJUR++YWoQ2EBDYuQsccSbveZ4U5bHf4xopNhQ42a3lwVyuJaBC3q/m4pLVkBIxupP7HSgc3M/ZP0EBHRoq65wHrRsW70A3JPYCmKaw+9W0qeM2fmSXjhU0U7TS1QyyWLwaYgkFZySFscGYVgG6L1dzdVkSbQxlcp/3kEBQXnwTgdODBCdoNrDBZyIteMOlzfZ2MK/QIDAQABAoIBACkqSFJ8fMqgENg2pwL1KlIqaZzdFRgOzlo9tjgqq+ZRK6PniyLvR7OcXnbERf4/l1IyH2q+mtBSntbt1g58G0zTdk9/RNvq4itxblJb50Ame1Nd3zeG0U0ewVp5n7m4NQzew0jemuUk/SwWLZLqok9IAZw+EldOT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Key_2021001150621489.crt"; + public $alipayCertPath = __DIR__ . "/cert/alipayCertPublicKey_RSA2.crt"; + public $rootCertPath = __DIR__ . "/cert/alipayRootCert.crt"; + public $gatewayUrl = "https://openapi.alipay.com/gateway.do"; + public $appId = ""; + public $alipayUserId = ''; // pid + public $rsaPrivateKey = ''; + public $is_init = false; + public function __construct($config) + { + if(empty($config)){ + return false; + } + $this->appId = $config['appId']; + $this->alipayUserId = $config['alipayUserId']; + $this->rsaPrivateKey = $config['rsaPrivateKey']; + $this->is_init = true; + } + public function transfer($aliAccount, $realName, $orderId, $amount, $title='') { $aop = new AopCertClient ();