Files
hyperf_service/app/Controller/Admin/EmployeeController.php
2025-01-21 16:20:16 +08:00

91 lines
2.2 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Controller\Admin;
use App\Controller\AbstractController;
use App\Middleware\Admin\JwtAuthMiddleware;
use App\Request\Admin\EmployeeRequest;
use App\Service\Admin\User\EmployeeService;
use Exception;
use Hyperf\HttpServer\Annotation\Controller;
use Hyperf\HttpServer\Annotation\Middlewares;
use Hyperf\HttpServer\Annotation\RequestMapping;
use Hyperf\Validation\Annotation\Scene;
#[Controller(prefix: "admin/employee")]
#[Middlewares([
JwtAuthMiddleware::class,
])]
class EmployeeController extends AbstractController
{
/**
* @param EmployeeRequest $request
* @return array
* @throws Exception
*/
#[RequestMapping(path: "add", methods: "POST")]
#[Scene(scene: "add")]
public function add(EmployeeRequest $request): array
{
return (new EmployeeService)->add();
}
/**
* @param EmployeeRequest $request
* @return array
*/
#[RequestMapping(path: "edit", methods: "POST")]
#[Scene(scene: "edit")]
public function edit(EmployeeRequest $request): array
{
return (new EmployeeService)->edit();
}
/**
* @param EmployeeRequest $request
* @return array
*/
#[RequestMapping(path: "del", methods: "GET")]
#[Scene(scene: "del")]
public function delete(EmployeeRequest $request): array
{
return (new EmployeeService)->delete();
}
/**
* @param EmployeeRequest $request
* @return array
*/
#[RequestMapping(path: "list", methods: "GET")]
#[Scene(scene: "list")]
public function list(EmployeeRequest $request): array
{
return (new EmployeeService)->handle();
}
/**
* @param EmployeeRequest $request
* @return array
*/
#[RequestMapping(path: "info", methods: "GET")]
#[Scene(scene: "info")]
public function info(EmployeeRequest $request): array
{
return (new EmployeeService)->get();
}
/**
* @param EmployeeRequest $request
* @return array
* @throws Exception
*/
#[RequestMapping(path: "reset_password", methods: "GET")]
#[Scene(scene: "reset_password")]
public function resetPassword(EmployeeRequest $request): array
{
return (new EmployeeService)->resetPassword();
}
}