You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.4 KiB
52 lines
1.4 KiB
<?php |
|
|
|
namespace Plugins\Notebook\Controller\Admin; |
|
|
|
use App\Exception\ApiMessageException; |
|
use App\Controller\AbstractController; |
|
use Plugins\Notebook\Service\Admin\NotebookUserService; |
|
use App\Middleware\Admin\AuthenticateMiddleware; |
|
use App\Middleware\Admin\PermissionsMiddleware; |
|
use App\Util\Response; |
|
use Hyperf\HttpServer\Annotation\Controller; |
|
use Hyperf\HttpServer\Annotation\GetMapping; |
|
use Hyperf\HttpServer\Annotation\PostMapping; |
|
use Hyperf\HttpServer\Annotation\Middlewares; |
|
use Hyperf\Validation\Annotation\Scene; |
|
use Psr\Http\Message\ResponseInterface; |
|
|
|
/** |
|
* 笔记协作人员控制器 |
|
*/ |
|
#[Controller(prefix: 'admin/plugins/notebook_user')] |
|
#[Middlewares([AuthenticateMiddleware::class, PermissionsMiddleware::class])] |
|
class NotebookUserController extends AbstractController |
|
{ |
|
|
|
/** |
|
* 列表数据 |
|
* |
|
* @return ResponseInterface |
|
*/ |
|
#[GetMapping(path: 'lists-data')] |
|
public function listsData(): ResponseInterface |
|
{ |
|
return Response::json()->success(NotebookUserService::aop()->lists()); |
|
} |
|
|
|
/** |
|
* 更新数据 |
|
* |
|
* @return ResponseInterface |
|
* @throws ApiMessageException |
|
*/ |
|
#[Scene('update')] |
|
#[PostMapping(path: 'update')] |
|
public function update(): ResponseInterface |
|
{ |
|
NotebookUserService::aop()->update($this->request->post()); |
|
|
|
return Response::json()->success(); |
|
} |
|
|
|
}
|
|
|