作者 刘锟

合并分支 'akun' 到 'master'

Akun



查看合并请求 !166
@@ -416,7 +416,36 @@ class HtmlCollect extends Command @@ -416,7 +416,36 @@ class HtmlCollect extends Command
416 CosService::uploadRemote($project_id, 'source', $new_source, $new_source, $js_html); 416 CosService::uploadRemote($project_id, 'source', $new_source, $new_source, $js_html);
417 } 417 }
418 } 418 }
419 - } else { 419 + } elseif(substr($vs['url_complete'], -2, 2) == 'js') {
  420 +
  421 + $js_html = curl_c(getImageUrl($vs['url_complete']), false);
  422 + preg_match_all("/[large|thumb]+URL:['\"]+(\s*[^>]+?)['\"]+,/i", $js_html, $result_js_source);
  423 + $js_source = $result_js_source[1] ?? [];
  424 + foreach ($js_source as $vjs) {
  425 + $vjs_result = $this->url_check($vjs, $project_id, $domain, $web_url_domain, $home_url);
  426 + if (!$vjs_result) {
  427 + continue;
  428 + }
  429 +
  430 + if ($vjs_result['download']) {
  431 + $new_vjs = CosService::uploadRemote($project_id, 'source', $vjs_result['url_complete']);
  432 + if ($new_vjs) {
  433 + CollectSource::insert([
  434 + 'project_id' => $project_id,
  435 + 'origin' => $vjs_result['url'],
  436 + 'target' => $new_vjs,
  437 + 'created_at' => date('Y-m-d H:i:s'),
  438 + 'updated_at' => date('Y-m-d H:i:s'),
  439 + ]);
  440 + $js_html = str_replace($vjs, getImageUrl($new_vjs), $js_html);
  441 + }
  442 + } else {
  443 + $js_html = str_replace($vjs, getImageUrl($vjs_result['url_complete']), $js_html);
  444 + }
  445 + }
  446 +
  447 + CosService::uploadRemote($project_id, 'source', $vs['url_complete'], $vs['url_complete'], $js_html);
  448 + }else{
420 $html = str_replace($vs['url'], getImageUrl($vs['url_complete']), $html); 449 $html = str_replace($vs['url'], getImageUrl($vs['url_complete']), $html);
421 } 450 }
422 } 451 }