作者 刘锟

update

@@ -11,6 +11,7 @@ use App\Services\ProjectServer; @@ -11,6 +11,7 @@ use App\Services\ProjectServer;
11 use Illuminate\Console\Command; 11 use Illuminate\Console\Command;
12 use Illuminate\Support\Facades\Cache; 12 use Illuminate\Support\Facades\Cache;
13 use Illuminate\Support\Facades\DB; 13 use Illuminate\Support\Facades\DB;
  14 +use Illuminate\Support\Facades\Log;
14 use Illuminate\Support\Facades\Redis; 15 use Illuminate\Support\Facades\Redis;
15 16
16 /** 17 /**
@@ -40,7 +41,7 @@ class HtmlCollect extends Command @@ -40,7 +41,7 @@ class HtmlCollect extends Command
40 public function handle() 41 public function handle()
41 { 42 {
42 // while (true) { 43 // while (true) {
43 - $this->start_collect(); 44 + $this->start_collect();
44 // } 45 // }
45 } 46 }
46 47
@@ -91,7 +92,15 @@ class HtmlCollect extends Command @@ -91,7 +92,15 @@ class HtmlCollect extends Command
91 return true; 92 return true;
92 } 93 }
93 94
94 - $source_list = $this->html_preg($html, $project_id, $collect_info->domain, $old_info['web_url_domain'], $old_info['home_url']); 95 + //如果有base64图片,先替换掉,再进行资源匹配
  96 + $new_html = $html;
  97 + preg_match_all("/data:([^;]*);base64,(.*)?\"/", $new_html, $result_img);
  98 + $img_base64 = $result_img[2] ?? [];
  99 + foreach ($img_base64 as $v64) {
  100 + $new_html = str_replace($v64, '', $new_html);
  101 + }
  102 +
  103 + $source_list = $this->html_preg($new_html, $project_id, $collect_info->domain, $old_info['web_url_domain'], $old_info['home_url']);
95 104
96 if ($source_list) { 105 if ($source_list) {
97 $html = $this->upload_source($html, $source_list, $project_id); 106 $html = $this->upload_source($html, $source_list, $project_id);