dd/app/Services/CountrySpeedService.php
2026-07-29 15:12:14 +08:00

77 lines
1.9 KiB
PHP
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
declare(strict_types=1);
namespace App\Services;
use App\Models\FreenodePool;
final class CountrySpeedService
{
static $aCountry = [
"美国",
"美国",
"日本",
"日本",
"新加坡",
"新加坡",
"香港",
"香港",
"台湾",
"台湾",
"越南",
"越南",
"俄罗斯",
"新西兰",
"瑞士",
"荷兰",
"冰岛",
"爱尔兰",
"乌克兰",
"泰国",
"阿根廷",
"葡萄牙",
"美国",
"日本",
"新加坡",
"台湾",
"香港",
"韩国",
"德国",
"土耳其",
"法国",
"加拿大",
"加拿大",
];
public static function fn_b()
{
//// 地区
$iCountryLimit = rand(5, 12);
$aCountryKey = array_rand(self::$aCountry, $iCountryLimit);
$aCountry = [];
foreach ($aCountryKey as $sCountryKey) {
$aCountry[] = self::$aCountry[$sCountryKey];
}
$sNodeZone = implode("", $aCountry);
//// 速度
$iNodeSpeed = rand(config("freenode.speed_min"), config("freenode.speed_max"));
$oFnp = FreenodePool::whereDate('date', date("Y-m-d"))->first();
// var_dump($oFnp->id);exit;
$aFnpContent = json_decode($oFnp->content ?? '[]', true); // 有问题吗
$iNodeCount = count($aFnpContent["v2ray"] ?? []) ?? rand(30, 98);
// $iNodeCount = rand(config("freenode.count_min"), config("freenode.count_max"));
$sContent = "本次更新共<span style='color:pink'>".$iNodeCount."</span>个可用节点,最高速度".$iNodeSpeed."M/S。
覆盖".$sNodeZone."等多个区域。
复制下方的v2ray/clash订阅链接在客户端添加即可正常使用。";
return $sContent;
}
}