feat(api): 新增节点月流量限额强制下线
新增节点级月流量限额配置、重置调度和运行状态持久化 下发 traffic_limit 给 mi-node,并在超额后停止内核、到期后恢复 管理端支持编辑限额参数并展示额度进度、状态和下次重置 手动与定时重置会同步清理限额状态并通知节点刷新配置
This commit is contained in:
@@ -241,10 +241,15 @@ class ServerService
|
||||
'api' => $metrics['api'] ?? [],
|
||||
'ws' => $metrics['ws'] ?? [],
|
||||
'limits' => $metrics['limits'] ?? [],
|
||||
'traffic_limit' => $metrics['traffic_limit'] ?? null,
|
||||
'updated_at' => now()->timestamp,
|
||||
'kernel_status' => (bool) ($metrics['kernel_status'] ?? false),
|
||||
];
|
||||
|
||||
if (isset($metrics['traffic_limit']) && is_array($metrics['traffic_limit'])) {
|
||||
app(ServerTrafficLimitService::class)->applyRuntimeMetrics($node, $metrics['traffic_limit']);
|
||||
}
|
||||
|
||||
Cache::put(
|
||||
CacheKey::get('SERVER_' . $nodeType . '_METRICS', $nodeId),
|
||||
$metricsData,
|
||||
@@ -397,6 +402,8 @@ class ServerService
|
||||
}
|
||||
}
|
||||
|
||||
$response['traffic_limit'] = app(ServerTrafficLimitService::class)->buildNodeConfig($node);
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user