Files
kiri-wchat/wchat/common/Config.php
T
2021-04-06 15:20:39 +08:00

538 lines
6.7 KiB
PHP

<?php
namespace wchat\common;
class Config
{
/**
* @var string
*
* 小程序ID
*/
private $appid = '';
/**
* @var string
*
* 商户号ID
*/
private $mch_id = '';
/**
* @var string
*
* 设备号
*/
private $device_info = 'WEB';
private $token;
private $encodingAesKey;
/**
* @var string
*
* 随机字符串
*/
private $nonce_str = '';
/**
* @var string
*
* 商品简单描述
*/
private $body = '好友默契Pk充值!';
/**
* @var string
*
* 商户订单号
*/
private $out_trade_no = "";
/**
* @var int
*
* 金额
*/
private $total_fee = 0;
/**
* @var string
*
* 终端IP
*/
private $spbill_create_ip = "";
/**
* @var string
*
* 异步回调地址
*/
private $notify_url = "";
/**
* @var string
*
* 交易类型
*/
private $trade_type = 'JSAPI';
/**
* @var string
*
* 签名方式
*/
private $sign_type = 'MD5';
/**
* @var string
*
* 商户接口地址
*/
private $mch_host = 'https://api.mch.weixin.qq.com';
/**
* @var string
*/
private $appsecret = '';
private $remote_addr = '127.0.0.1';
private $ssl_cert = '';
private $ssl_key = '';
private $ssl_ca = '';
private $port = '';
/**
* @var string
*/
private $key = '';
private $access_token = '';
private $agent = '';
private $usrSwoole = false;
/**
* @return string
*/
public function getSslCa()
{
return $this->ssl_ca;
}
/**
* @param $ssl_ca
* @return Config
*/
public function setSslCa($ssl_ca): Config
{
$this->ssl_ca = $ssl_ca;
return $this;
}
/**
* @return string
*/
public function getPort()
{
return $this->port;
}
/**
* @param $port
* @return Config
*/
public function setPort($port): Config
{
$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;
}
/**
* @return string
*/
public function getAgent()
{
return $this->agent;
}
/**
* @param $agent
* @return Config
*/
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)
{
$this->appid = $appid;
}
/**
* @param $mch_id
*/
public function setMchId($mch_id)
{
$this->mch_id = $mch_id;
}
/**
* @param $device_info
*/
public function setDeviceInfo($device_info)
{
$this->device_info = $device_info;
}
/**
* @param $nonce_str
*/
public function setNonceStr($nonce_str)
{
$this->nonce_str = $nonce_str;
}
/**
* @param $body
*/
public function setBody($body)
{
$this->body = $body;
}
/**
* @param $out_trade_no
*/
public function setOutTradeNo($out_trade_no)
{
$this->out_trade_no = $out_trade_no;
}
/**
* @param int $total_fee
*/
public function setTotalFee(int $total_fee)
{
$this->total_fee = $total_fee;
}
/**
* @param $spbill_create_ip
*/
public function setSpbillCreateIp($spbill_create_ip)
{
$this->spbill_create_ip = $spbill_create_ip;
}
/**
* @param $notify_url
*/
public function setNotifyUrl($notify_url)
{
$this->notify_url = $notify_url;
}
/**
* @param $trade_type
*/
public function setTradeType($trade_type)
{
$this->trade_type = $trade_type;
}
/**
* @param $sign_type
*/
public function setSignType($sign_type)
{
$this->sign_type = $sign_type;
}
/**
* @param $mch_host
*/
public function setMchHost($mch_host)
{
$this->mch_host = $mch_host;
}
/**
* @param $appsecret
*/
public function setAppsecret($appsecret)
{
$this->appsecret = $appsecret;
}
/**
* @param $ssl_cert
*/
public function setSslCert($ssl_cert)
{
$this->ssl_cert = $ssl_cert;
}
/**
* @param $ssl_key
*/
public function setSslKey($ssl_key)
{
$this->ssl_key = $ssl_key;
}
/**
* @param $key
*/
public function setKey($key)
{
$this->key = $key;
}
/**
* @return string
*/
public function getAppid()
{
return $this->appid;
}
/**
* @return string
*/
public function getMchId()
{
return $this->mch_id;
}
/**
* @return string
*/
public function getDeviceInfo()
{
return $this->device_info;
}
/**
* @return string
*/
public function getNonceStr()
{
return $this->nonce_str;
}
/**
* @return string
*/
public function getBody()
{
return $this->body;
}
/**
* @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)
{
if (empty($configs)) {
return $this;
}
foreach ($configs as $key => $val) {
if (empty($val) || is_array($val)) {
continue;
}
if (!property_exists($this, $key)) {
continue;
}
$this->$key = $val;
}
return $this;
}
}