作者 赵彬吉

扩展模块tdk

... ... @@ -107,7 +107,17 @@ class UpdateSeoTdk extends Command
'tags_meta_description' => 'seo_description',
'tags_content_title' => 'keyword_title',
'tags_content_description' => 'keyword_content',
]
],
'gl_custom_module_category' => [
'custom_module_cat_title' => 'seo_title',
'custom_module_cat_meta_keywords' => 'seo_keywords',
'custom_module_cat_meta_description' => 'seo_description',
],
'gl_custom_module_content' => [
'custom_module_title' => 'seo_title',
'custom_module_meta_keywords' => 'seo_keywords',
'custom_module_meta_description' => 'seo_description',
],
];
/**
... ... @@ -122,7 +132,9 @@ class UpdateSeoTdk extends Command
'gl_blog_category' => 'name',
'gl_news' => 'name',
'gl_news_category' => 'name',
'gl_product_keyword' => 'title'
'gl_product_keyword' => 'title',
'gl_custom_module_category' => 'name',
'gl_custom_module_content' => 'name',
];
/**
... ... @@ -149,7 +161,9 @@ class UpdateSeoTdk extends Command
'gl_blog_category' => 'blog_category',
'gl_news' => 'news',
'gl_news_category' => 'news_category',
'gl_product_keyword' => 'product_keyword'
'gl_product_keyword' => 'product_keyword',
'gl_custom_module_category' => 'module_category',
'gl_custom_module_content' => 'module',
];
/**
... ... @@ -166,7 +180,9 @@ class UpdateSeoTdk extends Command
'gl_blog_category' => 'alias',
'gl_news' => 'url',
'gl_news_category' => 'alias',
'gl_product_keyword' => 'route'
'gl_product_keyword' => 'route',
'gl_custom_module_category' => 'route',
'gl_custom_module_content' => 'route',
];
/**
... ...
... ... @@ -6,6 +6,7 @@ use App\Helper\Arr;
use App\Helper\Common;
use App\Helper\Gpt;
use App\Models\Ai\AiCommand;
use App\Models\Com\UpdateNotify;
use App\Models\Domain\DomainInfo;
use App\Models\Mail\Mail;
use App\Models\Project\DeployBuild;
... ... @@ -16,6 +17,7 @@ use App\Models\User\User;
use App\Models\WebSetting\WebLanguage;
use App\Services\ProjectServer;
use Illuminate\Console\Command;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Redis;
... ... @@ -106,7 +108,17 @@ class UpdateSeoTdkByTaskId extends Command
'tags_meta_description' => 'seo_description',
'tags_content_title' => 'keyword_title',
'tags_content_description' => 'keyword_content',
]
],
'gl_custom_module_category' => [
'custom_module_cat_title' => 'seo_title',
'custom_module_cat_meta_keywords' => 'seo_keywords',
'custom_module_cat_meta_description' => 'seo_description',
],
'gl_custom_module_content' => [
'custom_module_title' => 'seo_title',
'custom_module_meta_keywords' => 'seo_keywords',
'custom_module_meta_description' => 'seo_description',
],
];
/**
... ... @@ -121,7 +133,9 @@ class UpdateSeoTdkByTaskId extends Command
'gl_blog_category' => 'name',
'gl_news' => 'name',
'gl_news_category' => 'name',
'gl_product_keyword' => 'title'
'gl_product_keyword' => 'title',
'gl_custom_module_category' => 'name',
'gl_custom_module_content' => 'name',
];
/**
... ... @@ -135,6 +149,44 @@ class UpdateSeoTdkByTaskId extends Command
];
/**
* '表' => 'C端页面更新的数据类型'
* @return array
* @author akun
* @date 2024/11/14
*/
protected $maps_type = [
'gl_web_custom_template' => 'page',
'gl_product' => 'product',
'gl_product_category' => 'product_category',
'gl_blog' => 'blog',
'gl_blog_category' => 'blog_category',
'gl_news' => 'news',
'gl_news_category' => 'news_category',
'gl_product_keyword' => 'product_keyword',
'gl_custom_module_category' => 'module_category',
'gl_custom_module_content' => 'module',
];
/**
* '表' => '对应数据路由字段'
* @return array
* @author akun
* @date 2024/11/14
*/
protected $maps_route = [
'gl_web_custom_template' => 'url',
'gl_product' => 'route',
'gl_product_category' => 'route',
'gl_blog' => 'url',
'gl_blog_category' => 'alias',
'gl_news' => 'url',
'gl_news_category' => 'alias',
'gl_product_keyword' => 'route',
'gl_custom_module_category' => 'route',
'gl_custom_module_content' => 'route',
];
/**
* @return bool
*/
public function handle()
... ... @@ -324,9 +376,15 @@ class UpdateSeoTdkByTaskId extends Command
$data[$json_field] = json_encode($data[$json_field]);
}
DB::connection('custom_mysql')->table($table)->where(['id' => $v['id']])->update($data);
if($table == 'gl_product_keyword'){
$notify_keyword = true;
}else{
// if($table == 'gl_product_keyword'){
// $notify_keyword = true;
// }else{
// $notify_master = true;
// }
//tdk已更新的数据,存入按需更新表
$route = DB::connection('custom_mysql')->table($table)->where(['id' => $v['id']])->value($this->maps_route[$table]);
if($route){
UpdateNotify::addUpdateItem($project_id,$this->maps_type[$table],$route);
$notify_master = true;
}
}
... ... @@ -335,8 +393,9 @@ class UpdateSeoTdkByTaskId extends Command
ProjectUpdateTdk::finish($task_id, $update);
//通知C端更新界面
$notify_master && $this->sendNotify($project_id, 1); //通知主站更新
$notify_keyword && $this->sendNotify($project_id, 4); //通知聚合页更新
// $notify_master && $this->sendNotify($project_id, 1); //通知主站更新
// $notify_keyword && $this->sendNotify($project_id, 4); //通知聚合页更新
$notify_master && $this->sendNotify($project_id, 2); //通知主站按需更新
}
public function getPrompt($project_id, $prompt, $table, $data){
... ... @@ -378,7 +437,7 @@ class UpdateSeoTdkByTaskId extends Command
$projectKeywordModel = new ProjectKeyword();
$keywordInfo = $projectKeywordModel->read(['project_id'=>$project_id]);
$info['main_keyword'] = '';
if($keywordInfo === false){
if(!empty($keywordInfo['main_keyword'])){
$info['main_keyword'] = $keywordInfo['main_keyword'];
}
Cache::put($cache_key, $info, 600);
... ...