diff --git a/extend/ImgCaptcha.php b/extend/ImgCaptcha.php new file mode 100644 index 0000000..a8ea520 --- /dev/null +++ b/extend/ImgCaptcha.php @@ -0,0 +1,50 @@ + '2679275057', + 'password' => '7698177hcnTJ', + 'typeid' => $typeid, + 'image' => $image + ]; + $res = self::getHttpResponse($api_url, [], json_encode($info)); + $data = json_decode($res, true); + $captcha = ''; + if ($data['success'] === true) { + $captcha = $data['data']['result']; + } + return $captcha; + } + // 请求外部资源 + 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.9"; + $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; + } +} diff --git a/extend/MpayClass.php b/extend/MpayClass.php new file mode 100644 index 0000000..dce8252 --- /dev/null +++ b/extend/MpayClass.php @@ -0,0 +1,66 @@ +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; + } +} diff --git a/extend/old_payclient.zip b/extend/old_payclient.zip new file mode 100644 index 0000000..e787964 Binary files /dev/null and b/extend/old_payclient.zip differ diff --git a/extend/payclient.zip b/extend/payclient.zip new file mode 100644 index 0000000..ffa02b1 Binary files /dev/null and b/extend/payclient.zip differ