作者 张关杰

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

@@ -53,7 +53,6 @@ class HtmlCollect extends Command @@ -53,7 +53,6 @@ class HtmlCollect extends Command
53 53
54 protected function start_collect() 54 protected function start_collect()
55 { 55 {
56 - $tdk_project_ids = [714];  
57 $task_id = $this->get_task(); 56 $task_id = $this->get_task();
58 if ($task_id === false) { 57 if ($task_id === false) {
59 //所有项目采集完成 58 //所有项目采集完成
@@ -109,9 +108,7 @@ class HtmlCollect extends Command @@ -109,9 +108,7 @@ class HtmlCollect extends Command
109 } 108 }
110 109
111 //提取页面tdk 110 //提取页面tdk
112 - if(in_array($project_id,$tdk_project_ids)){  
113 $this->get_site_meta($new_html, $collect_info); 111 $this->get_site_meta($new_html, $collect_info);
114 - }  
115 112
116 $source_list = $this->html_preg($new_html, $project_id, $collect_info->domain, $old_info['web_url_domain'], $old_info['home_url']); 113 $source_list = $this->html_preg($new_html, $project_id, $collect_info->domain, $old_info['web_url_domain'], $old_info['home_url']);
117 114
@@ -218,7 +215,7 @@ class HtmlCollect extends Command @@ -218,7 +215,7 @@ class HtmlCollect extends Command
218 } 215 }
219 216
220 #Description 217 #Description
221 - preg_match_all('/<meta name=[\'|\"]description[\'|\"]\s+[^>]*?content=[\'|\"]([\w\W]*?)[\'|\"]/', $html, $matches); 218 + preg_match_all('/<meta\s+[^>]*?name=[\'|\"]description[\'|\"]\s+[^>]*?content=[\'|\"]([\w\W]*?)[\'|\"]/', $html, $matches);
222 if (!empty($matches[1])) { 219 if (!empty($matches[1])) {
223 $meta['description'] = substr($matches[1][0], 0, 255); 220 $meta['description'] = substr($matches[1][0], 0, 255);
224 } 221 }
@@ -55,10 +55,13 @@ class UpdateRoute extends Command @@ -55,10 +55,13 @@ class UpdateRoute extends Command
55 */ 55 */
56 public function handle(){ 56 public function handle(){
57 $projectModel = new Project(); 57 $projectModel = new Project();
58 - $list = $projectModel->list(['id'=>426]); 58 + $list = $projectModel->list(['id'=>433]);
  59 + $data = [];
59 foreach ($list as $v){ 60 foreach ($list as $v){
60 echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; 61 echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
61 ProjectServer::useProject($v['id']); 62 ProjectServer::useProject($v['id']);
  63 +// $this->delProductKeyword();
  64 +// $this->checkProduct($data,$v['id']);
62 // $this->getProduct(); 65 // $this->getProduct();
63 $this->setProductKeyword(); 66 $this->setProductKeyword();
64 // $this->getRouteMap(); 67 // $this->getRouteMap();
@@ -86,6 +89,18 @@ class UpdateRoute extends Command @@ -86,6 +89,18 @@ class UpdateRoute extends Command
86 } 89 }
87 } 90 }
88 91
  92 + public function delProductKeyword(){
  93 + $keywordModel = new Keyword();
  94 + $lists = $keywordModel->list(['status'=>1],'id',['id','title']);
  95 + foreach ($lists as $v){
  96 + echo date('Y-m-d H:i:s') . 'id:'.$v['id'] . PHP_EOL;
  97 + $info = $keywordModel->read(['id'=>['!=',$v['id'],'title'=>$v['title']]]);
  98 + if($info !== false){
  99 + $keywordModel->del(['id'=>$v['id']]);
  100 + }
  101 + }
  102 + }
  103 +
