作者 lyh

Merge branch 'master' of http://47.244.231.31:8099/zhl/globalso-v6 into lyh-server

... ... @@ -123,23 +123,26 @@ class AiBlogAutoPublish extends Command
*/
public function auto_open()
{
$this->output('上线的推广项目自动开启');
$projects = Project::whereIn('type', [Project::TYPE_TWO, Project::TYPE_FOUR])
->whereNotNull('uptime')->where('is_ai_blog', 0)
->get();
foreach ($projects as $project) {
//未开启过 自动开启
if (!AiBlogOpenLog::isOpened($project->id)) {
//开启
$project->is_ai_blog = 1;
$project->save();
//创建AI博客项目
(new ProjectLogic())->setAiBlog($project->id, $project->main_lang_id, 1, $project->title);
//开启日志
AiBlogOpenLog::addLog($project->id);
while (true) {
$this->output('上线的推广项目自动开启');
$projects = Project::whereIn('type', [Project::TYPE_TWO, Project::TYPE_FOUR])
->whereNotNull('uptime')->where('is_ai_blog', 0)
->get();
foreach ($projects as $project) {
//未开启过 自动开启
if (!AiBlogOpenLog::isOpened($project->id)) {
//开启
$project->is_ai_blog = 1;
$project->save();
//创建AI博客项目
(new ProjectLogic())->setAiBlog($project->id, $project->main_lang_id, 1, $project->title);
//开启日志
AiBlogOpenLog::addLog($project->id);
$this->output('自动开启项目:' . $project->id);
$this->output('自动开启项目:' . $project->id);
}
}
sleep(60);
}
}
... ...
... ... @@ -12,6 +12,7 @@ use App\Models\Domain\DomainInfo;
use App\Models\Mail\Mail;
use App\Models\Project\DeployBuild;
use App\Models\Project\DeployOptimize;
use App\Models\Project\Project;
use App\Models\Project\ProjectKeyword;
use App\Models\Project\ProjectUpdateTdk;
use App\Models\User\User;
... ... @@ -263,6 +264,7 @@ class UpdateSeoTdk extends Command
public function seo_tdk($project_id, $task_id)
{
$notify_master = $notify_keyword = false;
$project = Project::find($project_id);
//更新统计
$update = [];
//AI指令 是否有定制指令
... ... @@ -366,12 +368,21 @@ class UpdateSeoTdk extends Command
}
} else if ($table == 'gl_product_keyword' && $field == 'seo_title') {
# TODO 聚合页seo title 特殊处理 前缀_1 . 关键词 . 后缀_2
$prefix = $this->getPrefixKeyword($project_id, 'prefix', 1, $v[$this->topic_fields[$table]]);
$suffix = $this->getPrefixKeyword($project_id, 'suffix', 2, $v[$this->topic_fields[$table]]);
if (empty($prefix) || empty($suffix))
continue;
$seo_title = $prefix . ' ' . $v[$this->topic_fields[$table]] . ' ' . $suffix;
$data[$field] = $seo_title;
$seo_title = '';
//只有推广项目才加 前后缀
if($project->type == Project::TYPE_TWO) {
$prefix = $this->getPrefixKeyword($project_id, 'prefix', 1);
$suffix = $this->getPrefixKeyword($project_id, 'suffix', 2);
if (empty($prefix) || empty($suffix)) {
continue;
}
$prefix = $this->getPrefixKeyword($project_id, 'prefix', 1, $v[$this->topic_fields[$table]]);
$suffix = $this->getPrefixKeyword($project_id, 'suffix', 2, $v[$this->topic_fields[$table]]);
$seo_title = $prefix . ' ' . $v[$this->topic_fields[$table]] . ' ' . $suffix;
}
$data[$field] = trim($seo_title);
$update[$table]['title']++;
} else if ($table == 'gl_ai_blog_list' && $field == 'seo_title') {
//直接使用 top blog
... ... @@ -547,6 +558,9 @@ class UpdateSeoTdk extends Command
//去掉标题存在的词
if ($topic) {
foreach ($fix_keyword as $k=>$keyword) {
// 前后缀如果已经存在, 就不在拼接当前类型
if (FALSE !== strpos($topic, $keyword))
return $str;
//处理单词复数 s es ies ves
$keyword = rtrim($keyword, 'ves');
$keyword = rtrim($keyword, 'ies');
... ... @@ -700,3 +714,4 @@ class UpdateSeoTdk extends Command
return $mail->add($data);
}
}
... ...
... ... @@ -337,6 +337,8 @@ class ProjectUpdate extends Command
}
//名称去掉特殊符号
$item['ttile'] = $this->special2str($item['ttile'] ?? '');
//短描述处理换行
$intro = str_replace("\r\n", "<br>", $item['short_description'] ?? '');
//详情
$content = $item['content'] ?? '';
try {
... ... @@ -345,7 +347,7 @@ class ProjectUpdate extends Command
$id = $model->insertGetId([
'project_id' => $project_id,
'title' => $item['ttile'],
'intro' => $item['short_description'] ?? '',
'intro' => $intro,
'content' => $content,
'category_id' => $category_id,
'keyword_id' => $keyword_id,
... ... @@ -391,7 +393,7 @@ class ProjectUpdate extends Command
//按5.0展示才需要更新数据
$model->edit([
'title' => $item['ttile'],
'intro' => $item['short_description'] ?? '',
'intro' => $intro,
'content' => $content,
'category_id' => $category_id,
'keyword_id' => $keyword_id,
... ...
... ... @@ -213,7 +213,7 @@ class Common
}
$keyword = str_replace($str,'',$keyword);
$keyword = trim($keyword,'.');
if(strpos(strtolower($keyword),'hope') === false
if( (strpos(strtolower($keyword),'hope') === false || strpos(strtolower($keyword),'hopein') !== false)
&& (strpos(strtolower($keyword),'remember') === false || strpos(strtolower($keyword),'rememberance') !== false)
&& strpos(strtolower($keyword),'help') === false
&& strpos(strtolower($keyword),'website') === false
... ...