<?php
declare(strict_types=1);
namespace App\System\Controller\Api;
use App\System\Service\SystemApiService;
use App\System\Request\Api\SystemApiCreateRequest;
use App\System\Request\Api\SystemApiUpdateRequest;
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 Mine\Annotation\Auth;
use Mine\Annotation\OperationLog;
use Mine\Annotation\Permission;
use Mine\MineController;
use Psr\Http\Message\ResponseInterface;
class SystemApiController extends MineController
{
protected $service;
public function index(): ResponseInterface
{
return $this->success($this->service->getPageList($this->request->all()));
}
public function getModuleList(): ResponseInterface
{
$this->mine->scanModule();
return $this->success($this->mine->getModuleInfo());
}
public function recycle(): ResponseInterface
{
return $this->success($this->service->getPageListByRecycle($this->request->all()));
}
public function save(SystemApiCreateRequest $request): ResponseInterface
{
return $this->success(['id' => $this->service->save($request->all())]);
}
public function read(int $id): ResponseInterface
{
return $this->success($this->service->read($id));
}
public function update(int $id, SystemApiUpdateRequest $request): ResponseInterface
{
return $this->service->update($id, $request->all()) ? $this->success() : $this->error();
}
public function delete(String $ids): ResponseInterface
{
return $this->service->delete($ids) ? $this->success() : $this->error();
}
public function realDelete(String $ids): ResponseInterface
{
return $this->service->realDelete($ids) ? $this->success() : $this->error();
}
public function recovery(String $ids): ResponseInterface
{
return $this->service->recovery($ids) ? $this->success() : $this->error();
}
}