自定义back_url
This commit is contained in:
parent
7699a7d16d
commit
0c83f906e4
|
@ -9,12 +9,15 @@ class Config
|
|||
|
||||
private $timeOut;
|
||||
|
||||
private $backUrl;
|
||||
|
||||
public function __construct(array $configs = [])
|
||||
{
|
||||
|
||||
foreach ($configs as $key => $val) {
|
||||
if (method_exists($key, $this)) {
|
||||
call_user_func([$this, $key], $val);
|
||||
$method = $this->camelCase($key);
|
||||
if (method_exists($method, $this)) {
|
||||
call_user_func([$this, $method], $val);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -53,6 +56,22 @@ class Config
|
|||
|
||||
public function getBackUrl(): string
|
||||
{
|
||||
return config('rocket_mq.callback_host').config('rocket_mq.callback');
|
||||
return $this->backUrl ?? config('rocket_mq.callback_host').config('rocket_mq.callback');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $backUrl
|
||||
*/
|
||||
public function setBackUrl($backUrl): void
|
||||
{
|
||||
$this->backUrl = $backUrl;
|
||||
}
|
||||
|
||||
|
||||
private function camelCase(string $underscored)
|
||||
{
|
||||
return preg_replace_callback('/_([a-z])/', function ($match) {
|
||||
return strtoupper($match[1]);
|
||||
}, $underscored);
|
||||
}
|
||||
}
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
namespace tm\xls\rocketMq\thinkphp\consumer\command;
|
||||
|
||||
|
||||
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use React\Http\HttpServer;
|
||||
use React\Http\Message\Response;
|
||||
|
|
Loading…
Reference in New Issue
Block a user