Files
study/Swoft_BackEndApi/app/Aspect/FailAspect.php
2024-09-27 01:06:04 +08:00

34 lines
688 B
PHP

<?php
namespace App\Aspect;
use Swoft\Aop\Annotation\Mapping\AfterThrowing;
use Swoft\Aop\Annotation\Mapping\Aspect;
use Swoft\Aop\Annotation\Mapping\PointAnnotation;
use Swoft\Bean\Annotation\Mapping\Inject;
use App\Bean\ResponseBean;
/**
* @Aspect(order=1)
* @PointAnnotation(
* include={
* Swoft\Http\Server\Annotation\Mapping\RequestMapping::class
* }
* )
*/
class FailAspect {
/**
* @Inject("ResponseBean")
*/
protected $response;
/**
* @param \Throwable $throwable
* @return array
* @AfterThrowing()
*/
public function FailError(\Throwable $throwable) {
return $this->response->fail($throwable);
}
}