mirror of
https://github.com/ProxyPanel/ProxyPanel.git
synced 2026-04-13 07:59:20 +00:00
1. models 关系规范化; 2. 本地-在线 订单处理改写; 3. 优化用户界面节点的查表操作; 4. 半修复 VNet SSR版需要面板主动提交用户信息变动的问题;(节点等级,用户分组,Node信息修改 主动通知节点尚未添加); 5. 简化并提取出了 返利佣金相关处理逻辑;
58 lines
1.6 KiB
PHP
58 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Api\WebApi;
|
|
|
|
use App\Models\Node;
|
|
use Illuminate\Http\JsonResponse;
|
|
|
|
class VNetController extends BaseController {
|
|
// 获取节点信息
|
|
public function getNodeInfo($id): JsonResponse {
|
|
$node = Node::find($id);
|
|
|
|
return $this->returnData('获取节点信息成功', 'success', 200, [
|
|
'id' => $node->id,
|
|
'method' => $node->method,
|
|
'protocol' => $node->protocol,
|
|
'obfs' => $node->obfs,
|
|
'obfs_param' => $node->obfs_param?: '',
|
|
'is_udp' => $node->is_udp,
|
|
'speed_limit' => $node->speed_limit,
|
|
'client_limit' => $node->client_limit,
|
|
'single' => $node->single,
|
|
'port' => (string) $node->port,
|
|
'passwd' => $node->passwd?: '',
|
|
'push_port' => $node->push_port,
|
|
'secret' => $node->auth->secret,
|
|
'redirect_url' => sysConfig('redirect_url')
|
|
]);
|
|
}
|
|
|
|
// 获取节点可用的用户列表
|
|
public function getUserList($id): JsonResponse {
|
|
$node = Node::find($id);
|
|
$users = $node->node_access_users;
|
|
$data = [];
|
|
|
|
foreach($users as $user){
|
|
$data[] = [
|
|
'uid' => $user->id,
|
|
'port' => $user->port,
|
|
'passwd' => $user->passwd,
|
|
'method' => $user->method,
|
|
'protocol' => $user->protocol,
|
|
'obfs' => $user->obfs,
|
|
'obfs_param' => $node->obfs_param,
|
|
'speed_limit' => $user->speed_limit,
|
|
'enable' => $user->enable
|
|
];
|
|
}
|
|
|
|
if($data){
|
|
return $this->returnData('获取用户列表成功', 'success', 200, $data, ['updateTime' => time()]);
|
|
}
|
|
|
|
return $this->returnData('获取用户列表失败');
|
|
}
|
|
}
|