89 /** 104 /**
90 * @remark :写入 105 * @remark :写入
91 * @name :getProductKeyword 106 * @name :getProductKeyword
@@ -152,6 +167,7 @@ class UpdateRoute extends Command @@ -152,6 +167,7 @@ class UpdateRoute extends Command
152 $lists = $productModel->list(['status'=>1]); 167 $lists = $productModel->list(['status'=>1]);
153 if(!empty($lists)){ 168 if(!empty($lists)){
154 foreach ($lists as $v){ 169 foreach ($lists as $v){
  170 + if(!empty($v['route'])){
155 $tag = "-product"; 171 $tag = "-product";
156 if (!(substr($v['route'], -strlen($tag)) === $tag)) { 172 if (!(substr($v['route'], -strlen($tag)) === $tag)) {
157 echo date('Y-m-d H:i:s') . '拼接'.$tag . PHP_EOL; 173 echo date('Y-m-d H:i:s') . '拼接'.$tag . PHP_EOL;
@@ -159,6 +175,16 @@ class UpdateRoute extends Command @@ -159,6 +175,16 @@ class UpdateRoute extends Command
159 // 如果不是以 '-product' 结尾,则拼接上 '-product' 175 // 如果不是以 '-product' 结尾,则拼接上 '-product'
160 $route = RouteMap::setRoute($route, RouteMap::SOURCE_PRODUCT, $v['id'], $v['project_id']); 176 $route = RouteMap::setRoute($route, RouteMap::SOURCE_PRODUCT, $v['id'], $v['project_id']);
161 $productModel->edit(['route'=>$route],['id'=>$v['id']]); 177 $productModel->edit(['route'=>$route],['id'=>$v['id']]);
  178 + }else{
  179 +// echo date('Y-m-d H:i:s') . 'id :'.$v['id'] . PHP_EOL;
  180 +// $route = RouteMap::setRoute($v['title'], RouteMap::SOURCE_PRODUCT, $v['id'], $v['project_id']);
  181 +// $productModel->edit(['route'=>$route],['id'=>$v['id']]);
  182 + }
  183 + }else{
  184 + echo date('Y-m-d H:i:s') . 'id :'.$v['id'] . PHP_EOL;
  185 +// $v['title'] = Translate::tran($v['title'], 'en');
  186 + $route = RouteMap::setRoute($v['title'], RouteMap::SOURCE_PRODUCT, $v['id'], $v['project_id']);
  187 + $productModel->edit(['route'=>$route],['id'=>$v['id']]);
162 } 188 }
163 } 189 }
164 } 190 }
@@ -317,7 +317,7 @@ class ProjectController extends BaseController @@ -317,7 +317,7 @@ class ProjectController extends BaseController
317 if($item['type'] != Project::TYPE_ZERO){ 317 if($item['type'] != Project::TYPE_ZERO){
318 $data = APublicModel::getNumByProjectId($item['id']); 318 $data = APublicModel::getNumByProjectId($item['id']);
319 } 319 }
320 - $manageModel = new Manage(); 320 + $manageModel = new ManageHr();
321 $item['channel'] = Channel::getChannelText($item['channel']['user_id'] ?? 0); 321 $item['channel'] = Channel::getChannelText($item['channel']['user_id'] ?? 0);
322 $item['build_leader'] = $manageModel->getName($item['leader_mid']); 322 $item['build_leader'] = $manageModel->getName($item['leader_mid']);
323 $item['build_manager'] = $manageModel->getName($item['manager_mid']); 323 $item['build_manager'] = $manageModel->getName($item['manager_mid']);
@@ -114,7 +114,7 @@ class FileManageController extends BaseController @@ -114,7 +114,7 @@ class FileManageController extends BaseController
114 $hash = hash_file('md5', $file->getPathname()); 114 $hash = hash_file('md5', $file->getPathname());
115 $info = FileManage::where('hash', $hash)->first(); 115 $info = FileManage::where('hash', $hash)->first();
116 if($info){ 116 if($info){
117 - $this->fail('文件已存在'); 117 + $this->fail('文件已存在'.$hash);
118 } 118 }
119 119
120 return [ 120 return [
@@ -12,6 +12,7 @@ namespace App\Http\Controllers\Bside\Setting; @@ -12,6 +12,7 @@ namespace App\Http\Controllers\Bside\Setting;
12 use App\Enums\Common\Code; 12 use App\Enums\Common\Code;
13 use App\Http\Controllers\Bside\BaseController; 13 use App\Http\Controllers\Bside\BaseController;
14 use App\Http\Logic\Bside\Setting\TranslateLogic; 14 use App\Http\Logic\Bside\Setting\TranslateLogic;
  15 +use App\Models\Project\Project;
15 use App\Models\RouteMap\RouteMap; 16 use App\Models\RouteMap\RouteMap;
16 use App\Models\WebSetting\WebLanguage; 17 use App\Models\WebSetting\WebLanguage;
17 18
@@ -94,16 +95,40 @@ class TranslateController extends BaseController @@ -94,16 +95,40 @@ class TranslateController extends BaseController
94 $routeMapModel = new RouteMap(); 95 $routeMapModel = new RouteMap();
95 $list = $routeMapModel->list(); 96 $list = $routeMapModel->list();
96 foreach ($list as $k => $v){ 97 foreach ($list as $k => $v){
  98 + //查看项目是5.0还是6.0
  99 + if($this->user['is_upgrade'] == Project::IS_UPGRADE_TRUE){//升级项目
97 if(!empty($v['path'])){ 100 if(!empty($v['path'])){
98 if($v['path'] == 'blog'){ 101 if($v['path'] == 'blog'){
99 $v['path'] = $v['path'].'s'; 102 $v['path'] = $v['path'].'s';
100 } 103 }
101 $route = $v['path'].'/'.$v['route']; 104 $route = $v['path'].'/'.$v['route'];
102 }else{ 105 }else{
  106 + if($v['route'] == 'index'){
  107 + $v['route'] = '';
  108 + }
103 $route = $v['route']; 109 $route = $v['route'];
104 } 110 }
105 - $data[] = $this->user['domain'].$route; 111 + }else{
  112 + if(!empty($v['path'])){
  113 + if($v['path'] == 'blog'){
  114 + $v['path'] = $v['path'].'s';
  115 + }elseif ($v['path'] == RouteMap::PATH_NEWS_CATE){
  116 + $routeMapModel->edit(['path'=>''],['id'=>$v['id']]);
  117 + $v['path'] = '';
  118 + }elseif ($v['path'] == RouteMap::PATH_NEWS_CATE){
  119 + $routeMapModel->edit(['path'=>''],['id'=>$v['id']]);
  120 + $v['path'] = '';
  121 + }
  122 + $route = $v['path'].'/'.$v['route'];
  123 + }else{
  124 + if($v['route'] == 'index'){
  125 + $v['route'] = '';
  126 + }
  127 + $route = $v['route'];
106 } 128 }
  129 + }
  130 + }
  131 + $data[] = $this->user['domain'].$route;
107 $this->response('success',Code::SUCCESS,$data); 132 $this->response('success',Code::SUCCESS,$data);
108 } 133 }
109 } 134 }
@@ -510,8 +510,10 @@ class BTemplateLogic extends BaseLogic @@ -510,8 +510,10 @@ class BTemplateLogic extends BaseLogic
510 $templateCommonModel->edit($data,['id'=>$commonInfo['id']]); 510 $templateCommonModel->edit($data,['id'=>$commonInfo['id']]);
511 } 511 }
512 //更新所有界面的other 512 //更新所有界面的other
  513 + if($template_id != 0){
513 return $templateCommonModel->edit(['other'=>$handleInfo['other']],['project_id'=>$this->user['project_id'],'template_id'=>$template_id]); 514 return $templateCommonModel->edit(['other'=>$handleInfo['other']],['project_id'=>$this->user['project_id'],'template_id'=>$template_id]);
514 } 515 }
  516 + }
515 517
516 /** 518 /**
517 * @remark :扩展模块定制保存头部处理 519 * @remark :扩展模块定制保存头部处理
@@ -35,7 +35,7 @@ class TranslateLogic extends BaseLogic @@ -35,7 +35,7 @@ class TranslateLogic extends BaseLogic
35 */ 35 */
36 public function getTranslateList(){ 36 public function getTranslateList(){
37 $languageInfo = $this->getLanguage($this->param['language_id']); 37 $languageInfo = $this->getLanguage($this->param['language_id']);
38 - $info = $this->model->read(['url'=>$this->param['url'],'language_id'=>$this->param['language_id'],'type'=>$this->param['type']]); 38 + $info = $this->model->read(['url'=>str_replace_url($this->param['url']),'language_id'=>$this->param['language_id'],'type'=>$this->param['type']]);
39 //获取当前URl的所有文本内容 39 //获取当前URl的所有文本内容
40 $new_key = $this->getUrlRead($this->param['url']); 40 $new_key = $this->getUrlRead($this->param['url']);
41 if($info === false){ 41 if($info === false){
@@ -64,6 +64,7 @@ class TranslateLogic extends BaseLogic @@ -64,6 +64,7 @@ class TranslateLogic extends BaseLogic
64 } 64 }
65 $this->success($data); 65 $this->success($data);
66 } 66 }
  67 +
