feat : Decorator basic

This commit is contained in:
2025-09-05 15:00:28 +08:00
parent d43d38d820
commit 5e8cc5c61e
15 changed files with 264 additions and 10 deletions

View File

@@ -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 适配器

View 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();
}
}