106 lines
2.6 KiB
PHP
Executable File
106 lines
2.6 KiB
PHP
Executable File
<?php
|
|
|
|
namespace App\Services\Tg\Hook\Mod;
|
|
|
|
use App\Services\TomTool\Http;
|
|
use App\Services\Cron as ServicesCron;
|
|
use App\Services\Cron\HttpQueue as CronHttpQueue;
|
|
use App\Models\ArticleCacheTime as ModelArticleCacheTime;
|
|
|
|
class Cron extends Base {
|
|
|
|
public function testArticleSchema()
|
|
{
|
|
$oCacheTime = ModelArticleCacheTime::first();
|
|
$oCacheTime->time = strtotime('-10 days');
|
|
$oCacheTime->save();
|
|
|
|
$oServicesCron = new ServicesCron();
|
|
$oServicesCron->setTestH('01');
|
|
$oServicesCron->setTestI('03');
|
|
$oServicesCron->setTestS('00');
|
|
|
|
return $oServicesCron->run();
|
|
}
|
|
|
|
public function httpQueuePop()
|
|
{
|
|
$r = CronHttpQueue::pop();
|
|
return $r;
|
|
}
|
|
|
|
public function test($aParam)
|
|
{
|
|
|
|
$h = $aParam["aArg"][1] ?? 0;
|
|
$i = $aParam["aArg"][2] ?? 3;
|
|
$s = $aParam["aArg"][3] ?? 0;
|
|
|
|
if ($h == "?") {
|
|
return "#test [h:0] [i:3] [s:0]";
|
|
}
|
|
|
|
$oServicesCron = new ServicesCron();
|
|
|
|
$oServicesCron->setTestH($h);
|
|
$oServicesCron->setTestI($i);
|
|
$oServicesCron->setTestS($s);
|
|
|
|
return $oServicesCron->run();
|
|
}
|
|
|
|
// public function test($aParam)
|
|
// {
|
|
// $sType = $aParam["aOption"][1] ?? "i";
|
|
// $sValue = $aParam["aArg"][1] ?? "03";
|
|
//
|
|
// if (!$sType) {
|
|
// return "需要his之一";
|
|
// }
|
|
//
|
|
// if (!$sValue) {
|
|
// return "需要value";
|
|
// }
|
|
//
|
|
// if ($sValue == "?") {
|
|
// return "#test__[his] [value]";
|
|
// }
|
|
//
|
|
// $oServicesCron = new ServicesCron();
|
|
//
|
|
// $oServicesCron->setTestH('06');
|
|
// $oServicesCron->setTestI('03');
|
|
// $oServicesCron->setTestS('00');
|
|
//
|
|
// if ($sType == "h") {
|
|
// $oServicesCron->setTestH($sValue);
|
|
// } else if ($sType == "i") {
|
|
// $oServicesCron->setTestI($sValue);
|
|
// } else if ($sType == "s") {
|
|
// $oServicesCron->setTestS($sValue);
|
|
// }
|
|
//
|
|
// return $oServicesCron->run();
|
|
// }
|
|
|
|
public function testOld($aParam)
|
|
{
|
|
$sType = $aParam["aArg"][1] ?? false;
|
|
$sValue = $aParam["aArg"][2] ?? false;
|
|
|
|
$oHttp = new Http();
|
|
$oHttp->sMethod = "get";
|
|
$oHttp->bIsJson = true;
|
|
$oHttp->sToUrl = env("APP_URL")."/cron";
|
|
|
|
if ($sType && $sValue) {
|
|
$oHttp->aData = ["k" => $sType, "v" => $sValue];
|
|
}
|
|
|
|
$r = $oHttp->send();
|
|
|
|
return $r;
|
|
}
|
|
|
|
}
|