作者 赵彬吉

扩展模块tdk

@@ -107,7 +107,17 @@ class UpdateSeoTdk extends Command @@ -107,7 +107,17 @@ class UpdateSeoTdk extends Command
107 'tags_meta_description' => 'seo_description', 107 'tags_meta_description' => 'seo_description',
108 'tags_content_title' => 'keyword_title', 108 'tags_content_title' => 'keyword_title',
109 'tags_content_description' => 'keyword_content', 109 'tags_content_description' => 'keyword_content',
110 - ] 110 + ],
  111 + 'gl_custom_module_category' => [
  112 + 'custom_module_cat_title' => 'seo_title',
  113 + 'custom_module_cat_meta_keywords' => 'seo_keywords',
  114 + 'custom_module_cat_meta_description' => 'seo_description',
  115 + ],
  116 + 'gl_custom_module_content' => [
  117 + 'custom_module_title' => 'seo_title',
  118 + 'custom_module_meta_keywords' => 'seo_keywords',
  119 + 'custom_module_meta_description' => 'seo_description',
  120 + ],
111 ]; 121 ];
112 122
113 /** 123 /**
@@ -122,7 +132,9 @@ class UpdateSeoTdk extends Command @@ -122,7 +132,9 @@ class UpdateSeoTdk extends Command
122 'gl_blog_category' => 'name', 132 'gl_blog_category' => 'name',
123 'gl_news' => 'name', 133 'gl_news' => 'name',
124 'gl_news_category' => 'name', 134 'gl_news_category' => 'name',
125 - 'gl_product_keyword' => 'title' 135 + 'gl_product_keyword' => 'title',
  136 + 'gl_custom_module_category' => 'name',
  137 + 'gl_custom_module_content' => 'name',
126 ]; 138 ];
127 139
128 /** 140 /**
@@ -149,7 +161,9 @@ class UpdateSeoTdk extends Command @@ -149,7 +161,9 @@ class UpdateSeoTdk extends Command
149 'gl_blog_category' => 'blog_category', 161 'gl_blog_category' => 'blog_category',
150 'gl_news' => 'news', 162 'gl_news' => 'news',
151 'gl_news_category' => 'news_category', 163 'gl_news_category' => 'news_category',
152 - 'gl_product_keyword' => 'product_keyword' 164 + 'gl_product_keyword' => 'product_keyword',
  165 + 'gl_custom_module_category' => 'module_category',
  166 + 'gl_custom_module_content' => 'module',
153 ]; 167 ];
154 168
155 /** 169 /**
@@ -166,7 +180,9 @@ class UpdateSeoTdk extends Command @@ -166,7 +180,9 @@ class UpdateSeoTdk extends Command
166 'gl_blog_category' => 'alias', 180 'gl_blog_category' => 'alias',
167 'gl_news' => 'url', 181 'gl_news' => 'url',
168 'gl_news_category' => 'alias', 182 'gl_news_category' => 'alias',
169 - 'gl_product_keyword' => 'route' 183 + 'gl_product_keyword' => 'route',
  184 + 'gl_custom_module_category' => 'route',
  185 + 'gl_custom_module_content' => 'route',
170 ]; 186 ];
171 187
172 /** 188 /**
@@ -6,6 +6,7 @@ use App\Helper\Arr; @@ -6,6 +6,7 @@ use App\Helper\Arr;
6 use App\Helper\Common; 6 use App\Helper\Common;
7 use App\Helper\Gpt; 7 use App\Helper\Gpt;
8 use App\Models\Ai\AiCommand; 8 use App\Models\Ai\AiCommand;
  9 +use App\Models\Com\UpdateNotify;
9 use App\Models\Domain\DomainInfo; 10 use App\Models\Domain\DomainInfo;
10 use App\Models\Mail\Mail; 11 use App\Models\Mail\Mail;
11 use App\Models\Project\DeployBuild; 12 use App\Models\Project\DeployBuild;
@@ -16,6 +17,7 @@ use App\Models\User\User; @@ -16,6 +17,7 @@ use App\Models\User\User;
16 use App\Models\WebSetting\WebLanguage; 17 use App\Models\WebSetting\WebLanguage;
17 use App\Services\ProjectServer; 18 use App\Services\ProjectServer;
18 use Illuminate\Console\Command; 19 use Illuminate\Console\Command;
  20 +use Illuminate\Database\Eloquent\Model;
19 use Illuminate\Support\Facades\Cache; 21 use Illuminate\Support\Facades\Cache;
20 use Illuminate\Support\Facades\DB; 22 use Illuminate\Support\Facades\DB;
21 use Illuminate\Support\Facades\Redis; 23 use Illuminate\Support\Facades\Redis;
@@ -106,7 +108,17 @@ class UpdateSeoTdkByTaskId extends Command @@ -106,7 +108,17 @@ class UpdateSeoTdkByTaskId extends Command
106 'tags_meta_description' => 'seo_description', 108 'tags_meta_description' => 'seo_description',
107 'tags_content_title' => 'keyword_title', 109 'tags_content_title' => 'keyword_title',
108 'tags_content_description' => 'keyword_content', 110 'tags_content_description' => 'keyword_content',
109 - ] 111 + ],
  112 + 'gl_custom_module_category' => [
  113 + 'custom_module_cat_title' => 'seo_title',
  114 + 'custom_module_cat_meta_keywords' => 'seo_keywords',
  115 + 'custom_module_cat_meta_description' => 'seo_description',
  116 + ],
  117 + 'gl_custom_module_content' => [
  118 + 'custom_module_title' => 'seo_title',
  119 + 'custom_module_meta_keywords' => 'seo_keywords',
  120 + 'custom_module_meta_description' => 'seo_description',
  121 + ],
110 ]; 122 ];
111 123
112 /** 124 /**
@@ -121,7 +133,9 @@ class UpdateSeoTdkByTaskId extends Command @@ -121,7 +133,9 @@ class UpdateSeoTdkByTaskId extends Command
121 'gl_blog_category' => 'name', 133 'gl_blog_category' => 'name',
122 'gl_news' => 'name', 134 'gl_news' => 'name',
123 'gl_news_category' => 'name', 135 'gl_news_category' => 'name',
124 - 'gl_product_keyword' => 'title' 136 + 'gl_product_keyword' => 'title',
  137 + 'gl_custom_module_category' => 'name',
  138 + 'gl_custom_module_content' => 'name',
125 ]; 139 ];
126 140
127 /** 141 /**
@@ -135,6 +149,44 @@ class UpdateSeoTdkByTaskId extends Command @@ -135,6 +149,44 @@ class UpdateSeoTdkByTaskId extends Command
135 ]; 149 ];
136 150
137 /** 151 /**
  152 + * '表' => 'C端页面更新的数据类型'
  153 + * @return array
  154 + * @author akun
  155 + * @date 2024/11/14
  156 + */
  157 + protected $maps_type = [
  158 + 'gl_web_custom_template' => 'page',
  159 + 'gl_product' => 'product',
  160 + 'gl_product_category' => 'product_category',
  161 + 'gl_blog' => 'blog',
  162 + 'gl_blog_category' => 'blog_category',
  163 + 'gl_news' => 'news',
  164 + 'gl_news_category' => 'news_category',
  165 + 'gl_product_keyword' => 'product_keyword',
  166 + 'gl_custom_module_category' => 'module_category',
  167 + 'gl_custom_module_content' => 'module',
  168 + ];
  169 +
  170 + /**
  171 + * '表' => '对应数据路由字段'
  172 + * @return array
  173 + * @author akun
  174 + * @date 2024/11/14
  175 + */
  176 + protected $maps_route = [
  177 + 'gl_web_custom_template' => 'url',
  178 + 'gl_product' => 'route',
  179 + 'gl_product_category' => 'route',
  180 + 'gl_blog' => 'url',
  181 + 'gl_blog_category' => 'alias',
  182 + 'gl_news' => 'url',
  183 + 'gl_news_category' => 'alias',
  184 + 'gl_product_keyword' => 'route',
  185 + 'gl_custom_module_category' => 'route',
  186 + 'gl_custom_module_content' => 'route',
  187 + ];
  188 +
  189 + /**
138 * @return bool 190 * @return bool
139 */ 191 */
140 public function handle() 192 public function handle()
@@ -324,9 +376,15 @@ class UpdateSeoTdkByTaskId extends Command @@ -324,9 +376,15 @@ class UpdateSeoTdkByTaskId extends Command
324 $data[$json_field] = json_encode($data[$json_field]); 376 $data[$json_field] = json_encode($data[$json_field]);
325 } 377 }
326 DB::connection('custom_mysql')->table($table)->where(['id' => $v['id']])->update($data); 378 DB::connection('custom_mysql')->table($table)->where(['id' => $v['id']])->update($data);
327 - if($table == 'gl_product_keyword'){  
328 - $notify_keyword = true;  
329 - }else{ 379 +// if($table == 'gl_product_keyword'){
  380 +// $notify_keyword = true;
  381 +// }else{
  382 +// $notify_master = true;
  383 +// }
  384 + //tdk已更新的数据,存入按需更新表
  385 + $route = DB::connection('custom_mysql')->table($table)->where(['id' => $v['id']])->value($this->maps_route[$table]);
  386 + if($route){
  387 + UpdateNotify::addUpdateItem($project_id,$this->maps_type[$table],$route);
330 $notify_master = true; 388 $notify_master = true;
331 } 389 }
332 } 390 }
@@ -335,8 +393,9 @@ class UpdateSeoTdkByTaskId extends Command @@ -335,8 +393,9 @@ class UpdateSeoTdkByTaskId extends Command
335 ProjectUpdateTdk::finish($task_id, $update); 393 ProjectUpdateTdk::finish($task_id, $update);
336 394
337 //通知C端更新界面 395 //通知C端更新界面
338 - $notify_master && $this->sendNotify($project_id, 1); //通知主站更新  
339 - $notify_keyword && $this->sendNotify($project_id, 4); //通知聚合页更新 396 +// $notify_master && $this->sendNotify($project_id, 1); //通知主站更新
  397 +// $notify_keyword && $this->sendNotify($project_id, 4); //通知聚合页更新
  398 + $notify_master && $this->sendNotify($project_id, 2); //通知主站按需更新
340 } 399 }
341 400
342 public function getPrompt($project_id, $prompt, $table, $data){ 401 public function getPrompt($project_id, $prompt, $table, $data){
@@ -378,7 +437,7 @@ class UpdateSeoTdkByTaskId extends Command @@ -378,7 +437,7 @@ class UpdateSeoTdkByTaskId extends Command
378 $projectKeywordModel = new ProjectKeyword(); 437 $projectKeywordModel = new ProjectKeyword();
379 $keywordInfo = $projectKeywordModel->read(['project_id'=>$project_id]); 438 $keywordInfo = $projectKeywordModel->read(['project_id'=>$project_id]);
380 $info['main_keyword'] = ''; 439 $info['main_keyword'] = '';
381 - if($keywordInfo === false){ 440 + if(!empty($keywordInfo['main_keyword'])){
382 $info['main_keyword'] = $keywordInfo['main_keyword']; 441 $info['main_keyword'] = $keywordInfo['main_keyword'];
383 } 442 }
384 Cache::put($cache_key, $info, 600); 443 Cache::put($cache_key, $info, 600);