Files
ulthon_information/app/api/controller/ApiKeyInfo.php

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