作者 赵彬吉

update

@@ -21,6 +21,7 @@ use App\Models\Inquiry\ReInquiryText; @@ -21,6 +21,7 @@ use App\Models\Inquiry\ReInquiryText;
21 use App\Models\Project\InquiryFilterConfig; 21 use App\Models\Project\InquiryFilterConfig;
22 use App\Models\Project\Project; 22 use App\Models\Project\Project;
23 use App\Models\WebSetting\WebLanguage; 23 use App\Models\WebSetting\WebLanguage;
  24 +use GuzzleHttp\Exception\ConnectException;
24 use Illuminate\Console\Command; 25 use Illuminate\Console\Command;
25 use Illuminate\Support\Arr; 26 use Illuminate\Support\Arr;
26 use Illuminate\Support\Facades\Cache; 27 use Illuminate\Support\Facades\Cache;
@@ -343,6 +344,12 @@ class RelayInquiry extends Command @@ -343,6 +344,12 @@ class RelayInquiry extends Command
343 } 344 }
344 $val->status = $res ? ReInquiryForm::STATUS_SUCCESS : ReInquiryForm::STATUS_FORGO; 345 $val->status = $res ? ReInquiryForm::STATUS_SUCCESS : ReInquiryForm::STATUS_FORGO;
345 $val->save(); 346 $val->save();
  347 + } catch (ConnectException $e) {
  348 + $val->status = ReInquiryForm::STATUS_FORGO;
  349 + $val->remark = mb_substr($e->getMessage(), 0, 200);
  350 + $val->save();
  351 + $this->logChannel()->info('执行询盘错误:',[$e->getMessage(), $e->getFile(), $e->getLine()]);
  352 + $this->output('执行询盘错误:' . $e->getMessage());
346 } catch (\Exception $e) { 353 } catch (\Exception $e) {
347 $this->logChannel()->info('执行询盘错误:',[$e->getMessage(), $e->getFile(), $e->getLine()]); 354 $this->logChannel()->info('执行询盘错误:',[$e->getMessage(), $e->getFile(), $e->getLine()]);
348 $this->output('执行询盘错误:' . $e->getMessage()); 355 $this->output('执行询盘错误:' . $e->getMessage());
@@ -860,7 +867,7 @@ class RelayInquiry extends Command @@ -860,7 +867,7 @@ class RelayInquiry extends Command
860 function getLinksFromSitemap($sitemapUrl) { 867 function getLinksFromSitemap($sitemapUrl) {
861 try { 868 try {
862 //忽略cert证书 先下载到临时文件 869 //忽略cert证书 先下载到临时文件
863 - $result = Http::withoutVerifying()->get($sitemapUrl)->body(); 870 + $result = Http::withoutVerifying()->timeout(30)->get($sitemapUrl)->body();
864 $tempFilePath = tempnam(sys_get_temp_dir(), 'remote_file_'); 871 $tempFilePath = tempnam(sys_get_temp_dir(), 'remote_file_');
865 file_put_contents($tempFilePath, $result); 872 file_put_contents($tempFilePath, $result);
866 $xml = simplexml_load_file($tempFilePath); 873 $xml = simplexml_load_file($tempFilePath);