aaa
This commit is contained in:
@@ -10,11 +10,14 @@ use App\Exception\BusinessException;
|
|||||||
use App\Model\Teacher;
|
use App\Model\Teacher;
|
||||||
use App\Validator\TeacherValidator;
|
use App\Validator\TeacherValidator;
|
||||||
use Hyperf\Di\Annotation\Inject;
|
use Hyperf\Di\Annotation\Inject;
|
||||||
|
use Hyperf\HttpServer\Annotation\Controller;
|
||||||
|
use Hyperf\HttpServer\Annotation\DeleteMapping;
|
||||||
|
use Hyperf\HttpServer\Annotation\GetMapping;
|
||||||
|
use Hyperf\HttpServer\Annotation\PostMapping;
|
||||||
|
use Hyperf\HttpServer\Annotation\PutMapping;
|
||||||
use Hyperf\HttpServer\Contract\RequestInterface;
|
use Hyperf\HttpServer\Contract\RequestInterface;
|
||||||
|
|
||||||
/**
|
#[Controller(prefix: '/api/v1/')]
|
||||||
* @Controller(prefix="/api/v1/teacher")
|
|
||||||
*/
|
|
||||||
class TeacherController extends AetherController
|
class TeacherController extends AetherController
|
||||||
{
|
{
|
||||||
#[Inject]
|
#[Inject]
|
||||||
@@ -22,8 +25,8 @@ class TeacherController extends AetherController
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建教师.
|
* 创建教师.
|
||||||
* @PostMapping(path="")
|
|
||||||
*/
|
*/
|
||||||
|
#[PostMapping(path: 'teacher')]
|
||||||
public function create(RequestInterface $request): array
|
public function create(RequestInterface $request): array
|
||||||
{
|
{
|
||||||
$data = $request->all();
|
$data = $request->all();
|
||||||
@@ -41,8 +44,8 @@ class TeacherController extends AetherController
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取教师详情.
|
* 获取教师详情.
|
||||||
* @GetMapping(path="/{id}")
|
|
||||||
*/
|
*/
|
||||||
|
#[GetMapping(path: 'teacher/{id}')]
|
||||||
public function get(int $id): array
|
public function get(int $id): array
|
||||||
{
|
{
|
||||||
$teacher = Teacher::find($id);
|
$teacher = Teacher::find($id);
|
||||||
@@ -55,8 +58,8 @@ class TeacherController extends AetherController
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新教师信息.
|
* 更新教师信息.
|
||||||
* @PutMapping(path="/{id}")
|
|
||||||
*/
|
*/
|
||||||
|
#[PutMapping(path: 'teacher/{id}')]
|
||||||
public function update(int $id, RequestInterface $request): array
|
public function update(int $id, RequestInterface $request): array
|
||||||
{
|
{
|
||||||
$data = $request->all();
|
$data = $request->all();
|
||||||
@@ -80,8 +83,8 @@ class TeacherController extends AetherController
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除教师.
|
* 删除教师.
|
||||||
* @DeleteMapping(path="/{id}")
|
|
||||||
*/
|
*/
|
||||||
|
#[DeleteMapping(path: 'teacher/{id}')]
|
||||||
public function delete(int $id): array
|
public function delete(int $id): array
|
||||||
{
|
{
|
||||||
$teacher = Teacher::find($id);
|
$teacher = Teacher::find($id);
|
||||||
@@ -95,8 +98,8 @@ class TeacherController extends AetherController
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 教师列表.
|
* 教师列表.
|
||||||
* @GetMapping(path="/list")
|
|
||||||
*/
|
*/
|
||||||
|
#[GetMapping(path: 'teachers')]
|
||||||
public function list(RequestInterface $request): array
|
public function list(RequestInterface $request): array
|
||||||
{
|
{
|
||||||
$data = $request->all();
|
$data = $request->all();
|
||||||
@@ -139,8 +142,8 @@ class TeacherController extends AetherController
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 搜索教师.
|
* 搜索教师.
|
||||||
* @GetMapping(path="/search")
|
|
||||||
*/
|
*/
|
||||||
|
#[GetMapping(path: 'teacher')]
|
||||||
public function search(RequestInterface $request): array
|
public function search(RequestInterface $request): array
|
||||||
{
|
{
|
||||||
$keyword = $request->input('keyword', '');
|
$keyword = $request->input('keyword', '');
|
||||||
|
|||||||
Reference in New Issue
Block a user