feat : Decorator basic
This commit is contained in:
@@ -4,13 +4,14 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\Controller\Test;
|
||||
|
||||
use App\Controller\AbstractController;
|
||||
use App\Service\Test\Adapter\CacheService;
|
||||
use App\Service\Test\Adapter\PayService;
|
||||
use Hyperf\HttpServer\Annotation\Controller;
|
||||
use Hyperf\HttpServer\Annotation\RequestMapping;
|
||||
|
||||
#[Controller(prefix: 'adapter/test')]
|
||||
class AdapterTestController
|
||||
class AdapterTestController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* pay 适配器
|
||||
|
||||
42
app/Controller/Test/DecoratorController.php
Normal file
42
app/Controller/Test/DecoratorController.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Controller\Test;
|
||||
|
||||
use App\Controller\AbstractController;
|
||||
use App\Service\Test\Decorator\AopService;
|
||||
use App\Service\Test\Decorator\BasicService;
|
||||
use App\Service\Test\Decorator\ContainerService;
|
||||
use App\Service\Test\Decorator\HttpService;
|
||||
use Hyperf\HttpServer\Annotation\Controller;
|
||||
use Hyperf\HttpServer\Annotation\RequestMapping;
|
||||
|
||||
#[Controller(prefix: 'decorator/test')]
|
||||
class DecoratorController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* basic 装饰器
|
||||
* @return array
|
||||
*/
|
||||
#[RequestMapping(path: 'basic', methods: 'GET')]
|
||||
public function basic()
|
||||
{
|
||||
return (new BasicService)->handle();
|
||||
}
|
||||
|
||||
public function container()
|
||||
{
|
||||
return (new ContainerService)->handle();
|
||||
}
|
||||
|
||||
public function aop()
|
||||
{
|
||||
return (new AopService)->handle();
|
||||
}
|
||||
|
||||
public function http()
|
||||
{
|
||||
return (new HttpService)->handle();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user