Merge branch 'master' of http://47.244.231.31:8099/zhl/globalso-v6 into master-server
正在显示
3 个修改的文件
包含
82 行增加
和
27 行删除
| @@ -477,6 +477,17 @@ class UpdateSeoTdk extends Command | @@ -477,6 +477,17 @@ class UpdateSeoTdk extends Command | ||
| 477 | $prompt = str_replace($val, $keyword, $prompt); | 477 | $prompt = str_replace($val, $keyword, $prompt); |
| 478 | } | 478 | } |
| 479 | } | 479 | } |
| 480 | + | ||
| 481 | + // 多个核心关键词 | ||
| 482 | + if(strpos($prompt, '{core keywords 8}') !== false) { | ||
| 483 | + $main_keyword = $this->mainKeywords($project_id, 8); | ||
| 484 | + if(!$main_keyword){ | ||
| 485 | + echo '核心关键词为空 跳过' . PHP_EOL; | ||
| 486 | + return false; | ||
| 487 | + } | ||
| 488 | + $prompt = str_replace('{core keywords 8}', $main_keyword, $prompt); | ||
| 489 | + } | ||
| 490 | + | ||
| 480 | $prompt .= '.Please answer in ' . $this->getLang(); | 491 | $prompt .= '.Please answer in ' . $this->getLang(); |
| 481 | return $prompt; | 492 | return $prompt; |
| 482 | } | 493 | } |
| @@ -12,10 +12,12 @@ use App\Models\Product\Keyword; | @@ -12,10 +12,12 @@ use App\Models\Product\Keyword; | ||
| 12 | use App\Models\Product\KeywordRelated; | 12 | use App\Models\Product\KeywordRelated; |
| 13 | use App\Models\Product\Product; | 13 | use App\Models\Product\Product; |
| 14 | use App\Models\Project\Project; | 14 | use App\Models\Project\Project; |
| 15 | +use App\Models\Project\ProjectUpdateTdk; | ||
| 15 | use App\Models\WebSetting\WebLanguage; | 16 | use App\Models\WebSetting\WebLanguage; |
| 16 | use App\Services\BatchExportService; | 17 | use App\Services\BatchExportService; |
| 17 | use App\Services\ProjectServer; | 18 | use App\Services\ProjectServer; |
| 18 | use Illuminate\Console\Command; | 19 | use Illuminate\Console\Command; |
| 20 | +use Illuminate\Support\Facades\DB; | ||
| 19 | 21 | ||
| 20 | class Temp extends Command | 22 | class Temp extends Command |
| 21 | { | 23 | { |
| @@ -35,7 +37,43 @@ class Temp extends Command | @@ -35,7 +37,43 @@ class Temp extends Command | ||
| 35 | 37 | ||
| 36 | public function handle() | 38 | public function handle() |
| 37 | { | 39 | { |
| 38 | - $this->create_update_keyword_page(); | 40 | + $this->check_no_cname_projects(); |
| 41 | + } | ||
| 42 | + | ||
| 43 | + /** | ||
| 44 | + * 2025-02-05 日以来的项目,重写tdk(keyword_title) | ||
| 45 | + * @author Akun | ||
| 46 | + * @date 2025/02/15 10:58 | ||
| 47 | + */ | ||
| 48 | + public function product_keyword_rewrite() | ||
| 49 | + { | ||
| 50 | + $products = ProjectUpdateTdk::where('created_at', '>=', '2025-02-05 00:00:00')->pluck('project_id')->toArray(); | ||
| 51 | + $products_ids = array_unique($products); | ||
| 52 | + | ||
| 53 | + $success_json = file_get_contents(storage_path('logs/lk/success.log')); | ||
| 54 | + $success = json_decode($success_json, true) ?: []; | ||
| 55 | + | ||
| 56 | + foreach ($products_ids as $project_id) { | ||
| 57 | + if (in_array($project_id, $success)) { | ||
| 58 | + $this->output($project_id . ' | 已执行,跳过'); | ||
| 59 | + continue; | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + ProjectServer::useProject($project_id); | ||
| 63 | + DB::connection('custom_mysql')->table('gl_product_keyword')->update(['keyword_title' => '']); | ||
| 64 | + | ||
| 65 | + try { | ||
| 66 | + ProjectUpdateTdk::add_task($project_id); | ||
| 67 | + } catch (\Exception $e) { | ||
| 68 | + $this->output($project_id . ' | ' . $e->getMessage()); | ||
| 69 | + } | ||
| 70 | + | ||
| 71 | + DB::disconnect('custom_mysql'); | ||
| 72 | + array_push($success, $project_id); | ||
| 73 | + file_put_contents(storage_path('logs/lk/success.log'), json_encode($success)); | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | + $this->output('success'); | ||
| 39 | } | 77 | } |
| 40 | 78 | ||
| 41 | /** | 79 | /** |
| @@ -342,8 +380,8 @@ class Temp extends Command | @@ -342,8 +380,8 @@ class Temp extends Command | ||
| 342 | */ | 380 | */ |
| 343 | public function check_no_cname_projects() | 381 | public function check_no_cname_projects() |
| 344 | { | 382 | { |
| 345 | - $server_id = 15; | ||
| 346 | - $server_name = '美服1'; | 383 | + $server_id = 1; |
| 384 | + $server_name = '硅谷云服务器'; | ||
| 347 | 385 | ||
| 348 | $server_ip_model = new ServersIp(); | 386 | $server_ip_model = new ServersIp(); |
| 349 | 387 | ||
| @@ -575,7 +613,7 @@ class Temp extends Command | @@ -575,7 +613,7 @@ class Temp extends Command | ||
| 575 | */ | 613 | */ |
| 576 | public function create_update_keyword_page() | 614 | public function create_update_keyword_page() |
| 577 | { | 615 | { |
| 578 | - $ids_arr = ["46","83","91","150","190","206","219","221","232","233","238","287","290","299","319","321","353","356","388","389","456","457","475","491","518","535","554","600","624","650","728","732","783","807","835","881","896","913","947","1001","1320","1336","1373","1424","1442","1455","1466","1505","1584","1597","1617","1682","1770","1816","1824","1835","1860","1870","1896","1913","1989","1991","1992","2022","2037","2059","2060","2062","2104","2115","2129","2131","2135","2191","2204","2217","2245","2257","2287","2309","2313","2330","2336","2337","2338","2351","2391","2418","2423","2435","2462","2496","2504","2505","2660","2768","2811","2874","3157"]; | 616 | + $ids_arr = ["46", "83", "91", "150", "190", "206", "219", "221", "232", "233", "238", "287", "290", "299", "319", "321", "353", "356", "388", "389", "456", "457", "475", "491", "518", "535", "554", "600", "624", "650", "728", "732", "783", "807", "835", "881", "896", "913", "947", "1001", "1320", "1336", "1373", "1424", "1442", "1455", "1466", "1505", "1584", "1597", "1617", "1682", "1770", "1816", "1824", "1835", "1860", "1870", "1896", "1913", "1989", "1991", "1992", "2022", "2037", "2059", "2060", "2062", "2104", "2115", "2129", "2131", "2135", "2191", "2204", "2217", "2245", "2257", "2287", "2309", "2313", "2330", "2336", "2337", "2338", "2351", "2391", "2418", "2423", "2435", "2462", "2496", "2504", "2505", "2660", "2768", "2811", "2874", "3157"]; |
| 579 | $project_list = Project::select(['id', 'serve_id'])->whereIn('id', $ids_arr)->get(); | 617 | $project_list = Project::select(['id', 'serve_id'])->whereIn('id', $ids_arr)->get(); |
| 580 | 618 | ||
| 581 | $domain_model = new DomainInfo(); | 619 | $domain_model = new DomainInfo(); |
| @@ -367,16 +367,16 @@ class ProjectUpdate extends Command | @@ -367,16 +367,16 @@ class ProjectUpdate extends Command | ||
| 367 | 'six_read' => 1, | 367 | 'six_read' => 1, |
| 368 | 'route' => $route | 368 | 'route' => $route |
| 369 | ]); | 369 | ]); |
| 370 | - if(!empty($content)){ | 370 | + if (!empty($content)) { |
| 371 | $data_s = [ | 371 | $data_s = [ |
| 372 | - 'product_id'=>$id, | ||
| 373 | - 'column_id'=>1, | ||
| 374 | - 'text_type'=>1, | ||
| 375 | - 'title'=>'product detail', | ||
| 376 | - 'sort'=>1, | ||
| 377 | - 'content'=>json_encode(['content'=>$content ?? ''],JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES), | ||
| 378 | - 'created_at'=>date('Y-m-d H:i:s'), | ||
| 379 | - 'updated_at'=>date('Y-m-d H:i:s') | 372 | + 'product_id' => $id, |
| 373 | + 'column_id' => 1, | ||
| 374 | + 'text_type' => 1, | ||
| 375 | + 'title' => 'product detail', | ||
| 376 | + 'sort' => 1, | ||
| 377 | + 'content' => json_encode(['content' => $content ?? ''], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES), | ||
| 378 | + 'created_at' => date('Y-m-d H:i:s'), | ||
| 379 | + 'updated_at' => date('Y-m-d H:i:s') | ||
| 380 | ]; | 380 | ]; |
| 381 | $detailModel = new Detail(); | 381 | $detailModel = new Detail(); |
| 382 | $detailModel->insert($data_s); | 382 | $detailModel->insert($data_s); |
| @@ -407,18 +407,18 @@ class ProjectUpdate extends Command | @@ -407,18 +407,18 @@ class ProjectUpdate extends Command | ||
| 407 | 'sort' => $item['sort'] ?? 0, | 407 | 'sort' => $item['sort'] ?? 0, |
| 408 | 'files' => $files, | 408 | 'files' => $files, |
| 409 | ], ['id' => $id]); | 409 | ], ['id' => $id]); |
| 410 | - if(!empty($content)){ | 410 | + if (!empty($content)) { |
| 411 | $detailModel = new Detail(); | 411 | $detailModel = new Detail(); |
| 412 | - $detailModel->del(['product_id'=>$id,'column_id'=>1]); | 412 | + $detailModel->del(['product_id' => $id, 'column_id' => 1]); |
| 413 | $data_s = [ | 413 | $data_s = [ |
| 414 | - 'product_id'=>$id, | ||
| 415 | - 'column_id'=>1, | ||
| 416 | - 'text_type'=>1, | ||
| 417 | - 'title'=>'product detail', | ||
| 418 | - 'sort'=>1, | ||
| 419 | - 'content'=>json_encode(['content'=>$content ?? ''],JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES), | ||
| 420 | - 'created_at'=>date('Y-m-d H:i:s'), | ||
| 421 | - 'updated_at'=>date('Y-m-d H:i:s') | 414 | + 'product_id' => $id, |
| 415 | + 'column_id' => 1, | ||
| 416 | + 'text_type' => 1, | ||
| 417 | + 'title' => 'product detail', | ||
| 418 | + 'sort' => 1, | ||
| 419 | + 'content' => json_encode(['content' => $content ?? ''], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES), | ||
| 420 | + 'created_at' => date('Y-m-d H:i:s'), | ||
| 421 | + 'updated_at' => date('Y-m-d H:i:s') | ||
| 422 | ]; | 422 | ]; |
| 423 | $detailModel->insert($data_s); | 423 | $detailModel->insert($data_s); |
| 424 | } | 424 | } |
| @@ -706,14 +706,20 @@ class ProjectUpdate extends Command | @@ -706,14 +706,20 @@ class ProjectUpdate extends Command | ||
| 706 | $route = $this->get_url_route($item['url'] ?? ''); | 706 | $route = $this->get_url_route($item['url'] ?? ''); |
| 707 | if ($route) { | 707 | if ($route) { |
| 708 | //分类 | 708 | //分类 |
| 709 | + $category_custom = $category_model->read(['route' => $custom_info['route']], 'id'); | ||
| 710 | + $category_model_id = $category_custom ? $category_custom['id'] : 0; | ||
| 711 | + | ||
| 709 | $category_id = ''; | 712 | $category_id = ''; |
| 710 | if ($item['category'] ?? []) { | 713 | if ($item['category'] ?? []) { |
| 711 | $category_arr = $category_model->list(['original_id' => ['in', array_column($item['category'], 'id')]]); | 714 | $category_arr = $category_model->list(['original_id' => ['in', array_column($item['category'], 'id')]]); |
| 712 | - $category_id = implode(',', array_column($category_arr, 'id')); | 715 | + $category_id_arr = array_column($category_arr, 'id'); |
| 716 | + if ($category_model_id > 0 && (!in_array($category_model_id, $category_id_arr))) { | ||
| 717 | + array_push($category_id_arr, $category_model_id); | ||
| 718 | + } | ||
| 719 | + $category_id = implode(',', $category_id_arr); | ||
| 713 | } else { | 720 | } else { |
| 714 | - $category_custom = $category_model->read(['route' => $custom_info['route']], 'id'); | ||
| 715 | - if ($category_custom) { | ||
| 716 | - $category_id = $category_custom['id']; | 721 | + if ($category_model_id > 0) { |
| 722 | + $category_id = $category_model_id; | ||
| 717 | } | 723 | } |
| 718 | } | 724 | } |
| 719 | if ($category_id) { | 725 | if ($category_id) { |
-
请 注册 或 登录 后发表评论