no message

This commit is contained in:
hellcat 2026-01-04 20:32:12 +08:00
parent c05833fed9
commit 8b6b5e769b
4 changed files with 115 additions and 29 deletions

View File

@ -15,6 +15,7 @@ namespace App\Services;
//use App\Services\Cron\ArticleSchema as CronArticleSchema;
//use App\Services\TomTool\Telegram\Slave as TeleSlave;
//use App\Services\Cron\FreenodeSync as CronFreenodeSync;
use App\Services\Cron\ArticleLive as CronArticleLive;
final class Cron
{
@ -39,35 +40,8 @@ final class Cron
echo "cron开始执行 \n";
if ($h % 8 === 0 && $i === 3) {
// CronBook::randbox_notify();
// CronFreenodeSync::
}
if ($h % 6 === 0 && $i === 3) {
// CronFreenodeCrawl::run();
// CronFreenodePool::save();
// CronFreenodeMerge::save();
// CronFreenodeMerge::baseToSite();
// CronFreenodeSync::run();
}
if ($i % 3 === 0) {
// CronArticleSchema::cacheTgSave();
// CronArticleSchema::pushToSlave();
// CronHttpQueue::pop();
}
if ($i === 0) {
// ReportSender::handle();
}
if ($h == 5 && $i === 3) {
// CronFreenodeFile::clear();
}
if ($h == 15 && $i == 3) {
// CronFreenodeLog::fromLast();
if ($h % 8 === 0 && $i === 10) {
CronArticleLive::client();
}
} catch (\Throwable $e) {

View File

@ -0,0 +1,59 @@
<?php
declare(strict_types=1);
namespace App\Services\Cron;
//use App\Models\CrawlFreenode as ModelCrawlFreenode;
use App\Services\TomTool\Telegram\Slave as TeleSlave;
//use App\Services\TomTool\Telegram\Master as TeleMaster;
//use App\Models\SiteMap as ModelSiteMap;
//use App\Services\TomTool\HttpV2;
//use Symfony\Component\Yaml\Yaml;
use App\Models\ArticleList as ModelArticle;
final class ArticleLive
{
private const TYPE_CLIENT = [
'ios',
'android',
'mac',
'win',
'linux',
];
public static function client()
{
echo "\n\nArticleLive::client() - 开始";
$iRandX = 10; // 期望每x天更新一篇
// $iRandX = 1; //// test
$iRand = rand(1, $iRandX);
if ($iRand !== 1) {
echo "\n - 未命中";
return false;
}
$oArticleClient = ModelArticle::whereIn("type", self::TYPE_CLIENT)->orderBy("updated_at", "asc")->first();
$sUpdatedAtOld = (string) $oArticleClient->updated_at;
$oArticleClient->updated_at = time();
$oArticleClient->save();
$aData["ArticleLive::client() - ok"] = [
"code" => $oArticleClient->code,
"title" => $oArticleClient->title,
"update_at" => (string) $oArticleClient->updated_at,
"update_at::old" => $sUpdatedAtOld,
];
tomd($aData);
TeleSlave::log()->enableSlaveQueue(false)->send($aData);
echo "\n - ok";
}
}

View File

@ -0,0 +1,51 @@
<?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;
class Cron extends Base {
public function httpQueuePop()
{
$r = CronHttpQueue::pop();
return $r;
}
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('10');
$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();
}
}

2
public/sub/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*
!.gitignore