60 lines
1.5 KiB
PHP
Executable File
60 lines
1.5 KiB
PHP
Executable File
<?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";
|
|
}
|
|
|
|
}
|