作者 张关杰

Merge branch 'develop' of http://47.244.231.31:8099/zhl/globalso-v6 into bate

@@ -312,7 +312,7 @@ class ProjectUpdate extends Command @@ -312,7 +312,7 @@ class ProjectUpdate extends Command
312 } 312 }
313 313
314 //关联分类 314 //关联分类
315 - if($category_arr){ 315 + if ($category_arr) {
316 CategoryRelated::saveRelated($id, array_column($category_arr, 'id')); 316 CategoryRelated::saveRelated($id, array_column($category_arr, 'id'));
317 } 317 }
318 318
@@ -689,7 +689,7 @@ class ProjectUpdate extends Command @@ -689,7 +689,7 @@ class ProjectUpdate extends Command
689 $host = $arr['host'] ?? ''; 689 $host = $arr['host'] ?? '';
690 $path = $arr['path'] ?? ''; 690 $path = $arr['path'] ?? '';
691 691
692 - $url_complete = ($scheme ?: 'https') . '://' . ($host ?: $domain) . $path; 692 + $url_complete = ($scheme ?: 'https') . '://' . $domain . $path;
693 693
694 if ( 694 if (
695 (empty($scheme) || $scheme == 'https' || $scheme == 'http') 695 (empty($scheme) || $scheme == 'https' || $scheme == 'http')
@@ -54,12 +54,13 @@ class UpdateRoute extends Command @@ -54,12 +54,13 @@ class UpdateRoute extends Command
54 */ 54 */
55 public function handle(){ 55 public function handle(){
56 $projectModel = new Project(); 56 $projectModel = new Project();
57 - $list = $projectModel->list(['id'=>['in',[68]],'is_upgrade'=>0]); 57 + $list = $projectModel->list(['id'=>['in',[627]]]);
58 foreach ($list as $v){ 58 foreach ($list as $v){
59 echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; 59 echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
60 ProjectServer::useProject($v['id']); 60 ProjectServer::useProject($v['id']);
61 - $this->getProduct(); 61 +// $this->getProduct();
62 // $this->setProductKeyword(); 62 // $this->setProductKeyword();
  63 + $this->getRouteMap();
63 DB::disconnect('custom_mysql'); 64 DB::disconnect('custom_mysql');
64 } 65 }
65 echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; 66 echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
@@ -138,7 +139,22 @@ class UpdateRoute extends Command @@ -138,7 +139,22 @@ class UpdateRoute extends Command
138 } 139 }
139 } 140 }
140 141
141 - 142 + /**
  143 + * @remark :升级项目同步路由
  144 + * @name :getRouteMap
  145 + * @author :lyh
  146 + * @method :post
  147 + * @time :2024/1/4 11:53
  148 + */
  149 + public function getRouteMap(){
  150 + $routeMapModel = new RouteMap();
  151 + $list = $routeMapModel->list(['source'=>'product','project_id'=>627]);
  152 + foreach ($list as $k => $v){
  153 + $product = new Product();
  154 + $product->edit(['route'=>$v['route']],['id'=>$v['source_id']]);
  155 + echo date('Y-m-d H:i:s') . '产品id:'.$v['source_id'] . PHP_EOL;
  156 + }
  157 + }
