作者 刘锟

update

... ... @@ -11,6 +11,7 @@ use App\Services\ProjectServer;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Redis;
/**
... ... @@ -40,7 +41,7 @@ class HtmlCollect extends Command
public function handle()
{
// while (true) {
$this->start_collect();
$this->start_collect();
// }
}
... ... @@ -91,7 +92,15 @@ class HtmlCollect extends Command
return true;
}
$source_list = $this->html_preg($html, $project_id, $collect_info->domain, $old_info['web_url_domain'], $old_info['home_url']);
//如果有base64图片,先替换掉,再进行资源匹配
$new_html = $html;
preg_match_all("/data:([^;]*);base64,(.*)?\"/", $new_html, $result_img);
$img_base64 = $result_img[2] ?? [];
foreach ($img_base64 as $v64) {
$new_html = str_replace($v64, '', $new_html);
}
$source_list = $this->html_preg($new_html, $project_id, $collect_info->domain, $old_info['web_url_domain'], $old_info['home_url']);
if ($source_list) {
$html = $this->upload_source($html, $source_list, $project_id);
... ...