作者 lyh

gx批量操作关键词

@@ -69,7 +69,6 @@ class CopyProject extends Command @@ -69,7 +69,6 @@ class CopyProject extends Command
69 $item->status = NoticeLog::STATUS_FAIL; 69 $item->status = NoticeLog::STATUS_FAIL;
70 $item->save(); 70 $item->save();
71 } 71 }
72 - sleep(60);  
73 try { 72 try {
74 $this->copyMysql($old_project_id,$project_id); 73 $this->copyMysql($old_project_id,$project_id);
75 $this->output('CopyProjectJob end, old project_id: ' . $old_project_id . ', new project_id: ' . $project_id); 74 $this->output('CopyProjectJob end, old project_id: ' . $old_project_id . ', new project_id: ' . $project_id);
@@ -195,6 +195,7 @@ class TranslateLogic extends BaseLogic @@ -195,6 +195,7 @@ class TranslateLogic extends BaseLogic
195 $texts = $dom->find("text"); 195 $texts = $dom->find("text");
196 $description = $dom->find("meta[name=description]",0); 196 $description = $dom->find("meta[name=description]",0);
197 $keywords = $dom->find("meta[name=keywords]",0); 197 $keywords = $dom->find("meta[name=keywords]",0);
  198 + $placeholders = $dom->find("[placeholder]");
198 // 组装需要翻译的内容 HTML内文案、meta description、meta keywords 199 // 组装需要翻译的内容 HTML内文案、meta description、meta keywords
199 $need_tran = []; 200 $need_tran = [];
200 foreach ($texts as $k=>$text) { 201 foreach ($texts as $k=>$text) {
@@ -217,6 +218,12 @@ class TranslateLogic extends BaseLogic @@ -217,6 +218,12 @@ class TranslateLogic extends BaseLogic
217 $need_tran[] = htmlspecialchars_decode(html_entity_decode($string)); 218 $need_tran[] = htmlspecialchars_decode(html_entity_decode($string));
218 } 219 }
219 } 220 }
  221 + foreach ($placeholders as $placeholder) {
  222 + $placeholderText = trim($placeholder->placeholder);
  223 + if ($placeholderText) {
  224 + $need_tran[] = $placeholderText;
  225 + }
  226 + }
220 $need_tran[] = $description ? $description->attr['content'] : ''; 227 $need_tran[] = $description ? $description->attr['content'] : '';
221 $need_tran[] = $keywords ? $keywords->attr['content'] : ''; 228 $need_tran[] = $keywords ? $keywords->attr['content'] : '';
222 $need_tran = array_values(array_unique($need_tran)); 229 $need_tran = array_values(array_unique($need_tran));