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(); // // } //// _admin $oTestSubfile = TestSubfile::where("site_code", "_admin")->whereDate("created_at", $sDateToday)->first(); if (!$oTestSubfile) { $oTestSubfile = new TestSubfile(); $oTestSubfile->site_code = "_admin"; } 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; } $oTestSubfile->{$sFnClient."_url"} = $sFilePath; $oTestSubfile->{$sFnClient."_content"} = $file; } $oTestSubfile->save(); // 删除超过30天的log $sDatePrev30 = date("Y-m-m", strtotime("-30 days")); TestSubfile::whereDate("created_at", "<", $sDatePrev30)->delete(); echo "\n 运行监测-fn_b done"; } }