作者 lyh

Merge branch 'master' of http://47.244.231.31:8099/zhl/globalso-v6 into master-server

... ... @@ -477,6 +477,17 @@ class UpdateSeoTdk extends Command
$prompt = str_replace($val, $keyword, $prompt);
}
}
// 多个核心关键词
if(strpos($prompt, '{core keywords 8}') !== false) {
$main_keyword = $this->mainKeywords($project_id, 8);
if(!$main_keyword){
echo '核心关键词为空 跳过' . PHP_EOL;
return false;
}
$prompt = str_replace('{core keywords 8}', $main_keyword, $prompt);
}
$prompt .= '.Please answer in ' . $this->getLang();
return $prompt;
}
... ...
... ... @@ -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->check_no_cname_projects();
}
/**
* 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')->toArray();
$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/lk/success.log'), json_encode($success));
}
$this->output('success');
}
/**
... ... @@ -342,8 +380,8 @@ class Temp extends Command
*/
public function check_no_cname_projects()
{
$server_id = 15;
$server_name = '美服1';
$server_id = 1;
$server_name = '硅谷云服务器';
$server_ip_model = new ServersIp();
... ... @@ -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();
... ...
... ... @@ -367,16 +367,16 @@ class ProjectUpdate extends Command
'six_read' => 1,
'route' => $route
]);
if(!empty($content)){
if (!empty($content)) {
$data_s = [
'product_id'=>$id,
'column_id'=>1,
'text_type'=>1,
'title'=>'product detail',
'sort'=>1,
'content'=>json_encode(['content'=>$content ?? ''],JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES),
'created_at'=>date('Y-m-d H:i:s'),
'updated_at'=>date('Y-m-d H:i:s')
'product_id' => $id,
'column_id' => 1,
'text_type' => 1,
'title' => 'product detail',
'sort' => 1,
'content' => json_encode(['content' => $content ?? ''], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES),
'created_at' => date('Y-m-d H:i:s'),
'updated_at' => date('Y-m-d H:i:s')
];
$detailModel = new Detail();
$detailModel->insert($data_s);
... ... @@ -407,18 +407,18 @@ class ProjectUpdate extends Command
'sort' => $item['sort'] ?? 0,
'files' => $files,
], ['id' => $id]);
if(!empty($content)){
if (!empty($content)) {
$detailModel = new Detail();
$detailModel->del(['product_id'=>$id,'column_id'=>1]);
$detailModel->del(['product_id' => $id, 'column_id' => 1]);
$data_s = [
'product_id'=>$id,
'column_id'=>1,
'text_type'=>1,
'title'=>'product detail',
'sort'=>1,
'content'=>json_encode(['content'=>$content ?? ''],JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES),
'created_at'=>date('Y-m-d H:i:s'),
'updated_at'=>date('Y-m-d H:i:s')
'product_id' => $id,
'column_id' => 1,
'text_type' => 1,
'title' => 'product detail',
'sort' => 1,
'content' => json_encode(['content' => $content ?? ''], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES),
'created_at' => date('Y-m-d H:i:s'),
'updated_at' => date('Y-m-d H:i:s')
];
$detailModel->insert($data_s);
}
... ... @@ -706,14 +706,20 @@ class ProjectUpdate extends Command
$route = $this->get_url_route($item['url'] ?? '');
if ($route) {
//分类
$category_custom = $category_model->read(['route' => $custom_info['route']], 'id');
$category_model_id = $category_custom ? $category_custom['id'] : 0;
$category_id = '';
if ($item['category'] ?? []) {
$category_arr = $category_model->list(['original_id' => ['in', array_column($item['category'], 'id')]]);
$category_id = implode(',', array_column($category_arr, 'id'));
$category_id_arr = array_column($category_arr, 'id');
if ($category_model_id > 0 && (!in_array($category_model_id, $category_id_arr))) {
array_push($category_id_arr, $category_model_id);
}
$category_id = implode(',', $category_id_arr);
} else {
$category_custom = $category_model->read(['route' => $custom_info['route']], 'id');
if ($category_custom) {
$category_id = $category_custom['id'];
if ($category_model_id > 0) {
$category_id = $category_model_id;
}
}
if ($category_id) {
... ...