Skip to content

Commit

Permalink
调整config
Browse files Browse the repository at this point in the history
  • Loading branch information
FeiLiao-9 committed May 31, 2024
1 parent d6dfd43 commit 30dac87
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions src/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,36 @@
class Config
{

/**
* 请求地址
* @var string
*/
protected $baseUrl = 'https://sms.crmeb.net/api/v2';

/**
*
* 缓存前缀
* @var string
*/
protected $baseCachePrefix = 'sms-crmeb-yihaotong-';

/**
* 缓存超时时间
* @var int
*/
protected $baseCacheTimeout = 300;


/**
* 缓存过期时间
* @var int
*/
protected $expires = 3600;

/**
* redis 配置
* @var array
*/
protected $redis = [
'host' => '127.0.0.1',
'port' => '6379',
Expand All @@ -27,37 +49,63 @@ class Config
'timeout' => 0
];

/**
* 设置基础请求地址
* @param string $baseUrl
* @return $this
*/
public function setBaseUrl(string $baseUrl)
{
$this->baseUrl = $baseUrl;
return $this;
}

/**
* 设置缓存前缀
* @param string $baseCachePrefix
* @return $this
*/
public function setBaseCachePrefix(string $baseCachePrefix)
{
$this->baseCachePrefix = $baseCachePrefix;
return $this;
}

/**
* 设置缓存超时时间
* @param int $baseCacheTimeout
* @return $this
*/
public function setBaseCacheTimeout(int $baseCacheTimeout)
{
$this->baseCacheTimeout = $baseCacheTimeout;
return $this;
}

/**
* 设置过期时间
* @param int $expires
* @return $this
*/
public function setExpires(int $expires)
{
$this->expires = $expires;
return $this;
}

/**
* 设置redis 配置
* @param array $redis
* @return $this
*/
public function setRedis(array $redis)
{
$this->redis = $redis;
return $this;
}

/**
* 转数组
* @return array
*/
public function toArray()
Expand Down

0 comments on commit 30dac87

Please sign in to comment.