作者 赵彬吉

update

... ... @@ -21,6 +21,7 @@ use App\Models\Inquiry\ReInquiryText;
use App\Models\Project\InquiryFilterConfig;
use App\Models\Project\Project;
use App\Models\WebSetting\WebLanguage;
use GuzzleHttp\Exception\ConnectException;
use Illuminate\Console\Command;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Cache;
... ... @@ -343,6 +344,12 @@ class RelayInquiry extends Command
}
$val->status = $res ? ReInquiryForm::STATUS_SUCCESS : ReInquiryForm::STATUS_FORGO;
$val->save();
} catch (ConnectException $e) {
$val->status = ReInquiryForm::STATUS_FORGO;
$val->remark = mb_substr($e->getMessage(), 0, 200);
$val->save();
$this->logChannel()->info('执行询盘错误:',[$e->getMessage(), $e->getFile(), $e->getLine()]);
$this->output('执行询盘错误:' . $e->getMessage());
} catch (\Exception $e) {
$this->logChannel()->info('执行询盘错误:',[$e->getMessage(), $e->getFile(), $e->getLine()]);
$this->output('执行询盘错误:' . $e->getMessage());
... ... @@ -860,7 +867,7 @@ class RelayInquiry extends Command
function getLinksFromSitemap($sitemapUrl) {
try {
//忽略cert证书 先下载到临时文件
$result = Http::withoutVerifying()->get($sitemapUrl)->body();
$result = Http::withoutVerifying()->timeout(30)->get($sitemapUrl)->body();
$tempFilePath = tempnam(sys_get_temp_dir(), 'remote_file_');
file_put_contents($tempFilePath, $result);
$xml = simplexml_load_file($tempFilePath);
... ...