cfn/app/Services/Tg/Hook/Mod/Test.php
2025-12-19 17:38:00 +08:00

66 lines
1.8 KiB
PHP

<?php
namespace App\Services\Tg\Hook\Mod;
//use App\Services\TomTool\Http;
use App\Models\Option as ModelOption;
use App\Models\ArticleList;
class Test extends Base {
public function Cron($aParam)
{
$sTimeType = $aParam["aOption"][1];
$sValue = $aParam["aArg"][1];
$this->oHttp->sMethod = "get";
$this->oHttp->sToUrl = env("APP_URL")."/exec/cron";
$this->oHttp->bIsJson = true;
$this->oHttp->aData = [
"is_test" => true,
"time_type" => $sTimeType,
"v" => $sValue
];
$r = $this->oHttp->send();
return $r;
}
// 重新生成今天文章
public function ReToday()
{
// 先删除今日
$sCode = date("Ymd");
ArticleList::where("code", $sCode)->delete();
$this->oHttp->sMethod = "get";
$this->oHttp->sToUrl = env("APP_URL")."/exec/freenode/up";
$this->oHttp->bIsJson = true;
// $this->oHttp->aData = [];
$r = $this->oHttp->send();
return $r;
}
public function FreenodeCrawUrl()
{
$aOption = ModelOption::_all();
$sTimeSet = 0;
$sTimeStart = strtotime($sTimeSet." day");
$sTimeNextDay = strtotime(($sTimeSet+1)." day");
$sTimeNext10Day = strtotime(($sTimeSet+10)." day");
$sTimePrevDay = strtotime(($sTimeSet-1)." day");
$sDateStartCode = date("Ymd", $sTimeStart);
$sDateNextDayCode = date("Ymd", $sTimeNextDay);
$sDateNext10DayCode = date("Ymd", $sTimeNext10Day);
$sUrl = $aOption["freenode_craw_url"].date('Y', $sTimeStart)."/".date('m', $sTimeStart)."/".$sDateStartCode.".txt";
return $sUrl;
}
}