mirror of
https://gitee.com/ulthon/ulthon_information.git
synced 2026-07-04 14:42:47 +08:00
feat(api): add article/attachment API endpoints, admin management, and API docs
- Articles API: list/detail/create/update/delete with source-based permission control - Attachments API: upload/list/delete with source-based permission control - ApiKeyInfo API: query current key permissions - Admin ApiKey management: generate/regenerate/toggle/permission settings with layui UI - Frontend API documentation page with complete interface reference
This commit is contained in:
33
app/api/controller/ApiKeyInfo.php
Normal file
33
app/api/controller/ApiKeyInfo.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\BaseController;
|
||||
|
||||
class ApiKeyInfo extends BaseController
|
||||
{
|
||||
protected $middleware = [\app\middleware\ApiKeyAuth::class];
|
||||
|
||||
public function info()
|
||||
{
|
||||
$request = $this->request;
|
||||
|
||||
$can_delete_text = '不能删除';
|
||||
if ($request->can_delete == 1) {
|
||||
$can_delete_text = '仅删除API数据';
|
||||
} elseif ($request->can_delete == 2) {
|
||||
$can_delete_text = '可删除所有数据';
|
||||
}
|
||||
|
||||
return json_message([
|
||||
'admin_id' => $request->admin_id,
|
||||
'can_write_own' => $request->can_write_own,
|
||||
'can_write_other' => $request->can_write_other,
|
||||
'can_delete' => $request->can_delete,
|
||||
'permissions_text' => [
|
||||
'can_write_own' => $request->can_write_own ? '可管理自己的数据' : '不可管理自己的数据',
|
||||
'can_write_other' => $request->can_write_other ? '可管理后台数据' : '不可管理后台数据',
|
||||
'can_delete' => $can_delete_text,
|
||||
],
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user