diff --git a/extend/MpayClass.php b/extend/MpayClass.php deleted file mode 100644 index 0554e07..0000000 --- a/extend/MpayClass.php +++ /dev/null @@ -1,64 +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 . "/{$this->pid}/{$aid}/{$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/payclient/ShouQianBa.php b/extend/payclient/ShouQianBa.php deleted file mode 100644 index fe77448..0000000 --- a/extend/payclient/ShouQianBa.php +++ /dev/null @@ -1,165 +0,0 @@ -username = $config['username']; - $this->password = $config['password']; - // 检查token目录 - $dir_path = runtime_path() . 'token/sqbpay'; - if (!is_dir($dir_path)) { - if (!mkdir($dir_path, 755, true)) { - echo '目录创建失败'; - } - } - $this->token_path = $dir_path . '/' . md5($this->username . $this->password . 'sqbpay') . '.json'; - if (!file_exists($this->token_path)) { - // 失效Token刷新 - $token_info = ['token' => 'Y2FjZmRiMi04MjRjLTQ2NDgtYTU0Ny1lNzg2MDllMTQ1ZTI6MTcxOTQ1Mzg0MzU3OTozNjAwMDAw.txcnX60Za8', 'expire_time' => 1719453843579]; - file_put_contents($this->token_path, json_encode($token_info)); - } - } - // 登陆账号 - private function login(): array - { - $user_info = [ - "username" => $this->username, - "password" => md5($this->password), - "uc_device" => [ - "device_type" => 2, - "default_device" => 0, - "platform" => "商户服务平台", - "device_fingerprint" => "12340d18-e414-49cf-815a-66ab8ec1a480", - "device_name" => "收钱吧商户平台", - "device_model" => "Windows", - "device_brand" => "Chrome" - ] - ]; - $header = [ - 'Content-Type:application/json;charset=UTF-8', - 'Host:web-platforms-msp.shouqianba.com', - 'Origin:https://s.shouqianba.com', - 'Referer:https://s.shouqianba.com/login', - ]; - $url = $this->host . $this->login; - $res = $this->getHttpResponse($url, $header, json_encode($user_info)); - $arr_res = json_decode($res, true); - $mchUserTokenInfo = $arr_res['data']['mchUserTokenInfo']; - $token_info = []; - $token_info['token'] = $mchUserTokenInfo['token']; - $token_info['expire_time'] = $mchUserTokenInfo['expire_time']; - // 保存登陆token - file_put_contents($this->token_path, json_encode($token_info)); - // 返回新token - return $token_info; - } - // 获取token - private function getToken(): string - { - $token_info_find = json_decode(file_get_contents($this->token_path), true); - // 有效期判断 - $expire_time = intval($token_info_find['expire_time'] / 1000); - $token = ''; - if ($expire_time - time() < 600) { - // 刷新token - $url = $this->host . $this->refresh_token . '?token=' . $token_info_find['token']; - $header = ["Authorization:Bearer {$token_info_find['token']}"]; - $res = $this->getHttpResponse($url, $header, true); - $arr_res = json_decode($res, true); - if ($arr_res['data']['status'] === 0) { - // 登陆更新token - $token = ($this->login())['token']; - } else { - $token = $arr_res['data']['token']; - $token_info = []; - $token_info['token'] = $token; - $token_info['expire_time'] = $arr_res['data']['expire_time']; - // 保存Token - file_put_contents($this->token_path, json_encode($token_info)); - } - } else { - $token = $token_info_find['token']; - } - return $token; - } - // 接口客户端 - public function payQuery(array $query): array - { - $token = $this->getToken(); - $url = $this->host . $this->find_transactions . '?client_version=7.0.0&token=' . $token; - $header = ['Content-Type: application/json;charset=UTF-8']; - // 构建订单查询 - $now = time(); - $begin_time = ($now - 175) * 1000; - $end_time = $now * 1000; - $query['date_start'] = $begin_time; - $query['date_end'] = $end_time; - // 查询订单列表 - $res_order = $this->getHttpResponse($url, $header, json_encode($query)); - $arr_res = json_decode($res_order, true); - $list = []; - if ($arr_res['code'] === 50000) { - $list = $arr_res['data']['records']; - } - // 重构订单流水,返回数组 - $moneyList = []; - if ($list) { - $order_no = []; - $payway = []; - $price = []; - $channel = []; - $payways = [2 => 'alipay', 3 => 'wxpay']; - foreach ($list as $value) { - // 平台订单流水号 - $order_no[] = $value['order_sn']; - // 支付类型 - $payway[] = $payways[$value['payway']]; - // 收款金额 - $price[] = $value['original_amount'] / 100; - // 收款渠道(二维码编号) - $channel[] = $value['terminal_device_fingerprint']; - } - $moneyList['order_no'] = $order_no; - $moneyList['payway'] = $payway; - $moneyList['price'] = $price; - $moneyList['channel'] = $channel; - } - return $moneyList; - } - // 请求外部资源 - 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/payclient/payclient.zip b/extend/payclient/payclient.zip deleted file mode 100644 index fc2e00b..0000000 Binary files a/extend/payclient/payclient.zip and /dev/null differ