正在显示
3 个修改的文件
包含
16 行增加
和
11 行删除
| @@ -100,7 +100,7 @@ class HtmlCollect extends Command | @@ -100,7 +100,7 @@ class HtmlCollect extends Command | ||
| 100 | //关闭数据库 | 100 | //关闭数据库 |
| 101 | DB::disconnect('custom_mysql'); | 101 | DB::disconnect('custom_mysql'); |
| 102 | 102 | ||
| 103 | - sleep(2); | 103 | + return true; |
| 104 | } | 104 | } |
| 105 | 105 | ||
| 106 | //获取任务 | 106 | //获取任务 |
| @@ -155,6 +155,7 @@ class HtmlCollect extends Command | @@ -155,6 +155,7 @@ class HtmlCollect extends Command | ||
| 155 | 155 | ||
| 156 | if ($complete) { | 156 | if ($complete) { |
| 157 | $update_log->collect_status = UpdateLog::COLLECT_STATUS_MAIN; | 157 | $update_log->collect_status = UpdateLog::COLLECT_STATUS_MAIN; |
| 158 | + $update_log->save(); | ||
| 158 | return 0; | 159 | return 0; |
| 159 | } | 160 | } |
| 160 | 161 | ||
| @@ -223,11 +224,12 @@ class HtmlCollect extends Command | @@ -223,11 +224,12 @@ class HtmlCollect extends Command | ||
| 223 | $scheme = $arr['scheme'] ?? ''; | 224 | $scheme = $arr['scheme'] ?? ''; |
| 224 | $host = $arr['host'] ?? ''; | 225 | $host = $arr['host'] ?? ''; |
| 225 | $path = $arr['path'] ?? ''; | 226 | $path = $arr['path'] ?? ''; |
| 227 | + $query = $arr['query'] ?? ''; | ||
| 226 | 228 | ||
| 227 | if ( | 229 | if ( |
| 228 | - (empty($host) || $host == $domain) | ||
| 229 | - && $path | ||
| 230 | - && (strpos($path, '.') !== false) | 230 | + (strpos($host, '.globalso.') === false) && |
| 231 | + (strpos($host, '.goodao.') === false) && | ||
| 232 | + $path && (strpos($path, '.') !== false) | ||
| 231 | ) { | 233 | ) { |
| 232 | 234 | ||
| 233 | $source = CollectSource::where('project_id', $project_id)->where('origin', $url)->first(); | 235 | $source = CollectSource::where('project_id', $project_id)->where('origin', $url)->first(); |
| @@ -235,7 +237,7 @@ class HtmlCollect extends Command | @@ -235,7 +237,7 @@ class HtmlCollect extends Command | ||
| 235 | return [ | 237 | return [ |
| 236 | 'download' => true, | 238 | 'download' => true, |
| 237 | 'url' => $url, | 239 | 'url' => $url, |
| 238 | - 'url_complete' => ($scheme ?: 'https') . '://' . ($host ?: $domain) . $path | 240 | + 'url_complete' => ($scheme ?: 'https') . '://' . ($host ?: $domain) . $path . ($query ? '?' . $query : '') |
| 239 | ]; | 241 | ]; |
| 240 | } else { | 242 | } else { |
| 241 | return [ | 243 | return [ |
| @@ -100,7 +100,7 @@ class HtmlLanguageCollect extends Command | @@ -100,7 +100,7 @@ class HtmlLanguageCollect extends Command | ||
| 100 | //关闭数据库 | 100 | //关闭数据库 |
| 101 | DB::disconnect('custom_mysql'); | 101 | DB::disconnect('custom_mysql'); |
| 102 | 102 | ||
| 103 | - sleep(2); | 103 | + return true; |
| 104 | } | 104 | } |
| 105 | 105 | ||
| 106 | //获取任务 | 106 | //获取任务 |
| @@ -155,6 +155,7 @@ class HtmlLanguageCollect extends Command | @@ -155,6 +155,7 @@ class HtmlLanguageCollect extends Command | ||
| 155 | 155 | ||
| 156 | if ($complete) { | 156 | if ($complete) { |
| 157 | $update_log->collect_status = UpdateLog::COLLECT_STATUS_COM; | 157 | $update_log->collect_status = UpdateLog::COLLECT_STATUS_COM; |
| 158 | + $update_log->save(); | ||
| 158 | return 0; | 159 | return 0; |
| 159 | } | 160 | } |
| 160 | 161 | ||
| @@ -223,11 +224,12 @@ class HtmlLanguageCollect extends Command | @@ -223,11 +224,12 @@ class HtmlLanguageCollect extends Command | ||
| 223 | $scheme = $arr['scheme'] ?? ''; | 224 | $scheme = $arr['scheme'] ?? ''; |
| 224 | $host = $arr['host'] ?? ''; | 225 | $host = $arr['host'] ?? ''; |
| 225 | $path = $arr['path'] ?? ''; | 226 | $path = $arr['path'] ?? ''; |
| 227 | + $query = $arr['query'] ?? ''; | ||
| 226 | 228 | ||
| 227 | if ( | 229 | if ( |
| 228 | - (empty($host) || $host == $domain) | ||
| 229 | - && $path | ||
| 230 | - && (strpos($path, '.') !== false) | 230 | + (strpos($host, '.globalso.') === false) && |
| 231 | + (strpos($host, '.goodao.') === false) && | ||
| 232 | + $path && (strpos($path, '.') !== false) | ||
| 231 | ) { | 233 | ) { |
| 232 | 234 | ||
| 233 | $source = CollectSource::where('project_id', $project_id)->where('origin', $url)->first(); | 235 | $source = CollectSource::where('project_id', $project_id)->where('origin', $url)->first(); |
| @@ -235,7 +237,7 @@ class HtmlLanguageCollect extends Command | @@ -235,7 +237,7 @@ class HtmlLanguageCollect extends Command | ||
| 235 | return [ | 237 | return [ |
| 236 | 'download' => true, | 238 | 'download' => true, |
| 237 | 'url' => $url, | 239 | 'url' => $url, |
| 238 | - 'url_complete' => ($scheme ?: 'https') . '://' . ($host ?: $domain) . $path | 240 | + 'url_complete' => ($scheme ?: 'https') . '://' . ($host ?: $domain) . $path . ($query ? '?' . $query : '') |
| 239 | ]; | 241 | ]; |
| 240 | } else { | 242 | } else { |
| 241 | return [ | 243 | return [ |
| @@ -76,7 +76,8 @@ class CosService | @@ -76,7 +76,8 @@ class CosService | ||
| 76 | public static function uploadRemote($project_id,$image_type,$file_url,$key='') | 76 | public static function uploadRemote($project_id,$image_type,$file_url,$key='') |
| 77 | { | 77 | { |
| 78 | if(!$key){ | 78 | if(!$key){ |
| 79 | - $ext = explode('.',$file_url); | 79 | + $url_arr = parse_url($file_url); |
| 80 | + $ext = explode('.',$url_arr['path']); | ||
| 80 | 81 | ||
| 81 | $filename = uniqid().rand(10000,99999).'.'.end($ext); | 82 | $filename = uniqid().rand(10000,99999).'.'.end($ext); |
| 82 | 83 |
-
请 注册 或 登录 后发表评论