改名
This commit is contained in:
+36
-5
@@ -2,13 +2,12 @@
|
|||||||
|
|
||||||
namespace Kiri\Rpc;
|
namespace Kiri\Rpc;
|
||||||
|
|
||||||
|
use Annotation\Annotation;
|
||||||
use Annotation\Inject;
|
use Annotation\Inject;
|
||||||
use Http\Constrict\ResponseInterface;
|
|
||||||
use Http\Handler\Dispatcher;
|
|
||||||
use Http\Handler\Router;
|
use Http\Handler\Router;
|
||||||
use Http\Message\ServerRequest;
|
use Kiri\Abstracts\Component;
|
||||||
|
use Kiri\Di\NoteManager;
|
||||||
use Kiri\Kiri;
|
use Kiri\Kiri;
|
||||||
use ReflectionMethod;
|
|
||||||
use Server\SInterface\OnCloseInterface;
|
use Server\SInterface\OnCloseInterface;
|
||||||
use Server\SInterface\OnConnectInterface;
|
use Server\SInterface\OnConnectInterface;
|
||||||
use Server\SInterface\OnReceiveInterface;
|
use Server\SInterface\OnReceiveInterface;
|
||||||
@@ -20,7 +19,7 @@ use Swoole\Server;
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class RpcJsonp implements OnConnectInterface, OnReceiveInterface, OnCloseInterface
|
class RpcJsonp extends Component implements OnConnectInterface, OnReceiveInterface, OnCloseInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
@@ -28,6 +27,38 @@ class RpcJsonp implements OnConnectInterface, OnReceiveInterface, OnCloseInterfa
|
|||||||
public Router $router;
|
public Router $router;
|
||||||
|
|
||||||
|
|
||||||
|
#[Inject(Annotation::class)]
|
||||||
|
public Annotation $annotation;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @throws \Exception
|
||||||
|
*/
|
||||||
|
public function init(): void
|
||||||
|
{
|
||||||
|
$this->annotation->read(APP_PATH . 'rpc', 'Rpc');
|
||||||
|
|
||||||
|
$data = $this->annotation->runtime(APP_PATH . 'rpc');
|
||||||
|
|
||||||
|
$di = Kiri::getDi();
|
||||||
|
foreach ($data as $class) {
|
||||||
|
foreach (NoteManager::getTargetNote($class) as $value) {
|
||||||
|
$value->execute($class);
|
||||||
|
}
|
||||||
|
$methods = $di->getMethodAttribute($class);
|
||||||
|
foreach ($methods as $method => $attribute) {
|
||||||
|
if (empty($attribute)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
foreach ($attribute as $item) {
|
||||||
|
$item->execute($class, $method);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Server $server
|
* @param Server $server
|
||||||
* @param int $fd
|
* @param int $fd
|
||||||
|
|||||||
Reference in New Issue
Block a user