mirror of
https://github.com/ProxyPanel/ProxyPanel.git
synced 2026-04-11 23:19:05 +00:00
1. 全面改写项目-管理面板的路由; 2. 拆分过于Contoller; 3. 优化了按钮过多的图表的显示; 4. 初步应用 Laravel的 表单验证功能; 5. 初步应用 Laravel的 component 功能 拆分/模块化前端代码; 6. 优化部分系统的判断逻辑; 7. 针对2.4.0以前的面板,追加辅助矫正数据库的sql文件;
45 lines
1.3 KiB
PHP
45 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Api\WebApi;
|
|
|
|
use App\Models\Node;
|
|
use Illuminate\Http\JsonResponse;
|
|
|
|
class TrojanController extends BaseController
|
|
{
|
|
// 获取节点信息
|
|
public function getNodeInfo($id): JsonResponse
|
|
{
|
|
$node = Node::find($id);
|
|
|
|
return $this->returnData('获取节点信息成功', 'success', 200, [
|
|
'id' => $node->id,
|
|
'is_udp' => $node->is_udp ? true : false,
|
|
'speed_limit' => $node->speed_limit,
|
|
'client_limit' => $node->client_limit,
|
|
'push_port' => $node->push_port,
|
|
'redirect_url' => sysConfig('redirect_url'),
|
|
'trojan_port' => $node->port,
|
|
'secret' => $node->auth->secret,
|
|
'license' => sysConfig('trojan_license'),
|
|
]);
|
|
}
|
|
|
|
// 获取节点可用的用户列表
|
|
public function getUserList($id): JsonResponse
|
|
{
|
|
$users = Node::find($id)->node_access_users;
|
|
$data = [];
|
|
|
|
foreach ($users as $user) {
|
|
$data[] = [
|
|
'uid' => $user->id,
|
|
'password' => $user->passwd,
|
|
'speed_limit' => $user->speed_limit,
|
|
];
|
|
}
|
|
|
|
return $this->returnData('获取用户列表成功', 'success', 200, $data, ['updateTime' => time()]);
|
|
}
|
|
}
|