From f4c0daea8c13d3da460e950e27943dfed4f4200c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=8A=80=E6=9C=AF=E8=80=81=E8=83=A1?= <1094551889@qq.com> Date: Mon, 25 Nov 2024 07:56:24 +0000 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20extend/M?= =?UTF-8?q?payClass.php?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- extend/MpayClass.php | 66 -------------------------------------------- 1 file changed, 66 deletions(-) delete mode 100644 extend/MpayClass.php diff --git a/extend/MpayClass.php b/extend/MpayClass.php deleted file mode 100644 index dce8252..0000000 --- a/extend/MpayClass.php +++ /dev/null @@ -1,66 +0,0 @@ -pid = $config['pid']; - $this->key = $config['key']; - $this->host = $config['host']; - $this->check_neworder_url = $this->host . '/order.php'; - $this->submit_records_url = $this->host . '/payHeart'; - } - // 查询新订单 - public function orderHeart() - { - $url = $this->check_neworder_url . "?pid={$this->pid}&sign={$this->getSign()}"; - $res = $this->getHttpResponse($url); - return $res; - } - // 提交收款明细 - public function upRecords($records, $aid) - { - $header = ['Content-Type: application/json;charset=UTF-8']; - $url = $this->submit_records_url . "?pid={$this->pid}&aid={$aid}&sign={$this->getSign()}"; - $res = $this->getHttpResponse($url, $header, json_encode($records)); - return $res; - } - - // 签名方法 - private function getSign() - { - return md5($this->pid . $this->key); - } - // 请求外部资源 - private function getHttpResponse($url, $header = [], $post = null, $timeout = 10) - { - $ch = curl_init($url); - curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); - curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); - if ($header) { - curl_setopt($ch, CURLOPT_HTTPHEADER, $header); - } else { - $httpheader[] = "Accept: */*"; - $httpheader[] = "Accept-Language: zh-CN,zh;q=0.8"; - $httpheader[] = "Connection: close"; - curl_setopt($ch, CURLOPT_HTTPHEADER, $httpheader); - } - curl_setopt($ch, CURLOPT_HEADER, false); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); - if ($post) { - curl_setopt($ch, CURLOPT_POST, true); - curl_setopt($ch, CURLOPT_POSTFIELDS, $post); - } - $response = curl_exec($ch); - curl_close($ch); - return $response; - } -}