68 lines
1.5 KiB
PHP
68 lines
1.5 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Controller\Test;
|
|
|
|
use App\Service\Test\Proxy\AopService;
|
|
use App\Service\Test\Proxy\BasicSubjectService;
|
|
use App\Service\Test\Proxy\DynamicProxyService;
|
|
use App\Service\Test\Proxy\Payment\PaymentService;
|
|
use App\Service\Test\Proxy\UserInfoService;
|
|
use App\Service\Test\Proxy\UserService;
|
|
use Hyperf\HttpServer\Annotation\Controller;
|
|
use Hyperf\HttpServer\Annotation\RequestMapping;
|
|
use Psr\Container\ContainerExceptionInterface;
|
|
use Psr\Container\NotFoundExceptionInterface;
|
|
|
|
#[Controller(prefix: 'proxy/test')]
|
|
class ProxyController
|
|
{
|
|
/**
|
|
* 静态代理
|
|
* @return array
|
|
*/
|
|
#[RequestMapping(path: 'basic', methods: 'GET')]
|
|
public function basic(): array
|
|
{
|
|
return (new BasicSubjectService)->handle();
|
|
}
|
|
|
|
/**
|
|
* 动态代理
|
|
* @return array
|
|
* @throws ContainerExceptionInterface
|
|
* @throws NotFoundExceptionInterface
|
|
*/
|
|
#[RequestMapping(path: 'dynamic', methods: 'GET')]
|
|
public function dynamic(): array
|
|
{
|
|
return (new DynamicProxyService)->handle();
|
|
}
|
|
|
|
/**
|
|
* aop代理
|
|
* @return array
|
|
*/
|
|
#[RequestMapping(path: 'payment', methods: 'GET')]
|
|
public function payment(): array
|
|
{
|
|
return (new AopService)->handle();
|
|
}
|
|
|
|
/**
|
|
* 缓存代理
|
|
* @return array
|
|
*/
|
|
#[RequestMapping(path: 'get_user_info', methods: 'GET')]
|
|
public function getUserInfo(): array
|
|
{
|
|
return (new UserService)->handle();
|
|
}
|
|
|
|
public function remote()
|
|
{
|
|
|
|
}
|
|
}
|