作者 刘锟

合并分支 'akun' 到 'master'

Akun



查看合并请求 !1111
... ... @@ -12,10 +12,12 @@ use App\Models\Product\Keyword;
use App\Models\Product\KeywordRelated;
use App\Models\Product\Product;
use App\Models\Project\Project;
use App\Models\Project\ProjectUpdateTdk;
use App\Models\WebSetting\WebLanguage;
use App\Services\BatchExportService;
use App\Services\ProjectServer;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
class Temp extends Command
{
... ... @@ -35,7 +37,43 @@ class Temp extends Command
public function handle()
{
$this->create_update_keyword_page();
$this->product_keyword_rewrite();
}
/**
* 2025-02-05 日以来的项目,重写tdk(keyword_title)
* @author Akun
* @date 2025/02/15 10:58
*/
public function product_keyword_rewrite()
{
$products = ProjectUpdateTdk::where('created_at', '>=', '2025-02-05 00:00:00')->pluck('project_id');
$products_ids = array_unique($products);
$success_json = file_get_contents(storage_path('logs/lk/success.log'));
$success = json_decode($success_json, true) ?: [];
foreach ($products_ids as $project_id) {
if (in_array($project_id, $success)) {
$this->output($project_id . ' | 已执行,跳过');
continue;
}
ProjectServer::useProject($project_id);
DB::connection('custom_mysql')->table('gl_product_keyword')->update(['keyword_title' => '']);
try {
ProjectUpdateTdk::add_task($project_id);
} catch (\Exception $e) {
$this->output($project_id . ' | ' . $e->getMessage());
}
DB::disconnect('custom_mysql');
array_push($success, $project_id);
file_put_contents(storage_path('logs/zhl/success.log'), json_encode($success));
}
$this->output('success');
}
/**
... ... @@ -575,7 +613,7 @@ class Temp extends Command
*/
public function create_update_keyword_page()
{
$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"];
$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"];
$project_list = Project::select(['id', 'serve_id'])->whereIn('id', $ids_arr)->get();
$domain_model = new DomainInfo();
... ...