Files
ulthon_information/app/api/controller/ApiKeyInfo.php
augushong dc116a1c77 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
2026-04-27 00:38:57 +08:00

34 lines
1.1 KiB
PHP

<?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,
],
]);
}
}