Merge branch 'master' of http://47.244.231.31:8099/zhl/globalso-v6 into lyh-server
正在显示
4 个修改的文件
包含
44 行增加
和
24 行删除
| @@ -123,23 +123,26 @@ class AiBlogAutoPublish extends Command | @@ -123,23 +123,26 @@ class AiBlogAutoPublish extends Command | ||
| 123 | */ | 123 | */ |
| 124 | public function auto_open() | 124 | public function auto_open() |
| 125 | { | 125 | { |
| 126 | - $this->output('上线的推广项目自动开启'); | ||
| 127 | - $projects = Project::whereIn('type', [Project::TYPE_TWO, Project::TYPE_FOUR]) | ||
| 128 | - ->whereNotNull('uptime')->where('is_ai_blog', 0) | ||
| 129 | - ->get(); | ||
| 130 | - foreach ($projects as $project) { | ||
| 131 | - //未开启过 自动开启 | ||
| 132 | - if (!AiBlogOpenLog::isOpened($project->id)) { | ||
| 133 | - //开启 | ||
| 134 | - $project->is_ai_blog = 1; | ||
| 135 | - $project->save(); | ||
| 136 | - //创建AI博客项目 | ||
| 137 | - (new ProjectLogic())->setAiBlog($project->id, $project->main_lang_id, 1, $project->title); | ||
| 138 | - //开启日志 | ||
| 139 | - AiBlogOpenLog::addLog($project->id); | 126 | + while (true) { |
| 127 | + $this->output('上线的推广项目自动开启'); | ||
| 128 | + $projects = Project::whereIn('type', [Project::TYPE_TWO, Project::TYPE_FOUR]) | ||
| 129 | + ->whereNotNull('uptime')->where('is_ai_blog', 0) | ||
| 130 | + ->get(); | ||
| 131 | + foreach ($projects as $project) { | ||
| 132 | + //未开启过 自动开启 | ||
| 133 | + if (!AiBlogOpenLog::isOpened($project->id)) { | ||
| 134 | + //开启 | ||
| 135 | + $project->is_ai_blog = 1; | ||
| 136 | + $project->save(); | ||
| 137 | + //创建AI博客项目 | ||
| 138 | + (new ProjectLogic())->setAiBlog($project->id, $project->main_lang_id, 1, $project->title); | ||
| 139 | + //开启日志 | ||
| 140 | + AiBlogOpenLog::addLog($project->id); | ||
| 140 | 141 | ||
| 141 | - $this->output('自动开启项目:' . $project->id); | 142 | + $this->output('自动开启项目:' . $project->id); |
| 143 | + } | ||
| 142 | } | 144 | } |
| 145 | + sleep(60); | ||
| 143 | } | 146 | } |
| 144 | } | 147 | } |
| 145 | 148 |
| @@ -12,6 +12,7 @@ use App\Models\Domain\DomainInfo; | @@ -12,6 +12,7 @@ use App\Models\Domain\DomainInfo; | ||
| 12 | use App\Models\Mail\Mail; | 12 | use App\Models\Mail\Mail; |
| 13 | use App\Models\Project\DeployBuild; | 13 | use App\Models\Project\DeployBuild; |
| 14 | use App\Models\Project\DeployOptimize; | 14 | use App\Models\Project\DeployOptimize; |
| 15 | +use App\Models\Project\Project; | ||
| 15 | use App\Models\Project\ProjectKeyword; | 16 | use App\Models\Project\ProjectKeyword; |
| 16 | use App\Models\Project\ProjectUpdateTdk; | 17 | use App\Models\Project\ProjectUpdateTdk; |
| 17 | use App\Models\User\User; | 18 | use App\Models\User\User; |
| @@ -263,6 +264,7 @@ class UpdateSeoTdk extends Command | @@ -263,6 +264,7 @@ class UpdateSeoTdk extends Command | ||
| 263 | public function seo_tdk($project_id, $task_id) | 264 | public function seo_tdk($project_id, $task_id) |
| 264 | { | 265 | { |
| 265 | $notify_master = $notify_keyword = false; | 266 | $notify_master = $notify_keyword = false; |
| 267 | + $project = Project::find($project_id); | ||
| 266 | //更新统计 | 268 | //更新统计 |
| 267 | $update = []; | 269 | $update = []; |
| 268 | //AI指令 是否有定制指令 | 270 | //AI指令 是否有定制指令 |
| @@ -366,12 +368,21 @@ class UpdateSeoTdk extends Command | @@ -366,12 +368,21 @@ class UpdateSeoTdk extends Command | ||
| 366 | } | 368 | } |
| 367 | } else if ($table == 'gl_product_keyword' && $field == 'seo_title') { | 369 | } else if ($table == 'gl_product_keyword' && $field == 'seo_title') { |
| 368 | # TODO 聚合页seo title 特殊处理 前缀_1 . 关键词 . 后缀_2 | 370 | # TODO 聚合页seo title 特殊处理 前缀_1 . 关键词 . 后缀_2 |
| 369 | - $prefix = $this->getPrefixKeyword($project_id, 'prefix', 1, $v[$this->topic_fields[$table]]); | ||
| 370 | - $suffix = $this->getPrefixKeyword($project_id, 'suffix', 2, $v[$this->topic_fields[$table]]); | ||
| 371 | - if (empty($prefix) || empty($suffix)) | ||
| 372 | - continue; | ||
| 373 | - $seo_title = $prefix . ' ' . $v[$this->topic_fields[$table]] . ' ' . $suffix; | ||
| 374 | - $data[$field] = $seo_title; | 371 | + $seo_title = ''; |
| 372 | + //只有推广项目才加 前后缀 | ||
| 373 | + if($project->type == Project::TYPE_TWO) { | ||
| 374 | + $prefix = $this->getPrefixKeyword($project_id, 'prefix', 1); | ||
| 375 | + $suffix = $this->getPrefixKeyword($project_id, 'suffix', 2); | ||
| 376 | + if (empty($prefix) || empty($suffix)) { | ||
| 377 | + continue; | ||
| 378 | + } | ||
| 379 | + | ||
| 380 | + $prefix = $this->getPrefixKeyword($project_id, 'prefix', 1, $v[$this->topic_fields[$table]]); | ||
| 381 | + $suffix = $this->getPrefixKeyword($project_id, 'suffix', 2, $v[$this->topic_fields[$table]]); | ||
| 382 | + $seo_title = $prefix . ' ' . $v[$this->topic_fields[$table]] . ' ' . $suffix; | ||
| 383 | + } | ||
| 384 | + | ||
| 385 | + $data[$field] = trim($seo_title); | ||
| 375 | $update[$table]['title']++; | 386 | $update[$table]['title']++; |
| 376 | } else if ($table == 'gl_ai_blog_list' && $field == 'seo_title') { | 387 | } else if ($table == 'gl_ai_blog_list' && $field == 'seo_title') { |
| 377 | //直接使用 top blog | 388 | //直接使用 top blog |
| @@ -547,6 +558,9 @@ class UpdateSeoTdk extends Command | @@ -547,6 +558,9 @@ class UpdateSeoTdk extends Command | ||
| 547 | //去掉标题存在的词 | 558 | //去掉标题存在的词 |
| 548 | if ($topic) { | 559 | if ($topic) { |
| 549 | foreach ($fix_keyword as $k=>$keyword) { | 560 | foreach ($fix_keyword as $k=>$keyword) { |
| 561 | + // 前后缀如果已经存在, 就不在拼接当前类型 | ||
| 562 | + if (FALSE !== strpos($topic, $keyword)) | ||
| 563 | + return $str; | ||
| 550 | //处理单词复数 s es ies ves | 564 | //处理单词复数 s es ies ves |
| 551 | $keyword = rtrim($keyword, 'ves'); | 565 | $keyword = rtrim($keyword, 'ves'); |
| 552 | $keyword = rtrim($keyword, 'ies'); | 566 | $keyword = rtrim($keyword, 'ies'); |
| @@ -700,3 +714,4 @@ class UpdateSeoTdk extends Command | @@ -700,3 +714,4 @@ class UpdateSeoTdk extends Command | ||
| 700 | return $mail->add($data); | 714 | return $mail->add($data); |
| 701 | } | 715 | } |
| 702 | } | 716 | } |
| 717 | + |
| @@ -337,6 +337,8 @@ class ProjectUpdate extends Command | @@ -337,6 +337,8 @@ class ProjectUpdate extends Command | ||
| 337 | } | 337 | } |
| 338 | //名称去掉特殊符号 | 338 | //名称去掉特殊符号 |
| 339 | $item['ttile'] = $this->special2str($item['ttile'] ?? ''); | 339 | $item['ttile'] = $this->special2str($item['ttile'] ?? ''); |
| 340 | + //短描述处理换行 | ||
| 341 | + $intro = str_replace("\r\n", "<br>", $item['short_description'] ?? ''); | ||
| 340 | //详情 | 342 | //详情 |
| 341 | $content = $item['content'] ?? ''; | 343 | $content = $item['content'] ?? ''; |
| 342 | try { | 344 | try { |
| @@ -345,7 +347,7 @@ class ProjectUpdate extends Command | @@ -345,7 +347,7 @@ class ProjectUpdate extends Command | ||
| 345 | $id = $model->insertGetId([ | 347 | $id = $model->insertGetId([ |
| 346 | 'project_id' => $project_id, | 348 | 'project_id' => $project_id, |
| 347 | 'title' => $item['ttile'], | 349 | 'title' => $item['ttile'], |
| 348 | - 'intro' => $item['short_description'] ?? '', | 350 | + 'intro' => $intro, |
| 349 | 'content' => $content, | 351 | 'content' => $content, |
| 350 | 'category_id' => $category_id, | 352 | 'category_id' => $category_id, |
| 351 | 'keyword_id' => $keyword_id, | 353 | 'keyword_id' => $keyword_id, |
| @@ -391,7 +393,7 @@ class ProjectUpdate extends Command | @@ -391,7 +393,7 @@ class ProjectUpdate extends Command | ||
| 391 | //按5.0展示才需要更新数据 | 393 | //按5.0展示才需要更新数据 |
| 392 | $model->edit([ | 394 | $model->edit([ |
| 393 | 'title' => $item['ttile'], | 395 | 'title' => $item['ttile'], |
| 394 | - 'intro' => $item['short_description'] ?? '', | 396 | + 'intro' => $intro, |
| 395 | 'content' => $content, | 397 | 'content' => $content, |
| 396 | 'category_id' => $category_id, | 398 | 'category_id' => $category_id, |
| 397 | 'keyword_id' => $keyword_id, | 399 | 'keyword_id' => $keyword_id, |
| @@ -213,7 +213,7 @@ class Common | @@ -213,7 +213,7 @@ class Common | ||
| 213 | } | 213 | } |
| 214 | $keyword = str_replace($str,'',$keyword); | 214 | $keyword = str_replace($str,'',$keyword); |
| 215 | $keyword = trim($keyword,'.'); | 215 | $keyword = trim($keyword,'.'); |
| 216 | - if(strpos(strtolower($keyword),'hope') === false | 216 | + if( (strpos(strtolower($keyword),'hope') === false || strpos(strtolower($keyword),'hopein') !== false) |
| 217 | && (strpos(strtolower($keyword),'remember') === false || strpos(strtolower($keyword),'rememberance') !== false) | 217 | && (strpos(strtolower($keyword),'remember') === false || strpos(strtolower($keyword),'rememberance') !== false) |
| 218 | && strpos(strtolower($keyword),'help') === false | 218 | && strpos(strtolower($keyword),'help') === false |
| 219 | && strpos(strtolower($keyword),'website') === false | 219 | && strpos(strtolower($keyword),'website') === false |
-
请 注册 或 登录 后发表评论