This commit is contained in:
2021-12-02 14:13:44 +08:00
parent ce3647b5b7
commit d2ec972c69
+4 -1
View File
@@ -28,7 +28,9 @@ class RpcManager
$methods = Kiri::getDi()->getReflect($class); $methods = Kiri::getDi()->getReflect($class);
$lists = $methods->getMethods(\ReflectionMethod::IS_PUBLIC); $lists = $methods->getMethods(\ReflectionMethod::IS_PUBLIC);
if (!isset($this->_rpc[$name])) $this->_rpc[$name] = ['methods' => [], 'id' => $serviceConfig['ID'], 'config' => $serviceConfig]; if (!isset($this->_rpc[$name])) {
$this->_rpc[$name] = ['methods' => [], 'id' => $serviceConfig['ID'], 'config' => $serviceConfig];
}
foreach ($lists as $reflection) { foreach ($lists as $reflection) {
$methodName = $reflection->getName(); $methodName = $reflection->getName();
@@ -59,6 +61,7 @@ class RpcManager
{ {
$agent = Kiri::getDi()->get(Agent::class); $agent = Kiri::getDi()->get(Agent::class);
foreach ($this->_rpc as $list) { foreach ($this->_rpc as $list) {
var_dump($list);
$data = $agent->service->register($list['config']); $data = $agent->service->register($list['config']);
if ($data->getStatusCode() != 200) { if ($data->getStatusCode() != 200) {
exit($data->getBody()->getContents()); exit($data->getBody()->getContents());