基础数据-校区服务

This commit is contained in:
Aether
2025-09-19 15:14:20 +08:00
parent 824510d57c
commit b69f14ded2
16 changed files with 757 additions and 300 deletions

View File

@@ -0,0 +1,45 @@
<?php
declare(strict_types=1);
namespace Aether;
use Hyperf\Di\Annotation\Inject;
use Hyperf\HttpServer\Contract\RequestInterface;
use Hyperf\HttpServer\Contract\ResponseInterface;
abstract class AetherController
{
#[Inject]
protected RequestInterface $request;
#[Inject]
protected ResponseInterface $response;
/**
* 获取请求参数.
* @param string $key
* @param mixed|null $default
* @return mixed
*/
public function requestParam(string $key, mixed $default = null): mixed
{
return $this->request->input($key, $default);
}
/**
* 获取所有请求参数.
*/
public function requestParams(): array
{
return $this->request->all();
}
/**
* 返回JSON响应.
*/
public function json(array $data): \Psr\Http\Message\ResponseInterface
{
return $this->response->json($data);
}
}