123456789101112131415161718192021222324252627282930313233343536373839 |
- <?php
- namespace app\admin\controller;
- use app\common\controller\Backend;
- use think\Config;
- class Epay extends Backend
- {
- protected $noNeedRight = ['upload'];
-
- public function upload()
- {
- Config::set('default_return_type', 'json');
- $certname = $this->request->post('certname', '');
- $certPathArr = [
- 'cert_client' => '/addons/epay/certs/apiclient_cert.pem',
- 'cert_key' => '/addons/epay/certs/apiclient_key.pem',
- 'app_cert_public_key' => '/addons/epay/certs/appCertPublicKey.crt',
- 'alipay_root_cert' => '/addons/epay/certs/alipayRootCert.crt',
- 'ali_public_key' => '/addons/epay/certs/alipayCertPublicKey.crt',
- ];
- if (!isset($certPathArr[$certname])) {
- $this->error("证书错误");
- }
- $url = $certPathArr[$certname];
- $file = $this->request->file('file');
- if (!$file) {
- $this->error("未上传文件");
- }
- $file->move(dirname(ROOT_PATH . $url), basename(ROOT_PATH . $url), true);
- $this->success(__('上传成功'), '', ['url' => $url]);
- }
- }
|