This commit is contained in:
xl
2023-11-14 01:12:03 +08:00
parent a6a2a0f472
commit 77aa01185b
5 changed files with 11 additions and 805 deletions
+3 -53
View File
@@ -12,10 +12,6 @@ use Kiri\Client;
abstract class Multiprogramming implements Progaram
{
/** @var Config */
protected Config $config;
protected static ?Multiprogramming $instance = null;
protected int $errorCode = 0;
@@ -73,16 +69,6 @@ abstract class Multiprogramming implements Progaram
return $this->errorMsg;
}
/**
* @param Config $config
* @return void
*/
public function setConfig(Config $config): void
{
$this->config = $config;
}
/**
* @return AppConfig
*/
@@ -100,42 +86,6 @@ abstract class Multiprogramming implements Progaram
}
/**
* @return Config
*/
public function getConfig(): Config
{
return $this->config;
}
/**
* @param $result
* @return array|bool
* @throws \Exception
*/
protected function checkSign($result): array|bool
{
$data = Help::toArray($result);
if (!isset($data['sign'])) {
return $data;
}
$sign = $data['sign'];
unset($data['sign']);
$key = $this->config->getKey();
$sign_type = $this->config->getSignType();
$_sign = Help::sign($data, $key, $sign_type);
if ($sign != $_sign) {
return FALSE;
}
return $data;
}
/**
* @param string $requestUrl
* @param mixed $body
@@ -179,9 +129,9 @@ abstract class Multiprogramming implements Progaram
*/
private function request(string $method, string $requestUrl, $body, string $contentType = 'application/application'): Result
{
$client = new Client($this->host, 443, true);
$proxyHost = $this->getConfig()->getProxyHost();
$proxyPort = $this->getConfig()->getProxyPort();
$client = new Client($this->host, 443, true);
$proxyHost = $this->payConfig->getProxyHost();
$proxyPort = $this->payConfig->getProxyPort();
if (!empty($proxyHost) && $proxyPort > 0) {
$client->withProxyHost($proxyHost)->withProxyPort($proxyPort);
}