Merge branch 'master' of http://47.244.231.31:8099/zhl/globalso-v6
正在显示
3 个修改的文件
包含
77 行增加
和
11 行删除
| @@ -39,17 +39,64 @@ class Temp extends Command | @@ -39,17 +39,64 @@ class Temp extends Command | ||
| 39 | */ | 39 | */ |
| 40 | protected $description = '临时脚本(akun)'; | 40 | protected $description = '临时脚本(akun)'; |
| 41 | 41 | ||
| 42 | - public function handle() | 42 | + public function handle(){ |
| 43 | + | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + /** | ||
| 47 | + * www.docareco.com批量设置301跳转 | ||
| 48 | + * @author Akun | ||
| 49 | + * @date 2025/04/21 16:12 | ||
| 50 | + */ | ||
| 51 | + public function setDomain301() | ||
| 43 | { | 52 | { |
| 53 | + $domain_extend_config = DomainInfo::where('domain', 'www.docareco.com')->value('extend_config'); | ||
| 54 | + | ||
| 55 | + $domain_origin_list = $domain_extend_config ? array_column($domain_extend_config, 'origin') : []; | ||
| 56 | + | ||
| 57 | + //读取csv文件 | ||
| 58 | + $file = 'C:\Users\Akun\Desktop\有排名网页-还未做301-4.21.csv'; | ||
| 59 | + $line_of_text = []; | ||
| 60 | + try { | ||
| 61 | + $file_handle = fopen($file, 'r'); | ||
| 62 | + while (!feof($file_handle)) { | ||
| 63 | + $line_of_text[] = fgetcsv($file_handle, 0, ','); | ||
| 64 | + } | ||
| 65 | + fclose($file_handle); | ||
| 66 | + } catch (\Exception $e) { | ||
| 67 | + $this->output($e->getMessage()); | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + if (count($line_of_text) > 1) { | ||
| 71 | + foreach ($line_of_text as $k => $v) { | ||
| 72 | + if ($k > 0 && $v) { | ||
| 73 | + $origin = str_replace('https://www.docareco.com', '', $v[0]); | ||
| 74 | + $target = str_replace('https://www.docareco.com', '', $v[1]); | ||
| 75 | + | ||
| 76 | + if (!in_array($origin, $domain_origin_list)) { | ||
| 77 | + $domain_extend_config[] = [ | ||
| 78 | + 'origin' => $origin, | ||
| 79 | + 'target' => $target | ||
| 80 | + ]; | ||
| 81 | + } | ||
| 82 | + } | ||
| 83 | + } | ||
| 84 | + } | ||
| 85 | + | ||
| 86 | + DomainInfo::where('domain', 'www.docareco.com')->update(['extend_config' => Arr::a2s($domain_extend_config)]); | ||
| 44 | 87 | ||
| 88 | + $this->output('success'); | ||
| 45 | } | 89 | } |
| 46 | 90 | ||
| 91 | + | ||
| 92 | + | ||
| 47 | /** | 93 | /** |
| 48 | * 未被标注 特殊前后缀 && 未达标项目 && 优化开始时间 > 2025-01-01 00:00:00 ,开启自动添加聚合页关键词的前后缀关键词配置 | 94 | * 未被标注 特殊前后缀 && 未达标项目 && 优化开始时间 > 2025-01-01 00:00:00 ,开启自动添加聚合页关键词的前后缀关键词配置 |
| 49 | * @author Akun | 95 | * @author Akun |
| 50 | * @date 2025/04/02 14:00 | 96 | * @date 2025/04/02 14:00 |
| 51 | */ | 97 | */ |
| 52 | - public function changeIsAutoKeywords(){ | 98 | + public function changeIsAutoKeywords() |
| 99 | + { | ||
| 53 | $project_list = DeployOptimize::where('special', 'not like', '%,8,%')->where('start_date', '>', '2025-01-01 00:00:00')->get(); | 100 | $project_list = DeployOptimize::where('special', 'not like', '%,8,%')->where('start_date', '>', '2025-01-01 00:00:00')->get(); |
| 54 | 101 | ||
| 55 | foreach ($project_list as $project) { | 102 | foreach ($project_list as $project) { |
| @@ -195,17 +195,36 @@ class DomainInfoLogic extends BaseLogic | @@ -195,17 +195,36 @@ class DomainInfoLogic extends BaseLogic | ||
| 195 | } | 195 | } |
| 196 | } | 196 | } |
| 197 | 197 | ||
| 198 | - //如果要开通amp站点,判断m域名是否已经解析 | 198 | + $domain_array = parse_url($info['domain']); |
| 199 | + $host = $domain_array['host'] ?? $domain_array['path']; | ||
| 200 | + $host_array = explode('.',$host); | ||
| 201 | + | ||
| 202 | + if($this->param['type'] == 3){ | ||
| 203 | + //需要申请通配符证书,判断_acme-challenge是否已经解析 | ||
| 204 | + $host_array_ssl = $host_array; | ||
| 205 | + if (count($host_array_ssl) <= 2) { | ||
| 206 | + array_unshift($host_array_ssl, '_acme-challenge'); | ||
| 207 | + } else { | ||
| 208 | + $host_array_ssl[0] = '_acme-challenge'; | ||
| 209 | + } | ||
| 210 | + $ssl_domain = implode('.',$host_array_ssl); | ||
| 211 | + | ||
| 212 | + $ssl_records = dns_get_record($ssl_domain,DNS_CNAME); | ||
| 213 | + $ssl_target = $ssl_records[0]['target']??''; | ||
| 214 | + if($ssl_target != '_acme-challenge.globalsosslcheck.com'){ | ||
| 215 | + $this->fail('域名' . $ssl_domain . '未解析至目标服务器'); | ||
| 216 | + } | ||
| 217 | + } | ||
| 218 | + | ||
| 199 | if(isset($this->param['amp_status']) && $this->param['amp_status'] == 1){ | 219 | if(isset($this->param['amp_status']) && $this->param['amp_status'] == 1){ |
| 200 | - $domain_array = parse_url($info['domain']); | ||
| 201 | - $host = $domain_array['host'] ?? $domain_array['path']; | ||
| 202 | - $host_array = explode('.',$host); | ||
| 203 | - if (count($host_array) <= 2) { | ||
| 204 | - array_unshift($host_array, 'm'); | 220 | + //需要开通amp站点,判断m域名是否已经解析 |
| 221 | + $host_array_amp = $host_array; | ||
| 222 | + if (count($host_array_amp) <= 2) { | ||
| 223 | + array_unshift($host_array_amp, 'm'); | ||
| 205 | } else { | 224 | } else { |
| 206 | - $host_array[0] = 'm'; | 225 | + $host_array_amp[0] = 'm'; |
| 207 | } | 226 | } |
| 208 | - $amp_domain = implode('.',$host_array); | 227 | + $amp_domain = implode('.',$host_array_amp); |
| 209 | if(!check_domain_record($amp_domain, $serversIpInfo)){ | 228 | if(!check_domain_record($amp_domain, $serversIpInfo)){ |
| 210 | $this->fail('AMP站点域名' . $amp_domain . '未解析至目标服务器'); | 229 | $this->fail('AMP站点域名' . $amp_domain . '未解析至目标服务器'); |
| 211 | } | 230 | } |
| @@ -46,7 +46,7 @@ class OptimizeCheckLog extends Base | @@ -46,7 +46,7 @@ class OptimizeCheckLog extends Base | ||
| 46 | $param['images'] = Arr::a2s($param['images'] ?? []); | 46 | $param['images'] = Arr::a2s($param['images'] ?? []); |
| 47 | } | 47 | } |
| 48 | $param['operator_id'] = $manage_id; | 48 | $param['operator_id'] = $manage_id; |
| 49 | - $param['date'] = date('Y-m-d H:i:s'); | 49 | + $param['date'] = $param['date'] ?? date('Y-m-d H:i:s'); |
| 50 | return $param; | 50 | return $param; |
| 51 | } | 51 | } |
| 52 | } | 52 | } |
-
请 注册 或 登录 后发表评论