作者 赵彬吉

update

... ... @@ -531,24 +531,12 @@ class OptimizationReportController extends BaseController
*/
public function getAiProjects($domain = null)
{
$key = 'ai_projects_list';
$data = Cache::get($key);
if (!$data) {
$api_url = 'https://demosite5.globalso.com/api/domain';
try {
$data = HttpUtils::get($api_url, []);
if ($data) {
$data = Arr::s2a($data);
Cache::put($key, $data, 4 * 3600);
}
} catch (\Exception | GuzzleException $e) {
errorLog('AI站点项目获取失败', [], $e);
return false;
}
}
$file_path = public_path('ai_domains.txt');
$data = file_get_contents($file_path);
$data = json_decode($data, true);
if ($domain !== null) {
$domain = parse_url($domain);
$data = collect($data['data'])->where('bind_domain', $domain['host'] ?? $domain['path'])->first();
$data = collect($data)->where('bind_domain', $domain['host'] ?? $domain['path'])->first();
return $data ?: [];
}
return $data;
... ...