eee
This commit is contained in:
+22
-20
@@ -18,9 +18,6 @@ abstract class Multiprogramming implements Progaram
|
||||
protected string $errorMsg = '';
|
||||
|
||||
|
||||
protected string $host = 'api.weixin.qq.com';
|
||||
|
||||
|
||||
/**
|
||||
* @var AppConfig
|
||||
*/
|
||||
@@ -87,49 +84,54 @@ abstract class Multiprogramming implements Progaram
|
||||
|
||||
|
||||
/**
|
||||
* @param string $host
|
||||
* @param string $requestUrl
|
||||
* @param mixed $body
|
||||
* @param string $contentType
|
||||
* @return Result
|
||||
*/
|
||||
protected function post(string $requestUrl, mixed $body, string $contentType = 'application/application'): Result
|
||||
protected function post(string $host, string $requestUrl, mixed $body, string $contentType = 'application/application'): Result
|
||||
{
|
||||
return $this->request('post', $requestUrl, $body, $contentType);
|
||||
return $this->request($host, 'post', $requestUrl, $body, $contentType);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $host
|
||||
* @param string $requestUrl
|
||||
* @param mixed $body
|
||||
* @param string $contentType
|
||||
* @return Result
|
||||
*/
|
||||
protected function get(string $host, string $requestUrl, mixed $body, string $contentType = 'application/application'): Result
|
||||
{
|
||||
return $this->request($host, 'get', $requestUrl, $body, $contentType);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $host
|
||||
* @param string $requestUrl
|
||||
* @param mixed $body
|
||||
* @return Result
|
||||
*/
|
||||
protected function get(string $requestUrl, mixed $body, string $contentType = 'application/application'): Result
|
||||
protected function upload(string $host, string $requestUrl, mixed $body): Result
|
||||
{
|
||||
return $this->request('get', $requestUrl, $body, $contentType);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $requestUrl
|
||||
* @param mixed $body
|
||||
* @return Result
|
||||
*/
|
||||
protected function upload(string $requestUrl, mixed $body): Result
|
||||
{
|
||||
return $this->request('upload', $requestUrl, $body);
|
||||
return $this->request($host, 'upload', $requestUrl, $body);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $host
|
||||
* @param string $method
|
||||
* @param string $requestUrl
|
||||
* @param $body
|
||||
* @param string $contentType
|
||||
* @return Result
|
||||
*/
|
||||
private function request(string $method, string $requestUrl, $body, string $contentType = 'application/application'): Result
|
||||
private function request(string $host, string $method, string $requestUrl, $body, string $contentType = 'application/application'): Result
|
||||
{
|
||||
$client = new Client($this->host, 443, true);
|
||||
$client = new Client($host, 80, true);
|
||||
$proxyHost = $this->payConfig->getProxyHost();
|
||||
$proxyPort = $this->payConfig->getProxyPort();
|
||||
if (!empty($proxyHost) && $proxyPort > 0) {
|
||||
|
||||
Reference in New Issue
Block a user