This commit is contained in:
xl
2023-11-14 00:15:27 +08:00
parent fbdbcbccd9
commit e721fe4f36
53 changed files with 1 additions and 1 deletions
+168
View File
@@ -0,0 +1,168 @@
<?php
namespace wchat\common;
use JetBrains\PhpStorm\ArrayShape;
class AppConfig
{
/**
* @var string
*/
public string $appId = '';
/**
* @var string
*/
public string $appSecret = '';
/**
* @var 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
*/
public int $type;
/**
* @var array|string[]
*/
#[ArrayShape(['token' => 'string', 'secret' => 'string', 'unionId' => 'string'])]
public array $notice = ['token' => '', 'secret' => '', 'unionId' => ''];
/**
* @param object $app
* @return static
*/
public static function instance(object $app): static
{
$model = new static();
$model->appId = $app->appId;
$model->appSecret = $app->appSecret;
$model->type = $app->type;
$model->pay = PayConfig::parse($app->pay);
return $model;
}
/**
* @return bool
*/
public function typeIsApp(): bool
{
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;
}
}