作者 刘锟

update

... ... @@ -39,17 +39,64 @@ class Temp extends Command
*/
protected $description = '临时脚本(akun)';
public function handle()
public function handle(){
}
/**
* www.docareco.com批量设置301跳转
* @author Akun
* @date 2025/04/21 16:12
*/
public function setDomain301()
{
$domain_extend_config = DomainInfo::where('domain', 'www.docareco.com')->value('extend_config');
$domain_origin_list = $domain_extend_config ? array_column($domain_extend_config, 'origin') : [];
//读取csv文件
$file = 'C:\Users\Akun\Desktop\有排名网页-还未做301-4.21.csv';
$line_of_text = [];
try {
$file_handle = fopen($file, 'r');
while (!feof($file_handle)) {
$line_of_text[] = fgetcsv($file_handle, 0, ',');
}
fclose($file_handle);
} catch (\Exception $e) {
$this->output($e->getMessage());
}
if (count($line_of_text) > 1) {
foreach ($line_of_text as $k => $v) {
if ($k > 0 && $v) {
$origin = str_replace('https://www.docareco.com', '', $v[0]);
$target = str_replace('https://www.docareco.com', '', $v[1]);
if (!in_array($origin, $domain_origin_list)) {
$domain_extend_config[] = [
'origin' => $origin,
'target' => $target
];
}
}
}
}
DomainInfo::where('domain', 'www.docareco.com')->update(['extend_config' => Arr::a2s($domain_extend_config)]);
$this->output('success');
}
/**
* 未被标注 特殊前后缀 && 未达标项目 && 优化开始时间 > 2025-01-01 00:00:00 ,开启自动添加聚合页关键词的前后缀关键词配置
* @author Akun
* @date 2025/04/02 14:00
*/
public function changeIsAutoKeywords(){
public function changeIsAutoKeywords()
{
$project_list = DeployOptimize::where('special', 'not like', '%,8,%')->where('start_date', '>', '2025-01-01 00:00:00')->get();
foreach ($project_list as $project) {
... ...