<?php
declare(strict_types=1);
namespace App\System\Controller\App;
use App\System\Service\SystemAppService;
use App\System\Request\App\SystemAppCreateRequest;
use App\System\Request\App\SystemAppUpdateRequest;
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 SystemAppController extends MineController
{
protected $service;
public function getAppId(): ResponseInterface
{
return $this->success(['app_id' => $this->service->getAppId()]);
}
public function getAppSecret(): ResponseInterface
{
return $this->success(['app_secret' => $this->service->getAppSecret()]);
}
public function index(): ResponseInterface
{
return $this->success($this->service->getPageList($this->request->all()));
}
public function getApiList(): ResponseInterface
{
return $this->success($this->service->getApiList((int) $this->request->input('id', null)));
}
public function recycle(): ResponseInterface
{
return $this->success($this->service->getPageListByRecycle($this->request->all()));
}
public function save(SystemAppCreateRequest $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, SystemAppUpdateRequest $request): ResponseInterface
{
return $this->service->update($id, $request->all()) ? $this->success() : $this->error();
}
public function bind(int $id): ResponseInterface
{
return $this->service->bind($id, $this->request->input('apiIds', [])) ? $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();
}
}