server/app/Aspect/UserAspect.php

36 lines
768 B
PHP

<?php
/**
* Author: cfn <cfn@leapy.cn>
*/
namespace App\Aspect;
use App\Annotation\User;
use Hyperf\Di\Annotation\Aspect;
use Hyperf\Di\Annotation\Inject;
use Hyperf\Di\Aop\AbstractAspect;
use Hyperf\Di\Aop\ProceedingJoinPoint;
use Hyperf\HttpServer\Contract\RequestInterface;
use Hyperf\HttpServer\Contract\ResponseInterface;
#[Aspect]
class UserAspect extends AbstractAspect
{
#[Inject]
protected RequestInterface $request;
#[Inject]
protected ResponseInterface $response;
public array $annotations = [
User::class
];
public function process(ProceedingJoinPoint $proceedingJoinPoint)
{
// TODO: Implement process() method.
$response = $proceedingJoinPoint->process();
return $response;
}
}