作者 刘锟

合并分支 'akun' 到 'master'

Akun



查看合并请求 !1111
@@ -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->product_keyword_rewrite();
  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');
  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/zhl/success.log'), json_encode($success));
  74 + }
  75 +
  76 + $this->output('success');
39 } 77 }
40 78
41 /** 79 /**
@@ -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();