改名
This commit is contained in:
+2
-2
@@ -11,12 +11,12 @@
|
|||||||
"require": {
|
"require": {
|
||||||
"php": ">=8.0",
|
"php": ">=8.0",
|
||||||
"ext-json": "*",
|
"ext-json": "*",
|
||||||
"sensiolabs/consul-php-sdk": "v4.1.1"
|
"game-worker/kiri-consul": "dev-master"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"Kiri\\Rpc\\": "src/"
|
"Kiri\\Rpc\\": "src/"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
}
|
}
|
||||||
|
|||||||
+11
-4
@@ -3,7 +3,10 @@
|
|||||||
namespace Kiri\Rpc;
|
namespace Kiri\Rpc;
|
||||||
|
|
||||||
|
|
||||||
|
use Kiri\Kiri;
|
||||||
use Kiri\Pool\Pool;
|
use Kiri\Pool\Pool;
|
||||||
|
use SensioLabs\Consul\ServiceFactory;
|
||||||
|
use SensioLabs\Consul\Services\Agent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -19,34 +22,38 @@ class Consumers implements OnRpcConsumerInterface
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @param string $service
|
||||||
* @param string $method
|
* @param string $method
|
||||||
* @param mixed $data
|
* @param mixed $data
|
||||||
* @param string $version
|
* @param string $version
|
||||||
*/
|
*/
|
||||||
public function notify(string $method, mixed $data, string $version = '2.0'): void
|
public function notify(string $service, string $method, mixed $data, string $version = '2.0'): void
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @param string $service
|
||||||
* @param string $method
|
* @param string $method
|
||||||
* @param mixed $data
|
* @param mixed $data
|
||||||
* @param string $version
|
* @param string $version
|
||||||
* @param string $id
|
* @param string $id
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function get(string $method, mixed $data, string $version = '2.0', string $id = ''): mixed
|
public function get(string $service, string $method, mixed $data, string $version = '2.0', string $id = ''): mixed
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private function get_consul()
|
private function get_consul($service)
|
||||||
{
|
{
|
||||||
|
$sf = Kiri::getDi()->get(\Kiri\Consul\Agent::class);
|
||||||
|
|
||||||
|
$content = $sf->service->service($service)->getBody()->getContents();
|
||||||
|
|
||||||
|
$content = json_decode($content, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user