改名
This commit is contained in:
+36
-5
@@ -2,13 +2,12 @@
|
||||
|
||||
namespace Kiri\Rpc;
|
||||
|
||||
use Annotation\Annotation;
|
||||
use Annotation\Inject;
|
||||
use Http\Constrict\ResponseInterface;
|
||||
use Http\Handler\Dispatcher;
|
||||
use Http\Handler\Router;
|
||||
use Http\Message\ServerRequest;
|
||||
use Kiri\Abstracts\Component;
|
||||
use Kiri\Di\NoteManager;
|
||||
use Kiri\Kiri;
|
||||
use ReflectionMethod;
|
||||
use Server\SInterface\OnCloseInterface;
|
||||
use Server\SInterface\OnConnectInterface;
|
||||
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;
|
||||
|
||||
|
||||
#[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 int $fd
|
||||
|
||||
Reference in New Issue
Block a user