Files

43 lines
1.0 KiB
PHP
Raw Permalink Normal View History

2019-11-11 18:14:47 +08:00
<?php
2020-03-05 12:41:49 +08:00
namespace wchat\qq;
2019-11-11 18:14:47 +08:00
2023-11-14 01:08:06 +08:00
use Kiri\Client;
2022-09-09 16:42:55 +08:00
use wchat\common\Multiprogramming;
2019-11-11 18:14:47 +08:00
2022-09-09 16:42:55 +08:00
class SmallProgram extends Multiprogramming
2019-11-11 18:14:47 +08:00
{
2023-11-14 01:08:06 +08:00
/**
* @var string
*/
protected string $host = 'api.q.qq.com';
/**
* @param string $url
* @param mixed $data
* @return Client
*/
protected function createClient(string $url, mixed $data): Client
{
$client = new Client('api.qpay.qq.com', 443, true);
$client->withHeader(['Content-Type' => 'application/json']);
$client->withSslCertFile($this->payConfig->pay->qq->mchCert);
$client->withSslKeyFile($this->payConfig->pay->qq->mchKey);
$client->withCa($this->payConfig->pay->qq->mchCa);
$proxyHost = $this->payConfig->getProxyHost();
$proxyPort = $this->payConfig->getProxyPort();
if (!empty($proxyHost) && $proxyPort > 0) {
$client->withProxyHost($proxyHost)->withProxyPort($proxyPort);
}
$client->post($url, $data);
$client->close();
return $client;
}
2019-11-11 18:14:47 +08:00
}