add clear
This commit is contained in:
+295
-271
@@ -12,7 +12,7 @@ class Config
|
||||
*
|
||||
* 小程序ID
|
||||
*/
|
||||
private $appid = '';
|
||||
private string $appid = '';
|
||||
|
||||
|
||||
/**
|
||||
@@ -20,357 +20,470 @@ class Config
|
||||
*
|
||||
* 商户号ID
|
||||
*/
|
||||
private $mch_id = '';
|
||||
private string $mch_id = '';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* 设备号
|
||||
*/
|
||||
private $device_info = 'WEB';
|
||||
private string $device_info = 'WEB';
|
||||
|
||||
private string $token;
|
||||
private string $encodingAesKey;
|
||||
|
||||
private string $schema = 'WECHATPAY2-SHA256-RSA2048';
|
||||
|
||||
private string $serial_no = '33F00000E4248E2EB3C61FC8384E1E155ECBB1B2';
|
||||
|
||||
private $token;
|
||||
private $encodingAesKey;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* 随机字符串
|
||||
*/
|
||||
private $nonce_str = '';
|
||||
private string $nonce_str = '';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* 商品简单描述
|
||||
*/
|
||||
private $body = '好友默契Pk充值!';
|
||||
private string $body = '好友默契Pk充值!';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* 商户订单号
|
||||
*/
|
||||
private $out_trade_no = "";
|
||||
private string $out_trade_no = "";
|
||||
|
||||
/**
|
||||
* @var int
|
||||
* @var int|float
|
||||
*
|
||||
* 金额
|
||||
*/
|
||||
private $total_fee = 0;
|
||||
private float|int $total_fee = 0;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* 终端IP
|
||||
*/
|
||||
private $spbill_create_ip = "";
|
||||
private string $spbill_create_ip = "";
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* 异步回调地址
|
||||
*/
|
||||
private $notify_url = "";
|
||||
private string $notify_url = "";
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* 交易类型
|
||||
*/
|
||||
private $trade_type = 'JSAPI';
|
||||
private string $trade_type = 'JSAPI';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* 签名方式
|
||||
*/
|
||||
private $sign_type = 'MD5';
|
||||
private string $sign_type = 'MD5';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* 商户接口地址
|
||||
*/
|
||||
private $mch_host = 'https://api.mch.weixin.qq.com';
|
||||
private string $mch_host = 'https://api.mch.weixin.qq.com';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $appsecret = '';
|
||||
private string $appsecret = '';
|
||||
|
||||
private $remote_addr = '127.0.0.1';
|
||||
private string $remote_addr = '127.0.0.1';
|
||||
|
||||
private $ssl_cert = '';
|
||||
private $ssl_key = '';
|
||||
private $ssl_ca = '';
|
||||
private $port = '';
|
||||
private string $ssl_cert = '';
|
||||
private string $ssl_key = '';
|
||||
private string $ssl_ca = '';
|
||||
private int $port = 443;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $key = '';
|
||||
private $access_token = '';
|
||||
private $agent = '';
|
||||
private $usrSwoole = false;
|
||||
private string $key = '';
|
||||
private string $access_token = '';
|
||||
private string $agent = '';
|
||||
private bool $usrSwoole = false;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getSslCa()
|
||||
public function getSchema(): string
|
||||
{
|
||||
return $this->ssl_ca;
|
||||
return $this->schema;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $ssl_ca
|
||||
* @return Config
|
||||
* @param string $schema
|
||||
*/
|
||||
public function setSslCa($ssl_ca): Config
|
||||
public function setSchema(string $schema): void
|
||||
{
|
||||
$this->ssl_ca = $ssl_ca;
|
||||
return $this;
|
||||
$this->schema = $schema;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getPort()
|
||||
public function getSerialNo(): string
|
||||
{
|
||||
return $this->port;
|
||||
return $this->serial_no;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $port
|
||||
* @return Config
|
||||
* @param string $serial_no
|
||||
*/
|
||||
public function setPort($port): Config
|
||||
public function setSerialNo(string $serial_no): void
|
||||
{
|
||||
$this->port = $port;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isUsrSwoole()
|
||||
{
|
||||
return $this->usrSwoole;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $usrSwoole
|
||||
* @return Config
|
||||
*/
|
||||
public function setUsrSwoole(bool $usrSwoole): Config
|
||||
{
|
||||
$this->usrSwoole = $usrSwoole;
|
||||
return $this;
|
||||
$this->serial_no = $serial_no;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getAgent()
|
||||
public function getAppid(): string
|
||||
{
|
||||
return $this->agent;
|
||||
return $this->appid;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $agent
|
||||
* @return Config
|
||||
* @param string $appid
|
||||
*/
|
||||
public function setAgent($agent): Config
|
||||
{
|
||||
$this->agent = $agent;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getToken()
|
||||
{
|
||||
return $this->token;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $token
|
||||
* @return Config
|
||||
*/
|
||||
public function setToken($token)
|
||||
{
|
||||
$this->token = $token;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getEncodingAesKey()
|
||||
{
|
||||
return $this->encodingAesKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $encodingAesKey
|
||||
* @return Config
|
||||
*/
|
||||
public function setEncodingAesKey($encodingAesKey)
|
||||
{
|
||||
$this->encodingAesKey = $encodingAesKey;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getAccessToken()
|
||||
{
|
||||
return $this->access_token;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $access_token
|
||||
*/
|
||||
public function setAccessToken($access_token)
|
||||
{
|
||||
$this->access_token = $access_token;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $remote_addr
|
||||
*/
|
||||
public function setRemoteAddr($remote_addr)
|
||||
{
|
||||
$this->remote_addr = $remote_addr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $appid
|
||||
*/
|
||||
public function setAppid($appid)
|
||||
public function setAppid(string $appid): void
|
||||
{
|
||||
$this->appid = $appid;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $mch_id
|
||||
* @return string
|
||||
*/
|
||||
public function setMchId($mch_id)
|
||||
public function getMchId(): string
|
||||
{
|
||||
return $this->mch_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $mch_id
|
||||
*/
|
||||
public function setMchId(string $mch_id): void
|
||||
{
|
||||
$this->mch_id = $mch_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $device_info
|
||||
* @return string
|
||||
*/
|
||||
public function setDeviceInfo($device_info)
|
||||
public function getDeviceInfo(): string
|
||||
{
|
||||
return $this->device_info;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $device_info
|
||||
*/
|
||||
public function setDeviceInfo(string $device_info): void
|
||||
{
|
||||
$this->device_info = $device_info;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $nonce_str
|
||||
* @return string
|
||||
*/
|
||||
public function setNonceStr($nonce_str)
|
||||
public function getToken(): string
|
||||
{
|
||||
return $this->token;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $token
|
||||
*/
|
||||
public function setToken(string $token): void
|
||||
{
|
||||
$this->token = $token;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getEncodingAesKey(): string
|
||||
{
|
||||
return $this->encodingAesKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $encodingAesKey
|
||||
*/
|
||||
public function setEncodingAesKey(string $encodingAesKey): void
|
||||
{
|
||||
$this->encodingAesKey = $encodingAesKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getNonceStr(): string
|
||||
{
|
||||
return $this->nonce_str;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $nonce_str
|
||||
*/
|
||||
public function setNonceStr(string $nonce_str): void
|
||||
{
|
||||
$this->nonce_str = $nonce_str;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $body
|
||||
* @return string
|
||||
*/
|
||||
public function setBody($body)
|
||||
public function getBody(): string
|
||||
{
|
||||
return $this->body;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $body
|
||||
*/
|
||||
public function setBody(string $body): void
|
||||
{
|
||||
$this->body = $body;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $out_trade_no
|
||||
* @return string
|
||||
*/
|
||||
public function setOutTradeNo($out_trade_no)
|
||||
public function getOutTradeNo(): string
|
||||
{
|
||||
return $this->out_trade_no;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $out_trade_no
|
||||
*/
|
||||
public function setOutTradeNo(string $out_trade_no): void
|
||||
{
|
||||
$this->out_trade_no = $out_trade_no;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getTotalFee(): int|string
|
||||
{
|
||||
return $this->total_fee;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $total_fee
|
||||
*/
|
||||
public function setTotalFee(int $total_fee)
|
||||
public function setTotalFee(int|string $total_fee): void
|
||||
{
|
||||
$this->total_fee = $total_fee;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $spbill_create_ip
|
||||
* @return string
|
||||
*/
|
||||
public function setSpbillCreateIp($spbill_create_ip)
|
||||
public function getSpbillCreateIp(): string
|
||||
{
|
||||
return $this->spbill_create_ip;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $spbill_create_ip
|
||||
*/
|
||||
public function setSpbillCreateIp(string $spbill_create_ip): void
|
||||
{
|
||||
$this->spbill_create_ip = $spbill_create_ip;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $notify_url
|
||||
* @return string
|
||||
*/
|
||||
public function setNotifyUrl($notify_url)
|
||||
public function getNotifyUrl(): string
|
||||
{
|
||||
return $this->notify_url;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $notify_url
|
||||
*/
|
||||
public function setNotifyUrl(string $notify_url): void
|
||||
{
|
||||
$this->notify_url = $notify_url;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $trade_type
|
||||
* @return string
|
||||
*/
|
||||
public function setTradeType($trade_type)
|
||||
public function getTradeType(): string
|
||||
{
|
||||
return $this->trade_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $trade_type
|
||||
*/
|
||||
public function setTradeType(string $trade_type): void
|
||||
{
|
||||
$this->trade_type = $trade_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $sign_type
|
||||
* @return string
|
||||
*/
|
||||
public function setSignType($sign_type)
|
||||
public function getSignType(): string
|
||||
{
|
||||
return $this->sign_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sign_type
|
||||
*/
|
||||
public function setSignType(string $sign_type): void
|
||||
{
|
||||
$this->sign_type = $sign_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $mch_host
|
||||
* @return string
|
||||
*/
|
||||
public function setMchHost($mch_host)
|
||||
public function getMchHost(): string
|
||||
{
|
||||
return $this->mch_host;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $mch_host
|
||||
*/
|
||||
public function setMchHost(string $mch_host): void
|
||||
{
|
||||
$this->mch_host = $mch_host;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $appsecret
|
||||
* @return string
|
||||
*/
|
||||
public function setAppsecret($appsecret)
|
||||
public function getAppsecret(): string
|
||||
{
|
||||
return $this->appsecret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $appsecret
|
||||
*/
|
||||
public function setAppsecret(string $appsecret): void
|
||||
{
|
||||
$this->appsecret = $appsecret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $ssl_cert
|
||||
* @return string
|
||||
*/
|
||||
public function setSslCert($ssl_cert)
|
||||
public function getRemoteAddr(): string
|
||||
{
|
||||
return $this->remote_addr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $remote_addr
|
||||
*/
|
||||
public function setRemoteAddr(string $remote_addr): void
|
||||
{
|
||||
$this->remote_addr = $remote_addr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getSslCert(): string
|
||||
{
|
||||
return $this->ssl_cert;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $ssl_cert
|
||||
*/
|
||||
public function setSslCert(string $ssl_cert): void
|
||||
{
|
||||
$this->ssl_cert = $ssl_cert;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $ssl_key
|
||||
* @return string
|
||||
*/
|
||||
public function setSslKey($ssl_key)
|
||||
public function getSslKey(): string
|
||||
{
|
||||
return $this->ssl_key;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $ssl_key
|
||||
*/
|
||||
public function setSslKey(string $ssl_key): void
|
||||
{
|
||||
$this->ssl_key = $ssl_key;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $key
|
||||
* @return string
|
||||
*/
|
||||
public function setKey($key)
|
||||
public function getSslCa(): string
|
||||
{
|
||||
return $this->ssl_ca;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $ssl_ca
|
||||
*/
|
||||
public function setSslCa(string $ssl_ca): void
|
||||
{
|
||||
$this->ssl_ca = $ssl_ca;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getPort(): string
|
||||
{
|
||||
return $this->port;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $port
|
||||
*/
|
||||
public function setPort(string $port): void
|
||||
{
|
||||
$this->port = $port;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getKey(): string
|
||||
{
|
||||
return $this->key;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $key
|
||||
*/
|
||||
public function setKey(string $key): void
|
||||
{
|
||||
$this->key = $key;
|
||||
}
|
||||
@@ -378,145 +491,56 @@ class Config
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getAppid()
|
||||
public function getAccessToken(): string
|
||||
{
|
||||
return $this->appid;
|
||||
return $this->access_token;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $access_token
|
||||
*/
|
||||
public function setAccessToken(string $access_token): void
|
||||
{
|
||||
$this->access_token = $access_token;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getMchId()
|
||||
public function getAgent(): string
|
||||
{
|
||||
return $this->mch_id;
|
||||
return $this->agent;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @param string $agent
|
||||
*/
|
||||
public function getDeviceInfo()
|
||||
public function setAgent(string $agent): void
|
||||
{
|
||||
return $this->device_info;
|
||||
$this->agent = $agent;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @return bool
|
||||
*/
|
||||
public function getNonceStr()
|
||||
public function isUsrSwoole(): bool
|
||||
{
|
||||
return $this->nonce_str;
|
||||
return $this->usrSwoole;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @param bool $usrSwoole
|
||||
*/
|
||||
public function getBody()
|
||||
public function setUsrSwoole(bool $usrSwoole): void
|
||||
{
|
||||
return $this->body;
|
||||
$this->usrSwoole = $usrSwoole;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getOutTradeNo()
|
||||
{
|
||||
return $this->out_trade_no;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getTotalFee()
|
||||
{
|
||||
return $this->total_fee;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getSpbillCreateIp()
|
||||
{
|
||||
return $this->spbill_create_ip;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getNotifyUrl()
|
||||
{
|
||||
return $this->notify_url;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getTradeType()
|
||||
{
|
||||
return $this->trade_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getSignType()
|
||||
{
|
||||
return $this->sign_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getMchHost()
|
||||
{
|
||||
return $this->mch_host;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getAppsecret()
|
||||
{
|
||||
return $this->appsecret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getRemoteAddr()
|
||||
{
|
||||
return $this->remote_addr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getSslCert()
|
||||
{
|
||||
return $this->ssl_cert;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getSslKey()
|
||||
{
|
||||
return $this->ssl_key;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getKey()
|
||||
{
|
||||
return $this->key;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param array $configs
|
||||
* @return $this
|
||||
*/
|
||||
public function setConfigs(array $configs)
|
||||
public function setConfigs(array $configs): static
|
||||
{
|
||||
if (empty($configs)) {
|
||||
return $this;
|
||||
|
||||
Reference in New Issue
Block a user