no message
This commit is contained in:
parent
57863e1a71
commit
cddcedcb79
@ -21,62 +21,62 @@ final class NasaTestFnSubfile
|
||||
$sDateCode = date("Ymd");
|
||||
// $sDateCode = "20260211"; // test
|
||||
$sDateToday = date("Y-m-d");
|
||||
$sDateToday = "2026-02-26";
|
||||
// $sDateToday = "2026-02-26";
|
||||
$aFnClients = FreenodeHelperService::getClients();
|
||||
|
||||
$oNodeBus = SiteMap::where("group_code", "nodehub")->first();
|
||||
$cFnSite = SiteMap::whereIn("group_code", ["fn_b"])->get(); // a系列逐渐抛弃
|
||||
|
||||
// foreach ($cFnSite as $oFnSite) {
|
||||
//
|
||||
// // model
|
||||
// $oTestSubfile = TestSubfile::where("site_code", $oFnSite->code_short)->whereDate("created_at", $sDateToday)->first();
|
||||
//
|
||||
// if (!$oTestSubfile) {
|
||||
// $oTestSubfile = new TestSubfile();
|
||||
// $oTestSubfile->site_code = $oFnSite->code_short;
|
||||
// }
|
||||
//
|
||||
// // 页面监测
|
||||
// $sUrlHtml = "https://".$oFnSite->url."/a/fn".$sDateCode.".html";
|
||||
// $oResponse = Http::withoutVerifying()->get($sUrlHtml); // 不验证ssl
|
||||
// $iHttpStatus = $oResponse->status() ?? 0;
|
||||
//
|
||||
// if ($iHttpStatus != 200) {
|
||||
// TeleSlave::warn()->send("运行监测-fn_b:有页面未获取成功");
|
||||
// }
|
||||
//
|
||||
// $oTestSubfile->status_http_page = $iHttpStatus;
|
||||
//
|
||||
// // subfile监测
|
||||
// foreach ($aFnClients as $sFnClient) {
|
||||
// $sUrlSubFile = FreenodeHelperService::urlFeedToday($oFnSite->code_short, $sFnClient);
|
||||
// $oResponse = Http::timeout(60)
|
||||
// ->withoutVerifying()
|
||||
// ->withHeaders([
|
||||
// 'User-Agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36',
|
||||
// 'Accept' => 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
|
||||
// 'Accept-Language' => 'zh-CN,zh;q=0.9,en;q=0.8',
|
||||
// ])
|
||||
// ->get($sUrlSubFile);
|
||||
//
|
||||
// $iHttpStatus = $oResponse->status() ?? 0;
|
||||
//
|
||||
// $sBody = $iHttpStatus;
|
||||
//
|
||||
// if ($iHttpStatus == 200) {
|
||||
// $sBody = $oResponse->body();
|
||||
// } else {
|
||||
// TeleSlave::warn()->send("运行监测-fn_b:有subfile未获取成功");
|
||||
// }
|
||||
//
|
||||
// $oTestSubfile->{$sFnClient."_url"} = "https://".$sUrlSubFile;
|
||||
// $oTestSubfile->{$sFnClient."_content"} = $sBody;
|
||||
// }
|
||||
//
|
||||
// $oTestSubfile->save();
|
||||
//
|
||||
// }
|
||||
foreach ($cFnSite as $oFnSite) {
|
||||
|
||||
// model
|
||||
$oTestSubfile = TestSubfile::where("site_code", $oFnSite->code_short)->whereDate("created_at", $sDateToday)->first();
|
||||
|
||||
if (!$oTestSubfile) {
|
||||
$oTestSubfile = new TestSubfile();
|
||||
$oTestSubfile->site_code = $oFnSite->code_short;
|
||||
}
|
||||
|
||||
// 页面监测
|
||||
$sUrlHtml = "https://".$oFnSite->url."/a/fn".$sDateCode.".html";
|
||||
$oResponse = Http::withoutVerifying()->get($sUrlHtml); // 不验证ssl
|
||||
$iHttpStatus = $oResponse->status() ?? 0;
|
||||
|
||||
if ($iHttpStatus != 200) {
|
||||
TeleSlave::warn()->send("运行监测-fn_b:有页面未获取成功");
|
||||
}
|
||||
|
||||
$oTestSubfile->status_http_page = $iHttpStatus;
|
||||
|
||||
// subfile监测
|
||||
foreach ($aFnClients as $sFnClient) {
|
||||
$sUrlSubFile = FreenodeHelperService::urlFeedToday($oFnSite->code_short, $sFnClient);
|
||||
$oResponse = Http::timeout(60)
|
||||
->withoutVerifying()
|
||||
->withHeaders([
|
||||
'User-Agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36',
|
||||
'Accept' => 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
|
||||
'Accept-Language' => 'zh-CN,zh;q=0.9,en;q=0.8',
|
||||
])
|
||||
->get($sUrlSubFile);
|
||||
|
||||
$iHttpStatus = $oResponse->status() ?? 0;
|
||||
|
||||
$sBody = $iHttpStatus;
|
||||
|
||||
if ($iHttpStatus == 200) {
|
||||
$sBody = $oResponse->body();
|
||||
} else {
|
||||
TeleSlave::warn()->send("运行监测-fn_b:有subfile未获取成功");
|
||||
}
|
||||
|
||||
$oTestSubfile->{$sFnClient."_url"} = "https://".$sUrlSubFile;
|
||||
$oTestSubfile->{$sFnClient."_content"} = $sBody;
|
||||
}
|
||||
|
||||
$oTestSubfile->save();
|
||||
|
||||
}
|
||||
|
||||
//// _admin
|
||||
|
||||
@ -90,12 +90,14 @@ final class NasaTestFnSubfile
|
||||
foreach ($aFnClients as $sFnClient) {
|
||||
|
||||
$sFilePath = $_ENV["dir_base"]."public/freenode/merge/_admin/".$sFnClient."/".$sDateToday.".txt";
|
||||
$file = file_get_contents($sFilePath);
|
||||
|
||||
|
||||
if (!file_exists($sFilePath)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$file = file_get_contents($sFilePath);
|
||||
|
||||
|
||||
$oTestSubfile->{$sFnClient."_url"} = $sFilePath;
|
||||
$oTestSubfile->{$sFnClient."_content"} = $file;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user