改名
This commit is contained in:
@@ -43,7 +43,7 @@ class Annotation extends BaseAnnotation
|
|||||||
|
|
||||||
private $_classMap = [
|
private $_classMap = [
|
||||||
'websocket' => Websocket::class,
|
'websocket' => Websocket::class,
|
||||||
'http' => \HttpServer\Events\Http::class
|
'http' => Http::class
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -20,55 +20,26 @@ class Http extends Annotation
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
* 拦截器
|
* @Interceptor(LoginInterceptor)
|
||||||
*/
|
*/
|
||||||
private $Interceptor;
|
private $Interceptor = 'required|not empty';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
* 限速
|
|
||||||
*/
|
*/
|
||||||
private $Limits;
|
private $Limits = 'required|not empty';
|
||||||
|
|
||||||
|
protected $_annotations = [];
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $controller
|
* @param $events
|
||||||
* @param $methodName
|
* @return bool
|
||||||
* @param $handler
|
|
||||||
* @return array
|
|
||||||
* @throws ReflectionException
|
|
||||||
*/
|
*/
|
||||||
public function createLimits($controller, $methodName, $handler)
|
public function isLegitimate($events)
|
||||||
{
|
{
|
||||||
$namespace = 'App\Http\Interceptor\\' . $handler;
|
return isset($events[2]) && !empty($events[2]);
|
||||||
$class = Snowflake::getDi()->getReflect($namespace);
|
|
||||||
|
|
||||||
$object = $class->newInstance();
|
|
||||||
|
|
||||||
|
|
||||||
$method = $class->getMethod('Interceptor');
|
|
||||||
|
|
||||||
|
|
||||||
return [$object, 'Interceptor'];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param $controller
|
|
||||||
* @param $methodName
|
|
||||||
* @param $handler
|
|
||||||
* @return array
|
|
||||||
* @throws ReflectionException
|
|
||||||
*/
|
|
||||||
public function createInterceptor($controller, $methodName, $handler)
|
|
||||||
{
|
|
||||||
$namespace = 'App\Interceptor\\' . $handler;
|
|
||||||
$class = Snowflake::getDi()->getReflect($namespace);
|
|
||||||
|
|
||||||
$object = $class->newInstance();
|
|
||||||
|
|
||||||
return [$object, 'Interceptor', [request(), [$controller, $methodName]]];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -79,7 +50,8 @@ class Http extends Annotation
|
|||||||
*/
|
*/
|
||||||
public function getName($name, $events)
|
public function getName($name, $events)
|
||||||
{
|
{
|
||||||
return self::HTTP_EVENT . $name . ':' . $events[1];
|
return self::HTTP_EVENT . $name . ':' . $events[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user