67 /** 68 /**
68 * @remark :获取图片列表 69 * @remark :获取图片列表
69 * @name :imageList 70 * @name :imageList
@@ -72,7 +73,7 @@ class TranslateLogic extends BaseLogic @@ -72,7 +73,7 @@ class TranslateLogic extends BaseLogic
72 * @time :2023/11/23 17:29 73 * @time :2023/11/23 17:29
73 */ 74 */
74 public function getTranslateImageList(){ 75 public function getTranslateImageList(){
75 - $info = $this->model->read(['url'=>$this->param['url'],'language_id'=>$this->param['language_id'],'type'=>$this->param['type']]); 76 + $info = $this->model->read(['url'=>str_replace_url($this->param['url']),'language_id'=>$this->param['language_id'],'type'=>$this->param['type']]);
76 $data = []; 77 $data = [];
77 if($info === false){ 78 if($info === false){
78 $new_list = $this->getUrlImageRead($this->param['url']); 79 $new_list = $this->getUrlImageRead($this->param['url']);
@@ -213,7 +214,7 @@ class TranslateLogic extends BaseLogic @@ -213,7 +214,7 @@ class TranslateLogic extends BaseLogic
213 $param = [ 214 $param = [
214 'type'=>1, 215 'type'=>1,
215 'project_id'=>$this->user['project_id'], 216 'project_id'=>$this->user['project_id'],
216 - 'url'=>$this->param['url'], 217 + 'url'=>str_replace_url($this->param['url']),
217 'language_id'=>$this->param['language_id'], 218 'language_id'=>$this->param['language_id'],
218 'alias'=>$this->param['alias'], 219 'alias'=>$this->param['alias'],
219 ]; 220 ];
@@ -201,6 +201,7 @@ class UserLoginLogic @@ -201,6 +201,7 @@ class UserLoginLogic
201 $info['domain'] = (!empty($project['deploy_optimize']['domain']) ? 201 $info['domain'] = (!empty($project['deploy_optimize']['domain']) ?
202 ((new DomainInfo())->getDomain($project['deploy_optimize']['domain'])) : ($project['deploy_build']['test_domain'] ?? '')); 202 ((new DomainInfo())->getDomain($project['deploy_optimize']['domain'])) : ($project['deploy_build']['test_domain'] ?? ''));
203 $info['is_customized'] = $project['is_customized']; 203 $info['is_customized'] = $project['is_customized'];
  204 + $info['is_upgrade'] = $project['is_upgrade'];
204 $info['is_upload_manage'] = $project['is_upload_manage']; 205 $info['is_upload_manage'] = $project['is_upload_manage'];
205 $info['is_show_blog'] = $project['is_show_blog']; 206 $info['is_show_blog'] = $project['is_show_blog'];
206 $info['upload_config'] = $project['upload_config']; 207 $info['upload_config'] = $project['upload_config'];