|
...
|
...
|
@@ -3,6 +3,7 @@ |
|
|
|
namespace App\Console\Commands;
|
|
|
|
|
|
|
|
use App\Helper\Common;
|
|
|
|
use App\Models\Ai\AiCommand;
|
|
|
|
use App\Models\Project\DeployOptimize;
|
|
|
|
use App\Services\ProjectServer;
|
|
|
|
use Illuminate\Console\Command;
|
|
...
|
...
|
@@ -86,7 +87,14 @@ class UpdateSeoTdk extends Command |
|
|
|
$seo_arr = json_decode($v['seo_mate'], true) ?: [];
|
|
|
|
//更新seo_title
|
|
|
|
if(!isset($seo_arr['title']) || empty($seo_arr['title'])){
|
|
|
|
$seo_arr['title'] = $seo_arr['title'];
|
|
|
|
//查看是否有指令
|
|
|
|
$aiCommandModel = new AiCommand();
|
|
|
|
$AiInfo = $aiCommandModel->read(['key'=>'product_seo_title'],['ai']);
|
|
|
|
if(!empty($AiInfo['ai'])){
|
|
|
|
$seo_arr['title'] = $this->ai_send('product_seo_title',$v['title']);
|
|
|
|
}else {
|
|
|
|
$seo_arr['title'] = $v['title'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//更新seo_keyword
|
|
|
|
if(!isset($seo_arr['keyword']) || empty($seo_arr['keyword'])){
|
|
...
|
...
|
@@ -118,14 +126,22 @@ class UpdateSeoTdk extends Command |
|
|
|
$v = (array)$v;
|
|
|
|
$data = [];
|
|
|
|
if(empty($v['seo_title'])){
|
|
|
|
$aiCommandModel = new AiCommand();
|
|
|
|
$AiInfo = $aiCommandModel->read(['key'=>'product_cate_seo_title'],['ai']);
|
|
|
|
if(!empty($AiInfo['ai'])){
|
|
|
|
$data['seo_title'] = $this->ai_send('product_cate_seo_title',$v['title']);
|
|
|
|
}else{
|
|
|
|
$data['seo_title'] = $v['title'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(empty($v['seo_keywords'])){
|
|
|
|
$data['seo_keywords'] = $this->ai_send('seo_keywords',$v['title']);
|
|
|
|
}
|
|
|
|
if(empty($v['seo_des'])){
|
|
|
|
$name = $this->companyName($project_id);
|
|
|
|
$data['seo_des'] = $this->ai_send('page_meta_description',$v['title'],$name);
|
|
|
|
if(!empty($name)){
|
|
|
|
$data['seo_des'] = $this->ai_send('page_meta_description',$v['title'],$name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(!$data){
|
|
|
|
continue;
|
|
...
|
...
|
@@ -150,8 +166,13 @@ class UpdateSeoTdk extends Command |
|
|
|
$v = (array)$v;
|
|
|
|
$data = [];
|
|
|
|
if(empty($v['seo_title'])){
|
|
|
|
//生成seo_title
|
|
|
|
$data['seo_title'] = $v['name'];
|
|
|
|
$aiCommandModel = new AiCommand();
|
|
|
|
$AiInfo = $aiCommandModel->read(['key'=>'news_seo_title'],['ai']);
|
|
|
|
if(!empty($AiInfo['ai'])){
|
|
|
|
$data['seo_title'] = $this->ai_send('news_seo_title',$v['name']);
|
|
|
|
}else{
|
|
|
|
$data['seo_title'] = $v['name'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(empty($v['seo_keywords'])){
|
|
|
|
$data['seo_keywords'] = $this->ai_send('seo_keywords',$v['name']);
|
|
...
|
...
|
@@ -182,14 +203,26 @@ class UpdateSeoTdk extends Command |
|
|
|
$v = (array)$v;
|
|
|
|
$data = [];
|
|
|
|
if(empty($v['seo_title'])){
|
|
|
|
$data['seo_title'] = $v['name'];
|
|
|
|
$aiCommandModel = new AiCommand();
|
|
|
|
$AiInfo = $aiCommandModel->read(['key'=>'news_cate_seo_title'],['ai']);
|
|
|
|
if(!empty($AiInfo['ai'])){
|
|
|
|
$data['seo_title'] = $this->ai_send('news_cate_seo_title',$v['name']);
|
|
|
|
}else{
|
|
|
|
$data['seo_title'] = $v['name'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(empty($v['seo_keywords'])){
|
|
|
|
$data['seo_keywords'] = $this->ai_send('seo_keywords',$v['name']);
|
|
|
|
//获取核心关键词
|
|
|
|
$main_keyword = $this->mainKeywords($project_id);
|
|
|
|
if(!empty($main_keyword)){
|
|
|
|
$data['seo_keywords'] = $this->ai_send('seo_keywords',$main_keyword);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(empty($v['seo_des'])){
|
|
|
|
$name = $this->companyName($project_id);
|
|
|
|
$data['seo_des'] = $this->ai_send('page_meta_description',$v['title'],$name);
|
|
|
|
if(!empty($name)){
|
|
|
|
$data['seo_des'] = $this->ai_send('page_meta_description',$v['title'],$name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(!$data){
|
|
|
|
continue;
|
|
...
|
...
|
@@ -214,8 +247,13 @@ class UpdateSeoTdk extends Command |
|
|
|
$v = (array)$v;
|
|
|
|
$data = [];
|
|
|
|
if(empty($v['seo_title'])){
|
|
|
|
//生成seo_title
|
|
|
|
$data['seo_title'] = $v['name'];
|
|
|
|
$aiCommandModel = new AiCommand();
|
|
|
|
$AiInfo = $aiCommandModel->read(['key'=>'blog_seo_title'],['ai']);
|
|
|
|
if(!empty($AiInfo['ai'])){
|
|
|
|
$data['seo_title'] = $this->ai_send('blog_seo_title',$v['name']);
|
|
|
|
}else{
|
|
|
|
$data['seo_title'] = $v['name'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(empty($v['seo_keywords'])){
|
|
|
|
$data['seo_keywords'] = $this->ai_send('seo_keywords',$v['name']);
|
|
...
|
...
|
@@ -249,7 +287,11 @@ class UpdateSeoTdk extends Command |
|
|
|
$data['seo_title'] = $v['name'];
|
|
|
|
}
|
|
|
|
if(empty($v['seo_keywords'])){
|
|
|
|
$data['seo_keywords'] = $this->ai_send('seo_keywords',$v['name']);
|
|
|
|
//获取核心关键词
|
|
|
|
$main_keyword = $this->mainKeywords($project_id);
|
|
|
|
if(!empty($main_keyword)){
|
|
|
|
$data['seo_keywords'] = $this->ai_send('seo_keywords',$main_keyword);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(empty($v['seo_des'])){
|
|
|
|
$name = $this->companyName($project_id);
|
|
...
|
...
|
@@ -309,9 +351,7 @@ class UpdateSeoTdk extends Command |
|
|
|
*/
|
|
|
|
public function companyName($key,$project_id){
|
|
|
|
$data = [
|
|
|
|
'news_remark',
|
|
|
|
'blog_remark',
|
|
|
|
'product_long_description'
|
|
|
|
'product_long_description',
|
|
|
|
];
|
|
|
|
$projectOptimizeModel = new DeployOptimize();
|
|
|
|
$info = $projectOptimizeModel->read(['project_id'=>$project_id],['id','company_en_name','company_en_description']);
|
|
...
|
...
|
@@ -333,10 +373,12 @@ class UpdateSeoTdk extends Command |
|
|
|
$str = '';
|
|
|
|
$projectOptimizeModel = new DeployOptimize();
|
|
|
|
$info = $projectOptimizeModel->read(['project_id'=>$project_id],['id','main_keywords']);
|
|
|
|
if($info === false){
|
|
|
|
$arr = explode(',',$info['main_keywords']);
|
|
|
|
if(isset($arr[0])){
|
|
|
|
$str = $arr[0];
|
|
|
|
if($info !== false){
|
|
|
|
if(!empty($info['main_keywords'])){
|
|
|
|
$arr = explode(',',$info['main_keywords']);
|
|
|
|
if(isset($arr[0])){
|
|
|
|
$str = $arr[0];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $str;
|
...
|
...
|
|