改名
This commit is contained in:
@@ -95,13 +95,15 @@ abstract class JsonRpcConsumers implements OnRpcConsumerInterface
|
|||||||
*/
|
*/
|
||||||
private function get_consul($service): array
|
private function get_consul($service): array
|
||||||
{
|
{
|
||||||
$sf = Kiri::getDi()->get(Catalog::class);
|
// $sf = Kiri::getDi()->get(Catalog::class);
|
||||||
|
//
|
||||||
|
// $content = $sf->service($service)->getBody()->getContents();
|
||||||
|
//
|
||||||
|
// $content = json_decode($content, true);
|
||||||
|
//
|
||||||
|
// return $content[array_rand($content)];
|
||||||
|
|
||||||
$content = $sf->service($service)->getBody()->getContents();
|
return ['ServiceAddress' => '127.0.0.1', 'ServicePort' => 9526];
|
||||||
|
|
||||||
$content = json_decode($content, true);
|
|
||||||
|
|
||||||
return $content[array_rand($content)];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+1
-3
@@ -172,9 +172,7 @@ class RpcJsonp extends Component implements OnConnectInterface, OnReceiveInterfa
|
|||||||
{
|
{
|
||||||
$controller = Kiri::getDi()->get($handler[0]);
|
$controller = Kiri::getDi()->get($handler[0]);
|
||||||
|
|
||||||
$params = array_merge($params, $data['params']);
|
$dispatcher = $controller->{$handler[1]}(...$data['params']);
|
||||||
|
|
||||||
$dispatcher = $controller->{$handler[1]}(...$params);
|
|
||||||
|
|
||||||
return ['jsonrpc' => '2.0', 'result' => $dispatcher, 'id' => $data['id'] ?? null];
|
return ['jsonrpc' => '2.0', 'result' => $dispatcher, 'id' => $data['id'] ?? null];
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-2
@@ -25,9 +25,11 @@ class RpcManager
|
|||||||
if (!isset(static::$_rpc[$name])) static::$_rpc[$name] = [];
|
if (!isset(static::$_rpc[$name])) static::$_rpc[$name] = [];
|
||||||
|
|
||||||
foreach ($lists as $reflection) {
|
foreach ($lists as $reflection) {
|
||||||
$params = Kiri::getDi()->getMethodParameters($class, $reflection->getName());
|
$methodName = $reflection->getName();
|
||||||
|
|
||||||
static::$_rpc[$name][] = [$reflection->getName(), $params];
|
$params = Kiri::getDi()->getMethodParameters($class, $methodName);
|
||||||
|
|
||||||
|
static::$_rpc[$name][$methodName] = [[$class, $methodName], $params];
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user