This commit is contained in:
xl
2023-11-14 00:06:57 +08:00
parent d64ffe4b07
commit c97302ae76
6 changed files with 147 additions and 34 deletions
+109 -6
View File
@@ -11,32 +11,40 @@ class AppConfig
/**
* @var string
*/
protected string $appId = '';
public string $appId = '';
/**
* @var string
*/
protected string $appSecret = '';
public string $appSecret = '';
/**
* @var PayConfig
*/
protected PayConfig $payConfig;
public PayConfig $pay;
private string $proxyHost = '';
private int $proxyPort = 0;
private string $notifyUrl = '';
private string $body = '';
private string $currency = 'CNY';
private string $remoteIp = '';
/**
* @var int
*/
protected int $type;
public int $type;
/**
* @var array|string[]
*/
#[ArrayShape(['token' => 'string', 'secret' => 'string', 'unionId' => 'string'])]
protected array $notice = ['token' => '', 'secret' => '', 'unionId' => ''];
public array $notice = ['token' => '', 'secret' => '', 'unionId' => ''];
/**
@@ -49,7 +57,7 @@ class AppConfig
$model->appId = $app->appId;
$model->appSecret = $app->appSecret;
$model->type = $app->type;
$model->payConfig = PayConfig::parse($app->pay);
$model->pay = PayConfig::parse($app->pay);
return $model;
}
@@ -62,4 +70,99 @@ class AppConfig
return $this->type === 3;
}
/**
* @return string
*/
public function getProxyHost(): string
{
return $this->proxyHost;
}
/**
* @param string $proxyHost
*/
public function setProxyHost(string $proxyHost): void
{
$this->proxyHost = $proxyHost;
}
/**
* @return int
*/
public function getProxyPort(): int
{
return $this->proxyPort;
}
/**
* @param int $proxyPort
*/
public function setProxyPort(int $proxyPort): void
{
$this->proxyPort = $proxyPort;
}
/**
* @return string
*/
public function getNotifyUrl(): string
{
return $this->notifyUrl;
}
/**
* @param string $notifyUrl
*/
public function setNotifyUrl(string $notifyUrl): void
{
$this->notifyUrl = $notifyUrl;
}
/**
* @return string
*/
public function getBody(): string
{
return $this->body;
}
/**
* @param string $body
*/
public function setBody(string $body): void
{
$this->body = $body;
}
/**
* @return string
*/
public function getCurrency(): string
{
return $this->currency;
}
/**
* @param string $currency
*/
public function setCurrency(string $currency): void
{
$this->currency = $currency;
}
/**
* @return string
*/
public function getRemoteIp(): string
{
return $this->remoteIp;
}
/**
* @param string $remoteIp
*/
public function setRemoteIp(string $remoteIp): void
{
$this->remoteIp = $remoteIp;
}
}
+9 -11
View File
@@ -8,8 +8,6 @@
namespace wchat\common;
use wchat\common\Config;
abstract class Multiprogramming implements Progaram
{
@@ -23,9 +21,9 @@ abstract class Multiprogramming implements Progaram
/**
* @var PayConfig
* @var AppConfig
*/
protected PayConfig $payConfig;
protected AppConfig $payConfig;
/**
@@ -72,7 +70,7 @@ abstract class Multiprogramming implements Progaram
/**
* @param \wchat\common\Config $config
* @param Config $config
* @return void
*/
public function setConfig(Config $config): void
@@ -81,26 +79,26 @@ abstract class Multiprogramming implements Progaram
}
/**
* @return PayConfig
* @return AppConfig
*/
public function getPayConfig(): PayConfig
public function getPayConfig(): AppConfig
{
return $this->payConfig;
}
/**
* @param PayConfig $payConfig
* @param AppConfig $payConfig
*/
public function setPayConfig(PayConfig $payConfig): void
public function setPayConfig(AppConfig $payConfig): void
{
$this->payConfig = $payConfig;
}
/**
* @return \wchat\common\Config
* @return Config
*/
public function getConfig(): \wchat\common\Config
public function getConfig(): Config
{
return $this->config;
}
+1 -1
View File
@@ -51,6 +51,6 @@ class Wx
/**
* @var string
*/
public string $serialNumber;
public string $SerialNumber;
}