协议请求优化

This commit is contained in:
lxf 2026-05-25 15:29:01 +08:00
parent 3e201aef06
commit a53a7a3e8e
2 changed files with 22 additions and 15 deletions

View File

@ -55,26 +55,31 @@ class ClientController extends Controller
ServerTrojan::configs($user)->toArray()
);
$inIpOnLink = $userService->goNodeOnLinkUser();
$servers = array();
if (count($inIpOnLink) > 0){
foreach ($servers1 as $item) {
$userSum = $inIpOnLink[config('app.name_en').$item['name']] ?? 0;
$item['xn'] = $userSum;
if(!is_null($item['tags'])){
foreach ($item['tags'] as $tag) {
if(strpos($tag, "dw:") === 0){
$dw = (int)substr($tag, 3);
if ($dw > 0) {
$item['xn'] = round($userSum / $dw, 2) + (mt_rand(1, 10) / 1000);
if (config('app.app_nodes_sort')){
$inIpOnLink = $userService->goNodeOnLinkUser();
if (count($inIpOnLink) > 0){
foreach ($servers1 as $item) {
$userSum = $inIpOnLink[config('app.name_en').$item['name']] ?? 0;
$item['xn'] = $userSum;
if(!is_null($item['tags'])){
foreach ($item['tags'] as $tag) {
if(strpos($tag, "dw:") === 0){
$dw = (int)substr($tag, 3);
if ($dw > 0) {
$item['xn'] = round($userSum / $dw, 2) + (mt_rand(1, 10) / 1000);
}
break;
}
break;
}
}
array_push($servers, $item);
}
array_push($servers, $item);
array_multisort(array_column($servers, 'xn'), SORT_ASC, $servers);
}else{
array_multisort(array_column($servers1, 'sort'), SORT_ASC, $servers1);
$servers = $servers1;
}
array_multisort(array_column($servers, 'xn'), SORT_ASC, $servers);
}else{
array_multisort(array_column($servers1, 'sort'), SORT_ASC, $servers1);
$servers = $servers1;

View File

@ -12,8 +12,10 @@ return [
| any other location as required by the application or its packages.
|
*/
'name' => env('APP_NAME', 'Laravel'),
"name_en" => env('APP_NAME_EN', env('DB_DATABASE', 'forge')),
"app_nodes_url" => env('APP_NODES_URL', "http://10.10.25.202:8082"),
"app_nodes_sort" => env('APP_NODES_SORT', true),
/*
|--------------------------------------------------------------------------