作者 赵彬吉

update

<?php
namespace App\Console\Commands\RankData;
use App\Helper\Arr;
use App\Utils\HttpUtils;
use GuzzleHttp\Exception\GuzzleException;
use Illuminate\Console\Command;
class updateAiProjects extends Command
{
protected $signature = 'updateAiProjects';
protected $description = '更新AI站点域名数据';
public function handle()
{
$api_url = 'https://demosite5.globalso.com/api/domain';
try {
$data = HttpUtils::get($api_url, []);
if ($data) {
$data = Arr::s2a($data);
$file_path = public_path('ai_domains.txt');
file_put_contents($file_path, json_encode($data['data']));
}
} catch (\Exception | GuzzleException $e) {
errorLog('AI站点项目获取失败', [], $e);
return false;
}
}
}
... ...
... ... @@ -40,6 +40,9 @@ class Kernel extends ConsoleKernel
$schedule->command('delete_template_log')->monthlyOn(15, '00:01')->withoutOverlapping();
// 每日推送已完成视频任务项目生成对应界面
$schedule->command('notice_c')->dailyAt('04:00')->withoutOverlapping(1);
//更新AI站点数据
$schedule->command('updateAiProjects')->everyFourHours()->withoutOverlapping(1);
}
/**
... ...