Merge branch 'master' of http://47.244.231.31:8099/zhl/globalso-v6
正在显示
4 个修改的文件
包含
18 行增加
和
32 行删除
| @@ -79,7 +79,7 @@ class HtmlCollect extends Command | @@ -79,7 +79,7 @@ class HtmlCollect extends Command | ||
| 79 | $web_url_domain = $collect_info->domain; | 79 | $web_url_domain = $collect_info->domain; |
| 80 | $home_url = $collect_info->domain; | 80 | $home_url = $collect_info->domain; |
| 81 | $url_web_config = 'https://' . $collect_info->domain . '/wp-content/cache/user_config.text'; | 81 | $url_web_config = 'https://' . $collect_info->domain . '/wp-content/cache/user_config.text'; |
| 82 | - $data_config = http_get($url_web_config, ['charset' => 'UTF-8']); | 82 | + $data_config = curl_c($url_web_config); |
| 83 | if ($data_config) { | 83 | if ($data_config) { |
| 84 | $web_url_arr = parse_url($data_config['web_url_domain'] ?? ''); | 84 | $web_url_arr = parse_url($data_config['web_url_domain'] ?? ''); |
| 85 | if (isset($web_url_arr['host'])) { | 85 | if (isset($web_url_arr['host'])) { |
| @@ -94,20 +94,11 @@ class HtmlCollect extends Command | @@ -94,20 +94,11 @@ class HtmlCollect extends Command | ||
| 94 | 94 | ||
| 95 | //采集html页面,下载资源到本地并替换 | 95 | //采集html页面,下载资源到本地并替换 |
| 96 | try { | 96 | try { |
| 97 | - $opts = [ | ||
| 98 | - 'http' => [ | ||
| 99 | - 'header' => 'User-Agent:Mozilla/5.0 (Windows NT 6.2; WOW64; rv:32.0) Gecko/20100101 Firefox/32.0' | ||
| 100 | - ], | ||
| 101 | - 'ssl' => [ | ||
| 102 | - 'verify_peer' => false, | ||
| 103 | - 'verify_peer_name' => false, | ||
| 104 | - ] | ||
| 105 | - ]; | ||
| 106 | - $html = file_get_contents('https://' . $collect_info->domain . $collect_info->route, false, stream_context_create($opts)); | 97 | + $html = curl_c('https://' . $collect_info->domain . $collect_info->route, false); |
| 107 | $source_list = $this->html_preg($html, $project_id, $collect_info->domain, $web_url_domain, $home_url); | 98 | $source_list = $this->html_preg($html, $project_id, $collect_info->domain, $web_url_domain, $home_url); |
| 108 | 99 | ||
| 109 | if ($source_list) { | 100 | if ($source_list) { |
| 110 | - $html = $this->upload_source($html, $source_list, $project_id, $opts); | 101 | + $html = $this->upload_source($html, $source_list, $project_id); |
| 111 | } | 102 | } |
| 112 | } catch (\Exception $e) { | 103 | } catch (\Exception $e) { |
| 113 | $collect_info->status = CollectTask::STATUS_FAIL; | 104 | $collect_info->status = CollectTask::STATUS_FAIL; |
| @@ -280,7 +271,7 @@ class HtmlCollect extends Command | @@ -280,7 +271,7 @@ class HtmlCollect extends Command | ||
| 280 | } | 271 | } |
| 281 | 272 | ||
| 282 | //下载并替换资源 | 273 | //下载并替换资源 |
| 283 | - protected function upload_source($html, $source, $project_id, $opts) | 274 | + protected function upload_source($html, $source, $project_id) |
| 284 | { | 275 | { |
| 285 | foreach ($source as $vs) { | 276 | foreach ($source as $vs) { |
| 286 | 277 | ||
| @@ -298,7 +289,7 @@ class HtmlCollect extends Command | @@ -298,7 +289,7 @@ class HtmlCollect extends Command | ||
| 298 | 289 | ||
| 299 | if (substr($new_source, -3, 3) == 'css') { | 290 | if (substr($new_source, -3, 3) == 'css') { |
| 300 | // 下载css文件中的资源 | 291 | // 下载css文件中的资源 |
| 301 | - $css_html = file_get_contents($vs['url_complete'], false, stream_context_create($opts)); | 292 | + $css_html = curl_c($vs['url_complete'], false); |
| 302 | preg_match_all("/url\(['\"](\s*[^>]+?)['\"]\)/i", $css_html, $result_css_source); | 293 | preg_match_all("/url\(['\"](\s*[^>]+?)['\"]\)/i", $css_html, $result_css_source); |
| 303 | $css_source = $result_css_source[1] ?? []; | 294 | $css_source = $result_css_source[1] ?? []; |
| 304 | 295 |
| @@ -58,11 +58,13 @@ class UpdateRoute extends Command | @@ -58,11 +58,13 @@ class UpdateRoute extends Command | ||
| 58 | foreach ($lists as $k => $v){ | 58 | foreach ($lists as $k => $v){ |
| 59 | echo date('Y-m-d H:i:s') . ' start: 项目id为' . $v['id'] . PHP_EOL; | 59 | echo date('Y-m-d H:i:s') . ' start: 项目id为' . $v['id'] . PHP_EOL; |
| 60 | ProjectServer::useProject($v['id']); | 60 | ProjectServer::useProject($v['id']); |
| 61 | - $this->setProductRoute($v['id']); | 61 | + $routeMapModel = new RouteMap(); |
| 62 | + $routeMapModel->del(['source'=>'blog_category']); | ||
| 63 | +// $this->setProductRoute($v['id']); | ||
| 62 | // $this->setProductKeywordRoute($v['id']); | 64 | // $this->setProductKeywordRoute($v['id']); |
| 63 | // $this->setBlogRoute($v['id']); | 65 | // $this->setBlogRoute($v['id']); |
| 64 | // $this->setNewsRoute($v['id']); | 66 | // $this->setNewsRoute($v['id']); |
| 65 | -// $this->setBlogCateRoute($v['id']); | 67 | + $this->setBlogCateRoute($v['id']); |
| 66 | // $this->setNewsCateRoute($v['id']); | 68 | // $this->setNewsCateRoute($v['id']); |
| 67 | DB::disconnect('custom_mysql'); | 69 | DB::disconnect('custom_mysql'); |
| 68 | } | 70 | } |
| @@ -194,11 +196,13 @@ class UpdateRoute extends Command | @@ -194,11 +196,13 @@ class UpdateRoute extends Command | ||
| 194 | public function setProductKeywordRoute($project_id){ | 196 | public function setProductKeywordRoute($project_id){ |
| 195 | $keywordModel = new Keyword(); | 197 | $keywordModel = new Keyword(); |
| 196 | $keywordList = $keywordModel->list([],'id',['id','route']); | 198 | $keywordList = $keywordModel->list([],'id',['id','route']); |
| 197 | - foreach ($keywordList as $v){ | ||
| 198 | - if(!ends_with($v['route'],'-tag')){ | ||
| 199 | - $route = $v['route'].'-tag'; | ||
| 200 | - $keywordModel->edit(['route'=>$route],['id'=>$v['id']]); | ||
| 201 | - RouteMap::setRoute($route, RouteMap::SOURCE_BLOG_CATE, $v['id'], $project_id); | 199 | + if(!empty($keywordList)){ |
| 200 | + foreach ($keywordList as $v){ | ||
| 201 | + if(!ends_with($v['route'],'-tag')){ | ||
| 202 | + $route = $v['route'].'-tag'; | ||
| 203 | + $keywordModel->edit(['route'=>$route],['id'=>$v['id']]); | ||
| 204 | + RouteMap::setRoute($route, RouteMap::SOURCE_PRODUCT_KEYWORD, $v['id'], $project_id); | ||
| 205 | + } | ||
| 202 | } | 206 | } |
| 203 | } | 207 | } |
| 204 | return true; | 208 | return true; |
| @@ -32,7 +32,7 @@ class BTemplateModuleController extends BaseController | @@ -32,7 +32,7 @@ class BTemplateModuleController extends BaseController | ||
| 32 | $moduleProjectModel = new BModuleProject(); | 32 | $moduleProjectModel = new BModuleProject(); |
| 33 | $module_list = $moduleProjectModel->list(['project_id'=>$this->user['project_id']]); | 33 | $module_list = $moduleProjectModel->list(['project_id'=>$this->user['project_id']]); |
| 34 | $data['module_list'] = $module_list; | 34 | $data['module_list'] = $module_list; |
| 35 | - $this->response('success',Code::SUCCESS,$data); | 35 | + $this->response('success',Code::SUCCESS,$list); |
| 36 | } | 36 | } |
| 37 | 37 | ||
| 38 | /** | 38 | /** |
| @@ -95,17 +95,8 @@ class CosService | @@ -95,17 +95,8 @@ class CosService | ||
| 95 | ], | 95 | ], |
| 96 | ]); | 96 | ]); |
| 97 | 97 | ||
| 98 | - $opts = [ | ||
| 99 | - 'http' => [ | ||
| 100 | - 'header' => 'User-Agent:Mozilla/5.0 (Windows NT 6.2; WOW64; rv:32.0) Gecko/20100101 Firefox/32.0' | ||
| 101 | - ], | ||
| 102 | - 'ssl' => [ | ||
| 103 | - 'verify_peer' => false, | ||
| 104 | - 'verify_peer_name' => false, | ||
| 105 | - ] | ||
| 106 | - ]; | ||
| 107 | try { | 98 | try { |
| 108 | - $body = file_get_contents($file_url,false,stream_context_create($opts)); | 99 | + $body = curl_c($file_url,false); |
| 109 | }catch (\Exception $e){ | 100 | }catch (\Exception $e){ |
| 110 | return ''; | 101 | return ''; |
| 111 | } | 102 | } |
-
请 注册 或 登录 后发表评论