This commit is contained in:
xl
2023-05-25 16:59:19 +08:00
parent d72ff2f82c
commit 18a9b29bbd
+3 -4
View File
@@ -7,7 +7,6 @@ use JetBrains\PhpStorm\ArrayShape;
use Kiri; use Kiri;
use Kiri\Di\LocalService; use Kiri\Di\LocalService;
use Kiri\Abstracts\Component; use Kiri\Abstracts\Component;
use Kiri\Abstracts\Config;
use Kiri\Annotation\Annotation; use Kiri\Annotation\Annotation;
use Kiri\Consul\Agent; use Kiri\Consul\Agent;
use Kiri\Core\Json; use Kiri\Core\Json;
@@ -72,7 +71,7 @@ class RpcJsonp extends Component implements OnConnectInterface, OnReceiveInterfa
public function init(): void public function init(): void
{ {
$this->eventProvider->on(OnBeforeShutdown::class, [$this, 'onBeforeShutdown']); $this->eventProvider->on(OnBeforeShutdown::class, [$this, 'onBeforeShutdown']);
// $this->consul = Config::get('rpc.consul', null); // $this->consul = \config('rpc.consul', null);
// if (!empty($this->consul)) { // if (!empty($this->consul)) {
// $this->eventProvider->on(OnServerBeforeStart::class, [$this, 'register']); // $this->eventProvider->on(OnServerBeforeStart::class, [$this, 'register']);
// } // }
@@ -89,7 +88,7 @@ class RpcJsonp extends Component implements OnConnectInterface, OnReceiveInterfa
*/ */
public function registerConsumers(): void public function registerConsumers(): void
{ {
$consumers = Config::get('rpc.consumers', []); $consumers = \config('rpc.consumers', []);
if (!is_array($consumers)) { if (!is_array($consumers)) {
return; return;
} }
@@ -128,7 +127,7 @@ class RpcJsonp extends Component implements OnConnectInterface, OnReceiveInterfa
*/ */
public function register(OnServerBeforeStart $server) public function register(OnServerBeforeStart $server)
{ {
$consumers = Config::get("rpc.consumers", []); $consumers = \config("rpc.consumers", []);
if (!empty($consumers)) { if (!empty($consumers)) {
foreach ($consumers as $service => $consumer) { foreach ($consumers as $service => $consumer) {
$this->manager->add($service, $consumer); $this->manager->add($service, $consumer);