|
|
|
<?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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} |
...
|
...
|
|