|
...
|
...
|
@@ -41,22 +41,24 @@ class Temp extends Command |
|
|
|
|
|
|
|
public function handle()
|
|
|
|
{
|
|
|
|
$this->create_all_amp_notify();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* www.docareco.com批量设置301跳转
|
|
|
|
* 批量设置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 = 'www.lvtopsun.com';
|
|
|
|
|
|
|
|
$domain_extend_config = DomainInfo::where('domain', $domain)->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';
|
|
|
|
$file = 'C:\Users\Akun\Desktop\广东绿达新能源有限公司设置301页面.csv';
|
|
|
|
$line_of_text = [];
|
|
|
|
try {
|
|
|
|
$file_handle = fopen($file, 'r');
|
|
...
|
...
|
@@ -71,8 +73,8 @@ class Temp extends Command |
|
|
|
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]);
|
|
|
|
$origin = str_replace('https://'.$domain, '', $v[0]);
|
|
|
|
$target = str_replace('https://'.$domain, '', $v[1]);
|
|
|
|
|
|
|
|
if (!in_array($origin, $domain_origin_list)) {
|
|
|
|
$domain_extend_config[] = [
|
|
...
|
...
|
@@ -84,7 +86,7 @@ class Temp extends Command |
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
DomainInfo::where('domain', 'www.docareco.com')->update(['extend_config' => Arr::a2s($domain_extend_config)]);
|
|
|
|
DomainInfo::where('domain', $domain)->update(['extend_config' => Arr::a2s($domain_extend_config)]);
|
|
|
|
|
|
|
|
$this->output('success');
|
|
|
|
}
|
...
|
...
|
|