oTGHttp = new TGHttp(); $this->oTGHttp->sApiToken = env('telegram_token'); $this->oTGHttp->sApiChatId = env('telegram_chatid'); } public function index() { $h = date("H"); $i = date("i"); $s = date("s"); //// test $k = $_GET["k"] ?? false; $v = $_GET["v"] ?? false; if ($k == "h") { $h = $v; } else if ($k == "i") { $i = $v; } else if ($k == "k") { $s = $v; } // $h = "00"; //// test end if ($h == "00" && $i== "00") { $iFireWarningLine = ModelBookOption::_hit("fire_warning_line"); $sDateWarningLine = date("Y-m-d H:i:s", strtotime($iFireWarningLine."day")); $oBook = ModelBook::whereDate("fire", "<=", $sDateWarningLine)->where("fire_close", 0)->get(); if (!$oBook->isEmpty()) { $oDateNow = new \DateTime(); foreach ($oBook as $oBookRow) { $oDateRag = new \DateTime($oBookRow->fire); $iDiffDay = $oDateNow->diff($oDateRag)->days; if ($oDateNow > $oDateRag) { $iDiffDay = -$iDiffDay; } $sTgStr = "⚠️⚠️⚠️ {{ ".$oBookRow->rag." }} 还有 {{ ".$iDiffDay." }} 天到期 ⚠️⚠️⚠️"; $this->oTGHttp->sendToTG($sTgStr); } } } } }