142 158
143 /** 159 /**
144 * @remark :删除路由通知C端 160 * @remark :删除路由通知C端
@@ -154,4 +170,6 @@ class UpdateRoute extends Command @@ -154,4 +170,6 @@ class UpdateRoute extends Command
154 curlGet($url); 170 curlGet($url);
155 return true; 171 return true;
156 } 172 }
  173 +
  174 +
157 } 175 }
@@ -65,7 +65,7 @@ if (!function_exists('http_post')) { @@ -65,7 +65,7 @@ if (!function_exists('http_post')) {
65 curl_setopt($ch, CURLOPT_URL, $url); 65 curl_setopt($ch, CURLOPT_URL, $url);
66 curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); 66 curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
67 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); 67 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
68 - curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); 68 + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
69 curl_setopt($ch, CURLOPT_HTTPHEADER, $header); 69 curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
70 curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (compatible; MSIE 5.01; Windows NT 5.0)'); 70 curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (compatible; MSIE 5.01; Windows NT 5.0)');
71 curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); 71 curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
@@ -74,6 +74,8 @@ if (!function_exists('http_post')) { @@ -74,6 +74,8 @@ if (!function_exists('http_post')) {
74 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 74 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
75 $res = curl_exec($ch); 75 $res = curl_exec($ch);
76 if (curl_errno($ch)) { 76 if (curl_errno($ch)) {
  77 + $error_message = curl_error($ch);
  78 + @file_put_contents(storage_path('logs/lyh_error.log'), var_export($error_message, true) . PHP_EOL, FILE_APPEND);
77 @file_put_contents(storage_path('logs/lyh_error.log'), var_export($res, true) . PHP_EOL, FILE_APPEND); 79 @file_put_contents(storage_path('logs/lyh_error.log'), var_export($res, true) . PHP_EOL, FILE_APPEND);
78 } 80 }
79 curl_close($ch); 81 curl_close($ch);
@@ -87,14 +87,14 @@ class ProjectLogic extends BaseLogic @@ -87,14 +87,14 @@ class ProjectLogic extends BaseLogic
87 $info['deploy_build']['other_project']= json_decode($info['deploy_build']['other_project']); 87 $info['deploy_build']['other_project']= json_decode($info['deploy_build']['other_project']);
88 } 88 }
89 //升级项目采集完成时间 89 //升级项目采集完成时间
90 -// $collect_time = '';  
91 -// if($info['is_upgrade'] == 1){  
92 -// $collect_info = UpdateLog::where('project_id',$id)->where('api_type','blog')->first();  
93 -// if($collect_info){  
94 -// $collect_time = $collect_info->collect_status == 0 ? '采集中' : $collect_info->updated_at->format('Y-m-d H:i:s');  
95 -// }  
96 -// }  
97 -// $info['collect_time'] = $collect_time; 90 + $collect_time = '';
  91 + if($info['is_upgrade'] == 1){
  92 + $collect_info = UpdateLog::where('project_id',$id)->where('api_type','blog')->first();
  93 + if($collect_info){
  94 + $collect_time = $collect_info->collect_status == 0 ? '采集中' : $collect_info->updated_at->format('Y-m-d H:i:s');
  95 + }
  96 + }
  97 + $info['collect_time'] = $collect_time;
98 return $this->success($info); 98 return $this->success($info);
99 } 99 }
100 100
@@ -604,10 +604,6 @@ class BTemplateLogic extends BaseLogic @@ -604,10 +604,6 @@ class BTemplateLogic extends BaseLogic
604 $param['head_css'] = characterTruncation($param['html'],'/<style id="globalsojs-header">(.*?)<\/style>/s'); 604 $param['head_css'] = characterTruncation($param['html'],'/<style id="globalsojs-header">(.*?)<\/style>/s');
605 $param['main_css'] = characterTruncation($param['html'],'/<style id="globalsojs-styles">(.*?)<\/style>/s'); 605 $param['main_css'] = characterTruncation($param['html'],'/<style id="globalsojs-styles">(.*?)<\/style>/s');
606 $param['footer_css'] = characterTruncation($param['html'],'/<style id="globalsojs-footer">(.*?)<\/style>/s'); 606 $param['footer_css'] = characterTruncation($param['html'],'/<style id="globalsojs-footer">(.*?)<\/style>/s');
607 - if(!isset($param['is_custom'])){  
608 - $param['is_custom'] = BTemplate::IS_NO_CUSTOM;  
609 - }  
610 - $param['type'] = BTemplate::PAGE_HTML;//不显示整个HTML  
611 return $this->success($param); 607 return $this->success($param);
612 } 608 }
613 609