作者 lyh

gx批量操作关键词

... ... @@ -69,7 +69,6 @@ class CopyProject extends Command
$item->status = NoticeLog::STATUS_FAIL;
$item->save();
}
sleep(60);
try {
$this->copyMysql($old_project_id,$project_id);
$this->output('CopyProjectJob end, old project_id: ' . $old_project_id . ', new project_id: ' . $project_id);
... ...
... ... @@ -195,6 +195,7 @@ class TranslateLogic extends BaseLogic
$texts = $dom->find("text");
$description = $dom->find("meta[name=description]",0);
$keywords = $dom->find("meta[name=keywords]",0);
$placeholders = $dom->find("[placeholder]");
// 组装需要翻译的内容 HTML内文案、meta description、meta keywords
$need_tran = [];
foreach ($texts as $k=>$text) {
... ... @@ -217,6 +218,12 @@ class TranslateLogic extends BaseLogic
$need_tran[] = htmlspecialchars_decode(html_entity_decode($string));
}
}
foreach ($placeholders as $placeholder) {
$placeholderText = trim($placeholder->placeholder);
if ($placeholderText) {
$need_tran[] = $placeholderText;
}
}
$need_tran[] = $description ? $description->attr['content'] : '';
$need_tran[] = $keywords ? $keywords->attr['content'] : '';
$need_tran = array_values(array_unique($need_tran));
... ...