Merge branch 'master' of http://47.244.231.31:8099/zhl/globalso-v6 into master-server
正在显示
13 个修改的文件
包含
105 行增加
和
273 行删除
| @@ -84,7 +84,7 @@ class DomainInfo extends Command | @@ -84,7 +84,7 @@ class DomainInfo extends Command | ||
| 84 | //除自建站项目外,记录已解析到别的ip的域名 | 84 | //除自建站项目外,记录已解析到别的ip的域名 |
| 85 | if ($servers_ip_info['servers_id'] != ServerConfig::SELF_SITE_ID) { | 85 | if ($servers_ip_info['servers_id'] != ServerConfig::SELF_SITE_ID) { |
| 86 | //过滤已解析到别的ip的域名 | 86 | //过滤已解析到别的ip的域名 |
| 87 | - if (!$this->check_cname($v['domain'], $servers_ip_info)) { | 87 | + if (!check_domain_record($v['domain'], $servers_ip_info)) { |
| 88 | Log::channel('analyze_other')->error('域名 [' . $v['domain'] . '] 已解析到别的IP'); | 88 | Log::channel('analyze_other')->error('域名 [' . $v['domain'] . '] 已解析到别的IP'); |
| 89 | continue; | 89 | continue; |
| 90 | } | 90 | } |
| @@ -111,7 +111,7 @@ class DomainInfo extends Command | @@ -111,7 +111,7 @@ class DomainInfo extends Command | ||
| 111 | 111 | ||
| 112 | if ($servers_ip_info['servers_id'] != ServerConfig::SELF_SITE_ID) { | 112 | if ($servers_ip_info['servers_id'] != ServerConfig::SELF_SITE_ID) { |
| 113 | //过滤已解析到别的ip的AMP域名 | 113 | //过滤已解析到别的ip的AMP域名 |
| 114 | - if (!$this->check_cname($amp_domain, $servers_ip_info)) { | 114 | + if (!check_domain_record($amp_domain, $servers_ip_info)) { |
| 115 | Log::channel('analyze_other')->error('AMP域名 [' . $amp_domain . '] 已解析到别的IP'); | 115 | Log::channel('analyze_other')->error('AMP域名 [' . $amp_domain . '] 已解析到别的IP'); |
| 116 | continue; | 116 | continue; |
| 117 | } | 117 | } |
| @@ -158,7 +158,7 @@ class DomainInfo extends Command | @@ -158,7 +158,7 @@ class DomainInfo extends Command | ||
| 158 | } | 158 | } |
| 159 | 159 | ||
| 160 | //过滤已解析到别的ip的域名 | 160 | //过滤已解析到别的ip的域名 |
| 161 | - if (!$this->check_cname($v['domain'], $servers_ip_info)) { | 161 | + if (!check_domain_record($v['domain'], $servers_ip_info)) { |
| 162 | continue; | 162 | continue; |
| 163 | } | 163 | } |
| 164 | 164 | ||
| @@ -215,7 +215,7 @@ class DomainInfo extends Command | @@ -215,7 +215,7 @@ class DomainInfo extends Command | ||
| 215 | } | 215 | } |
| 216 | 216 | ||
| 217 | //过滤已解析到别的ip的域名 | 217 | //过滤已解析到别的ip的域名 |
| 218 | - if (!$this->check_cname($amp_domain, $servers_ip_info)) { | 218 | + if (!check_domain_record($amp_domain, $servers_ip_info)) { |
| 219 | continue; | 219 | continue; |
| 220 | } | 220 | } |
| 221 | 221 | ||
| @@ -262,7 +262,7 @@ class DomainInfo extends Command | @@ -262,7 +262,7 @@ class DomainInfo extends Command | ||
| 262 | } | 262 | } |
| 263 | 263 | ||
| 264 | //过滤已解析到别的ip的域名 | 264 | //过滤已解析到别的ip的域名 |
| 265 | - if (!$this->check_cname($v['custom_domain'], $servers_ip_info)) { | 265 | + if (!check_domain_record($v['custom_domain'], $servers_ip_info)) { |
| 266 | Log::channel('analyze_other')->error('自定义跳转域名 [' . $v['custom_domain'] . '] 已解析到别的IP'); | 266 | Log::channel('analyze_other')->error('自定义跳转域名 [' . $v['custom_domain'] . '] 已解析到别的IP'); |
| 267 | continue; | 267 | continue; |
| 268 | } | 268 | } |
| @@ -315,41 +315,4 @@ class DomainInfo extends Command | @@ -315,41 +315,4 @@ class DomainInfo extends Command | ||
| 315 | } | 315 | } |
| 316 | return ['from' => $valid_from, 'to' => $valid_to]; | 316 | return ['from' => $valid_from, 'to' => $valid_to]; |
| 317 | } | 317 | } |
| 318 | - | ||
| 319 | - /** | ||
| 320 | - * 验证是否cname或者A记录解析到目标服务器 | ||
| 321 | - * @param $domain | ||
| 322 | - * @param $server_info | ||
| 323 | - * @return mixed | ||
| 324 | - * @author zbj | ||
| 325 | - * @date 2023/11/13 | ||
| 326 | - */ | ||
| 327 | - public function check_cname($domain, $server_info) | ||
| 328 | - { | ||
| 329 | - $process = new Process(['nslookup', '-qt=a', $domain]); | ||
| 330 | - $process->run(); | ||
| 331 | - $output = explode(PHP_EOL, $process->getOutput()); | ||
| 332 | - foreach ($output as $line) { | ||
| 333 | - if ($line) { | ||
| 334 | - $checkA = strpos($line, $server_info['ip']) !== false; | ||
| 335 | - if ($checkA) { | ||
| 336 | - return $domain; | ||
| 337 | - } | ||
| 338 | - } | ||
| 339 | - } | ||
| 340 | - | ||
| 341 | - //是否cname | ||
| 342 | - $process = new Process(['nslookup', '-qt=cname', $domain]); | ||
| 343 | - $process->run(); | ||
| 344 | - $output = explode(PHP_EOL, $process->getOutput()); | ||
| 345 | - foreach ($output as $line) { | ||
| 346 | - if ($line) { | ||
| 347 | - $checkCname = (strpos($line, $server_info['domain']) !== false); | ||
| 348 | - if ($checkCname) { | ||
| 349 | - return $domain; | ||
| 350 | - } | ||
| 351 | - } | ||
| 352 | - } | ||
| 353 | - return false; | ||
| 354 | - } | ||
| 355 | } | 318 | } |
| @@ -40,7 +40,7 @@ class EmergencyRelieve extends Command | @@ -40,7 +40,7 @@ class EmergencyRelieve extends Command | ||
| 40 | 40 | ||
| 41 | //判断域名是否已经解析到目标服务器 | 41 | //判断域名是否已经解析到目标服务器 |
| 42 | $target_server = $server_ip_model->select(['id', 'ip', 'domain'])->where('id', $value->server_ip_id)->first()->toArray(); | 42 | $target_server = $server_ip_model->select(['id', 'ip', 'domain'])->where('id', $value->server_ip_id)->first()->toArray(); |
| 43 | - if (!$this->check_cname($domain_info['domain'], $target_server)) { | 43 | + if (!check_domain_record($domain_info['domain'], $target_server)) { |
| 44 | $this->output($domain_info['domain'] . ' | 未解析到目标服务器'); | 44 | $this->output($domain_info['domain'] . ' | 未解析到目标服务器'); |
| 45 | continue; | 45 | continue; |
| 46 | } | 46 | } |
| @@ -86,43 +86,6 @@ class EmergencyRelieve extends Command | @@ -86,43 +86,6 @@ class EmergencyRelieve extends Command | ||
| 86 | } | 86 | } |
| 87 | 87 | ||
| 88 | /** | 88 | /** |
| 89 | - * 验证是否cname或者A记录解析到目标服务器 | ||
| 90 | - * @param $domain | ||
| 91 | - * @param $server_info | ||
| 92 | - * @return mixed | ||
| 93 | - * @author zbj | ||
| 94 | - * @date 2023/11/13 | ||
| 95 | - */ | ||
| 96 | - public function check_cname($domain, $server_info) | ||
| 97 | - { | ||
| 98 | - $process = new Process(['nslookup', '-qt=a', $domain]); | ||
| 99 | - $process->run(); | ||
| 100 | - $output = explode(PHP_EOL, $process->getOutput()); | ||
| 101 | - foreach ($output as $line) { | ||
| 102 | - if ($line) { | ||
| 103 | - $checkA = strpos($line, $server_info['ip']) !== false; | ||
| 104 | - if ($checkA) { | ||
| 105 | - return $domain; | ||
| 106 | - } | ||
| 107 | - } | ||
| 108 | - } | ||
| 109 | - | ||
| 110 | - //是否cname | ||
| 111 | - $process = new Process(['nslookup', '-qt=cname', $domain]); | ||
| 112 | - $process->run(); | ||
| 113 | - $output = explode(PHP_EOL, $process->getOutput()); | ||
| 114 | - foreach ($output as $line) { | ||
| 115 | - if ($line) { | ||
| 116 | - $checkCname = (strpos($line, $server_info['domain']) !== false); | ||
| 117 | - if ($checkCname) { | ||
| 118 | - return $domain; | ||
| 119 | - } | ||
| 120 | - } | ||
| 121 | - } | ||
| 122 | - return false; | ||
| 123 | - } | ||
| 124 | - | ||
| 125 | - /** | ||
| 126 | * 输出处理日志 | 89 | * 输出处理日志 |
| 127 | * @param $message | 90 | * @param $message |
| 128 | */ | 91 | */ |
| @@ -42,7 +42,7 @@ class EmergencyRenewSite extends Command | @@ -42,7 +42,7 @@ class EmergencyRenewSite extends Command | ||
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | //判断域名是否已经解析到目标服务器 | 44 | //判断域名是否已经解析到目标服务器 |
| 45 | - if (!$this->check_cname($domain_info['domain'], $target_server)) { | 45 | + if (!check_domain_record($domain_info['domain'], $target_server)) { |
| 46 | $this->output($domain_info['domain'] . ' | 未解析到目标服务器'); | 46 | $this->output($domain_info['domain'] . ' | 未解析到目标服务器'); |
| 47 | continue; | 47 | continue; |
| 48 | } | 48 | } |
| @@ -93,43 +93,6 @@ class EmergencyRenewSite extends Command | @@ -93,43 +93,6 @@ class EmergencyRenewSite extends Command | ||
| 93 | } | 93 | } |
| 94 | 94 | ||
| 95 | /** | 95 | /** |
| 96 | - * 验证是否cname或者A记录解析到目标服务器 | ||
| 97 | - * @param $domain | ||
| 98 | - * @param $server_info | ||
| 99 | - * @return mixed | ||
| 100 | - * @author zbj | ||
| 101 | - * @date 2023/11/13 | ||
| 102 | - */ | ||
| 103 | - public function check_cname($domain, $server_info) | ||
| 104 | - { | ||
| 105 | - $process = new Process(['nslookup', '-qt=a', $domain]); | ||
| 106 | - $process->run(); | ||
| 107 | - $output = explode(PHP_EOL, $process->getOutput()); | ||
| 108 | - foreach ($output as $line) { | ||
| 109 | - if ($line) { | ||
| 110 | - $checkA = strpos($line, $server_info['ip']) !== false; | ||
| 111 | - if ($checkA) { | ||
| 112 | - return $domain; | ||
| 113 | - } | ||
| 114 | - } | ||
| 115 | - } | ||
| 116 | - | ||
| 117 | - //是否cname | ||
| 118 | - $process = new Process(['nslookup', '-qt=cname', $domain]); | ||
| 119 | - $process->run(); | ||
| 120 | - $output = explode(PHP_EOL, $process->getOutput()); | ||
| 121 | - foreach ($output as $line) { | ||
| 122 | - if ($line) { | ||
| 123 | - $checkCname = (strpos($line, $server_info['domain']) !== false); | ||
| 124 | - if ($checkCname) { | ||
| 125 | - return $domain; | ||
| 126 | - } | ||
| 127 | - } | ||
| 128 | - } | ||
| 129 | - return false; | ||
| 130 | - } | ||
| 131 | - | ||
| 132 | - /** | ||
| 133 | * 输出处理日志 | 96 | * 输出处理日志 |
| 134 | * @param $message | 97 | * @param $message |
| 135 | */ | 98 | */ |
| @@ -30,7 +30,7 @@ class ProjectDomainCheck extends Command | @@ -30,7 +30,7 @@ class ProjectDomainCheck extends Command | ||
| 30 | $project_info = $project_model->read(['id' => $value->project_id], ['id', 'serve_id', 'company']); | 30 | $project_info = $project_model->read(['id' => $value->project_id], ['id', 'serve_id', 'company']); |
| 31 | $server_ip_info = $server_ip_model->read(['id' => $project_info['serve_id']], ['ip', 'domain']); | 31 | $server_ip_info = $server_ip_model->read(['id' => $project_info['serve_id']], ['ip', 'domain']); |
| 32 | 32 | ||
| 33 | - if ($this->check_cname($value->domain, $server_ip_info)) { | 33 | + if (check_domain_record($value->domain, $server_ip_info)) { |
| 34 | continue; | 34 | continue; |
| 35 | } else { | 35 | } else { |
| 36 | $data[] = [ | 36 | $data[] = [ |
| @@ -58,43 +58,6 @@ class ProjectDomainCheck extends Command | @@ -58,43 +58,6 @@ class ProjectDomainCheck extends Command | ||
| 58 | } | 58 | } |
| 59 | 59 | ||
| 60 | /** | 60 | /** |
| 61 | - * 验证是否cname或者A记录解析到目标服务器 | ||
| 62 | - * @param $domain | ||
| 63 | - * @param $server_info | ||
| 64 | - * @return mixed | ||
| 65 | - * @author zbj | ||
| 66 | - * @date 2023/11/13 | ||
| 67 | - */ | ||
| 68 | - public function check_cname($domain, $server_info) | ||
| 69 | - { | ||
| 70 | - $process = new Process(['nslookup', '-qt=a', $domain]); | ||
| 71 | - $process->run(); | ||
| 72 | - $output = explode(PHP_EOL, $process->getOutput()); | ||
| 73 | - foreach ($output as $line) { | ||
| 74 | - if ($line) { | ||
| 75 | - $checkA = strpos($line, $server_info['ip']) !== false; | ||
| 76 | - if ($checkA) { | ||
| 77 | - return $domain; | ||
| 78 | - } | ||
| 79 | - } | ||
| 80 | - } | ||
| 81 | - | ||
| 82 | - //是否cname | ||
| 83 | - $process = new Process(['nslookup', '-qt=cname', $domain]); | ||
| 84 | - $process->run(); | ||
| 85 | - $output = explode(PHP_EOL, $process->getOutput()); | ||
| 86 | - foreach ($output as $line) { | ||
| 87 | - if ($line) { | ||
| 88 | - $checkCname = (strpos($line, $server_info['domain']) !== false); | ||
| 89 | - if ($checkCname) { | ||
| 90 | - return $domain; | ||
| 91 | - } | ||
| 92 | - } | ||
| 93 | - } | ||
| 94 | - return false; | ||
| 95 | - } | ||
| 96 | - | ||
| 97 | - /** | ||
| 98 | * 输出处理日志 | 61 | * 输出处理日志 |
| 99 | * @param $message | 62 | * @param $message |
| 100 | */ | 63 | */ |
| @@ -100,13 +100,18 @@ class postInquiry extends Command | @@ -100,13 +100,18 @@ class postInquiry extends Command | ||
| 100 | }else{ | 100 | }else{ |
| 101 | //v4 v5分离项目 往测试链接推 | 101 | //v4 v5分离项目 往测试链接推 |
| 102 | $website = $detail['re_website']; | 102 | $website = $detail['re_website']; |
| 103 | - $site_array = file_get_contents('https://www.quanqiusou.cn/extend_api/saas/split.php'); | 103 | + $client = new \GuzzleHttp\Client(); |
| 104 | + $site_array = $client->request('GET', "https://www.quanqiusou.cn/extend_api/saas/split.php", [ | ||
| 105 | + 'proxy' => env('CURL_PROXY'), // 代理服务器地址和端口号 | ||
| 106 | + ])->getBody()->getContents(); | ||
| 104 | $site_array = json_decode($site_array, true); | 107 | $site_array = json_decode($site_array, true); |
| 105 | $mail_urls = array_column($site_array, 'main_url'); | 108 | $mail_urls = array_column($site_array, 'main_url'); |
| 106 | - $key = array_search($detail['re_website'], $mail_urls); | 109 | + $key = array_search('https://' . $detail['re_website'] . '/', $mail_urls); |
| 107 | if ($key !== false) { | 110 | if ($key !== false) { |
| 108 | // 分离项目 推送到测试链接 | 111 | // 分离项目 推送到测试链接 |
| 109 | $website = $site_array[$key]['test_url']; | 112 | $website = $site_array[$key]['test_url']; |
| 113 | + }else{ | ||
| 114 | + $website = 'https://' . $website . '/'; | ||
| 110 | } | 115 | } |
| 111 | 116 | ||
| 112 | $data = [ | 117 | $data = [ |
| @@ -171,7 +176,7 @@ class postInquiry extends Command | @@ -171,7 +176,7 @@ class postInquiry extends Command | ||
| 171 | ]; | 176 | ]; |
| 172 | 177 | ||
| 173 | $res = Http::withoutVerifying()->post('https://form.globalso.com/api/external-interface/add/fa043f9cbec6b38f', $data)->json(); | 178 | $res = Http::withoutVerifying()->post('https://form.globalso.com/api/external-interface/add/fa043f9cbec6b38f', $data)->json(); |
| 174 | - if(empty($res['code']) || $res['code'] != 200){ | 179 | + if(empty($res['data'][0]['code']) || $res['data'][0]['code'] != 200){ |
| 175 | $log->status = ReInquiryDetailLog::STATUS_FAIL; | 180 | $log->status = ReInquiryDetailLog::STATUS_FAIL; |
| 176 | $log->remark = $res['message'] ?? ''; | 181 | $log->remark = $res['message'] ?? ''; |
| 177 | $log->save(); | 182 | $log->save(); |
| @@ -2,8 +2,10 @@ | @@ -2,8 +2,10 @@ | ||
| 2 | 2 | ||
| 3 | namespace App\Console\Commands\RankData; | 3 | namespace App\Console\Commands\RankData; |
| 4 | 4 | ||
| 5 | +use App\Helper\QuanqiusouApi; | ||
| 5 | use App\Http\Logic\Bside\RankData\RankDataLogic; | 6 | use App\Http\Logic\Bside\RankData\RankDataLogic; |
| 6 | use App\Models\Project\DeployOptimize; | 7 | use App\Models\Project\DeployOptimize; |
| 8 | +use App\Models\RankData\RankData; | ||
| 7 | use Illuminate\Support\Facades\Log; | 9 | use Illuminate\Support\Facades\Log; |
| 8 | 10 | ||
| 9 | /** | 11 | /** |
| @@ -34,6 +36,23 @@ class IndexedPages extends BaseCommands | @@ -34,6 +36,23 @@ class IndexedPages extends BaseCommands | ||
| 34 | * @date 2023/5/11 | 36 | * @date 2023/5/11 |
| 35 | */ | 37 | */ |
| 36 | public function do(){ | 38 | public function do(){ |
| 39 | + $api = new QuanqiusouApi(); | ||
| 40 | + $site_res = $api->getSiteRes(); | ||
| 41 | + if (!$site_res) { | ||
| 42 | + Log::channel('rank_data')->error('谷歌收录数据获取失败'); | ||
| 43 | + }else{ | ||
| 44 | + foreach ($site_res as $api_no => $num){ | ||
| 45 | + $project_ids = DeployOptimize::where('api_no', $api_no)->pluck('project_id'); | ||
| 46 | + foreach ($project_ids as $project_id){ | ||
| 47 | + $rank_data = RankData::where('project_id', $project_id)->where('lang', '')->first(); | ||
| 48 | + if($rank_data){ | ||
| 49 | + $rank_data->indexed_pages_num = $num; | ||
| 50 | + $rank_data->save(); | ||
| 51 | + } | ||
| 52 | + } | ||
| 53 | + } | ||
| 54 | + } | ||
| 55 | + | ||
| 37 | //有排名api编号的项目 | 56 | //有排名api编号的项目 |
| 38 | $list = DeployOptimize::where('api_no', '>', 0)->pluck('api_no', 'project_id')->toArray(); | 57 | $list = DeployOptimize::where('api_no', '>', 0)->pluck('api_no', 'project_id')->toArray(); |
| 39 | Log::channel('rank_data')->info('开始-页面收录数据-'.count($list)); | 58 | Log::channel('rank_data')->info('开始-页面收录数据-'.count($list)); |
| @@ -81,7 +81,7 @@ class Temp extends Command | @@ -81,7 +81,7 @@ class Temp extends Command | ||
| 81 | */ | 81 | */ |
| 82 | public function handle1() | 82 | public function handle1() |
| 83 | { | 83 | { |
| 84 | - $server_id = 14; | 84 | + $server_id = 15; |
| 85 | 85 | ||
| 86 | $server_ip_model = new ServersIp(); | 86 | $server_ip_model = new ServersIp(); |
| 87 | 87 | ||
| @@ -99,23 +99,17 @@ class Temp extends Command | @@ -99,23 +99,17 @@ class Temp extends Command | ||
| 99 | } | 99 | } |
| 100 | $domain = $domain_info['domain']; | 100 | $domain = $domain_info['domain']; |
| 101 | 101 | ||
| 102 | - $check = $this->check_cname($domain); | ||
| 103 | - foreach ($check as $item) { | ||
| 104 | - if (strpos($item, 'Address:') !== false) { | ||
| 105 | - $ip = trim(str_replace('Address:', '', $item)); | ||
| 106 | - if (strpos($ip, '#') === false) { | ||
| 107 | - $ip_info = $server_ip_model->read(['ip' => $ip]); | ||
| 108 | - if ($ip_info === false || $ip_info['servers_id'] != $server_id) { | ||
| 109 | - $data[] = [ | ||
| 110 | - $value->id, | ||
| 111 | - $value->title, | ||
| 112 | - $domain, | ||
| 113 | - $ip, | ||
| 114 | - $ip_info ? $ip_info['servers_id'] : '', | ||
| 115 | - ]; | ||
| 116 | - } | ||
| 117 | - } | ||
| 118 | - } | 102 | + $check = dns_get_record($domain, DNS_A); |
| 103 | + $ip = $check[0]['ip'] ?? ''; | ||
| 104 | + $ip_info = $server_ip_model->read(['ip' => $ip]); | ||
| 105 | + if ($ip_info === false || $ip_info['servers_id'] != $server_id) { | ||
| 106 | + $data[] = [ | ||
| 107 | + $value->id, | ||
| 108 | + $value->title, | ||
| 109 | + $domain, | ||
| 110 | + $ip, | ||
| 111 | + $ip_info ? $ip_info['servers_id'] : '', | ||
| 112 | + ]; | ||
| 119 | } | 113 | } |
| 120 | } | 114 | } |
| 121 | $map = ['项目id', '名称', '域名', 'IP', '服务器ID',]; | 115 | $map = ['项目id', '名称', '域名', 'IP', '服务器ID',]; |
| @@ -132,13 +126,6 @@ class Temp extends Command | @@ -132,13 +126,6 @@ class Temp extends Command | ||
| 132 | } | 126 | } |
| 133 | } | 127 | } |
| 134 | 128 | ||
| 135 | - public function check_cname($domain) | ||
| 136 | - { | ||
| 137 | - $process = new Process(['nslookup', '-qt=a', $domain]); | ||
| 138 | - $process->run(); | ||
| 139 | - return explode(PHP_EOL, $process->getOutput()); | ||
| 140 | - } | ||
| 141 | - | ||
| 142 | /** | 129 | /** |
| 143 | * 创建所有amp站页面生成任务 | 130 | * 创建所有amp站页面生成任务 |
| 144 | * @author Akun | 131 | * @author Akun |
| @@ -959,6 +959,31 @@ function generateRandomString($length) { | @@ -959,6 +959,31 @@ function generateRandomString($length) { | ||
| 959 | return substr(str_shuffle(str_repeat($x = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', ceil($length / strlen($x)))), 1, $length); | 959 | return substr(str_shuffle(str_repeat($x = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', ceil($length / strlen($x)))), 1, $length); |
| 960 | } | 960 | } |
| 961 | 961 | ||
| 962 | +if (!function_exists('check_domain_record')) { | ||
| 963 | + /** | ||
| 964 | + * 验证是否cname或者A记录解析到目标服务器 | ||
| 965 | + * @param $domain | ||
| 966 | + * @param $server_info | ||
| 967 | + * @return bool | ||
| 968 | + * @author Akun | ||
| 969 | + * @date 2024/10/14 11:02 | ||
| 970 | + */ | ||
| 971 | + function check_domain_record($domain, $server_info) | ||
| 972 | + { | ||
| 973 | + $records = dns_get_record($domain,DNS_A); | ||
| 974 | + if(count($records) != 1){ | ||
| 975 | + return false; | ||
| 976 | + } | ||
| 977 | + | ||
| 978 | + $record = $records[0]; | ||
| 979 | + if($record['host'] == $server_info['domain'] || $record['ip'] == $server_info['ip']){ | ||
| 980 | + return $domain; | ||
| 981 | + }else{ | ||
| 982 | + return false; | ||
| 983 | + } | ||
| 984 | + } | ||
| 985 | +} | ||
| 986 | + | ||
| 962 | 987 | ||
| 963 | 988 | ||
| 964 | 989 |
| @@ -134,13 +134,13 @@ class NoticeController extends BaseController | @@ -134,13 +134,13 @@ class NoticeController extends BaseController | ||
| 134 | return $this->error('target_domain参数不能为空'); | 134 | return $this->error('target_domain参数不能为空'); |
| 135 | } | 135 | } |
| 136 | 136 | ||
| 137 | - if(!$this->check_a($origin_domain,DomainInfo::SERVER_IP_301)){ | 137 | + if(!check_domain_record($origin_domain,['domain'=>'','ip'=>DomainInfo::SERVER_IP_301])){ |
| 138 | return $this->error($origin_domain . ' 未解析至 ' . DomainInfo::SERVER_IP_301); | 138 | return $this->error($origin_domain . ' 未解析至 ' . DomainInfo::SERVER_IP_301); |
| 139 | } | 139 | } |
| 140 | 140 | ||
| 141 | if($other_domain){ | 141 | if($other_domain){ |
| 142 | foreach ($other_domain as $ov) { | 142 | foreach ($other_domain as $ov) { |
| 143 | - if (!$this->check_a($ov, DomainInfo::SERVER_IP_301)) { | 143 | + if (!check_domain_record($ov, ['domain'=>'','ip'=>DomainInfo::SERVER_IP_301])) { |
| 144 | return $this->error($ov . ' 未解析至 ' . DomainInfo::SERVER_IP_301); | 144 | return $this->error($ov . ' 未解析至 ' . DomainInfo::SERVER_IP_301); |
| 145 | } | 145 | } |
| 146 | } | 146 | } |
| @@ -159,28 +159,4 @@ class NoticeController extends BaseController | @@ -159,28 +159,4 @@ class NoticeController extends BaseController | ||
| 159 | 159 | ||
| 160 | return $this->success(); | 160 | return $this->success(); |
| 161 | } | 161 | } |
| 162 | - | ||
| 163 | - /** | ||
| 164 | - * 验证是否A记录解析到目标服务器 | ||
| 165 | - * @param $domain | ||
| 166 | - * @param $ip | ||
| 167 | - * @return bool | ||
| 168 | - * @author Akun | ||
| 169 | - * @date 2024/09/19 11:14 | ||
| 170 | - */ | ||
| 171 | - public function check_a($domain, $ip) | ||
| 172 | - { | ||
| 173 | - $process = new Process(['nslookup', '-qt=a', $domain]); | ||
| 174 | - $process->run(); | ||
| 175 | - $output = explode(PHP_EOL, $process->getOutput()); | ||
| 176 | - foreach ($output as $line) { | ||
| 177 | - if ($line) { | ||
| 178 | - $checkA = strpos($line, $ip) !== false; | ||
| 179 | - if ($checkA) { | ||
| 180 | - return $domain; | ||
| 181 | - } | ||
| 182 | - } | ||
| 183 | - } | ||
| 184 | - return false; | ||
| 185 | - } | ||
| 186 | } | 162 | } |
| @@ -4,6 +4,7 @@ namespace App\Http\Controllers\Aside\PackDir; | @@ -4,6 +4,7 @@ namespace App\Http\Controllers\Aside\PackDir; | ||
| 4 | 4 | ||
| 5 | use App\Enums\Common\Code; | 5 | use App\Enums\Common\Code; |
| 6 | use App\Http\Controllers\Aside\BaseController; | 6 | use App\Http\Controllers\Aside\BaseController; |
| 7 | +use App\Models\Devops\ServerConfig; | ||
| 7 | use App\Models\Devops\Servers; | 8 | use App\Models\Devops\Servers; |
| 8 | use App\Models\Devops\ServersIp; | 9 | use App\Models\Devops\ServersIp; |
| 9 | use App\Models\Domain\DomainInfo; | 10 | use App\Models\Domain\DomainInfo; |
| @@ -75,6 +76,9 @@ class PackDirController extends BaseController | @@ -75,6 +76,9 @@ class PackDirController extends BaseController | ||
| 75 | if (!$server_ip_info) { | 76 | if (!$server_ip_info) { |
| 76 | $this->fail('未查询到项目所属服务器信息'); | 77 | $this->fail('未查询到项目所属服务器信息'); |
| 77 | } | 78 | } |
| 79 | + if ($server_ip_info['servers_id'] == ServerConfig::SELF_SITE_ID) { | ||
| 80 | + $this->fail('自建站项目不持支打包静态页面'); | ||
| 81 | + } | ||
| 78 | 82 | ||
| 79 | $data = [ | 83 | $data = [ |
| 80 | 'user_id' => $this->uid, | 84 | 'user_id' => $this->uid, |
| @@ -156,9 +156,21 @@ class AdsController extends BaseController | @@ -156,9 +156,21 @@ class AdsController extends BaseController | ||
| 156 | public function fbInquiryList(Request $request) | 156 | public function fbInquiryList(Request $request) |
| 157 | { | 157 | { |
| 158 | $status = intval($request->input('status')); | 158 | $status = intval($request->input('status')); |
| 159 | + $ad_name = $request->input('ad_name'); | ||
| 160 | + $ad_id = $request->input('ad_id'); | ||
| 161 | + $country = $request->input('country'); | ||
| 159 | $result = ReInquiryForm::when($status, function ($query, $status) { | 162 | $result = ReInquiryForm::when($status, function ($query, $status) { |
| 160 | return $query->where('status', $status); | 163 | return $query->where('status', $status); |
| 161 | }) | 164 | }) |
| 165 | + ->when($ad_name, function ($query, $ad_name) { | ||
| 166 | + return $query->where('ad_name', 'like', '%' . $ad_name . '%'); | ||
| 167 | + }) | ||
| 168 | + ->when($ad_id, function ($query, $ad_id) { | ||
| 169 | + return $query->where('ad_id', 'like', '%' . $ad_id . '%'); | ||
| 170 | + }) | ||
| 171 | + ->when($country, function ($query, $country) { | ||
| 172 | + return $query->where('country', 'like', '%' . $country . '%'); | ||
| 173 | + }) | ||
| 162 | ->orderBy('id', 'desc') | 174 | ->orderBy('id', 'desc') |
| 163 | ->paginate(); | 175 | ->paginate(); |
| 164 | return $this->response('success', Code::SUCCESS, $result); | 176 | return $this->response('success', Code::SUCCESS, $result); |
| @@ -171,8 +183,11 @@ class AdsController extends BaseController | @@ -171,8 +183,11 @@ class AdsController extends BaseController | ||
| 171 | */ | 183 | */ |
| 172 | public function fbRelayDetail(Request $request) | 184 | public function fbRelayDetail(Request $request) |
| 173 | { | 185 | { |
| 186 | + //广告ID、询盘ID、国家、状态 | ||
| 174 | $status = intval($request->input('status')); | 187 | $status = intval($request->input('status')); |
| 188 | + $task_id = intval($request->input('task_id')); | ||
| 175 | $form_id = intval($request->input('form_id')); | 189 | $form_id = intval($request->input('form_id')); |
| 190 | + $country = intval($request->input('country')); | ||
| 176 | $result = ReInquiryDetail::with('detailLog') | 191 | $result = ReInquiryDetail::with('detailLog') |
| 177 | ->when($status, function ($query, $status) { | 192 | ->when($status, function ($query, $status) { |
| 178 | return $query->where('status', $status); | 193 | return $query->where('status', $status); |
| @@ -180,6 +195,12 @@ class AdsController extends BaseController | @@ -180,6 +195,12 @@ class AdsController extends BaseController | ||
| 180 | ->when($form_id, function ($query, $form_id) { | 195 | ->when($form_id, function ($query, $form_id) { |
| 181 | return $query->where('form_id', $form_id); | 196 | return $query->where('form_id', $form_id); |
| 182 | }) | 197 | }) |
| 198 | + ->when($task_id, function ($query, $task_id) { | ||
| 199 | + return $query->where('task_id', $task_id); | ||
| 200 | + }) | ||
| 201 | + ->when($country, function ($query, $country) { | ||
| 202 | + return $query->where('country', 'like', '%'.$country.'%'); | ||
| 203 | + }) | ||
| 183 | ->orderBy('id', 'desc') | 204 | ->orderBy('id', 'desc') |
| 184 | ->paginate(); | 205 | ->paginate(); |
| 185 | return $this->response('success', Code::SUCCESS, $result); | 206 | return $this->response('success', Code::SUCCESS, $result); |
| @@ -175,16 +175,16 @@ class DomainInfoLogic extends BaseLogic | @@ -175,16 +175,16 @@ class DomainInfoLogic extends BaseLogic | ||
| 175 | $this->fail('自建站服务器无法生成站点'); | 175 | $this->fail('自建站服务器无法生成站点'); |
| 176 | } | 176 | } |
| 177 | //域名是否都已经解析 | 177 | //域名是否都已经解析 |
| 178 | - if(!$this->check_cname($info['domain'], $serversIpInfo)){ | 178 | + if(!check_domain_record($info['domain'], $serversIpInfo)){ |
| 179 | $this->fail('域名' . $info['domain'] . '未解析至目标服务器'); | 179 | $this->fail('域名' . $info['domain'] . '未解析至目标服务器'); |
| 180 | } | 180 | } |
| 181 | $domain_301 = ''; | 181 | $domain_301 = ''; |
| 182 | foreach ($this->param['other_domain']??[] as $other_domain){ | 182 | foreach ($this->param['other_domain']??[] as $other_domain){ |
| 183 | if($other_domain && substr($other_domain,0,2) != '*.'){ | 183 | if($other_domain && substr($other_domain,0,2) != '*.'){ |
| 184 | - if($this->check_a($other_domain,DomainInfo::SERVER_IP_301)){ | 184 | + if(check_domain_record($other_domain,['domain'=>'','ip'=>DomainInfo::SERVER_IP_301])){ |
| 185 | $domain_301 = $other_domain; | 185 | $domain_301 = $other_domain; |
| 186 | }else{ | 186 | }else{ |
| 187 | - if(!$this->check_cname($other_domain, $serversIpInfo)){ | 187 | + if(!check_domain_record($other_domain, $serversIpInfo)){ |
| 188 | $this->fail('域名' . $other_domain . '未解析至目标服务器'); | 188 | $this->fail('域名' . $other_domain . '未解析至目标服务器'); |
| 189 | } | 189 | } |
| 190 | } | 190 | } |
| @@ -202,7 +202,7 @@ class DomainInfoLogic extends BaseLogic | @@ -202,7 +202,7 @@ class DomainInfoLogic extends BaseLogic | ||
| 202 | $host_array[0] = 'm'; | 202 | $host_array[0] = 'm'; |
| 203 | } | 203 | } |
| 204 | $amp_domain = implode('.',$host_array); | 204 | $amp_domain = implode('.',$host_array); |
| 205 | - if(!$this->check_cname($amp_domain, $serversIpInfo)){ | 205 | + if(!check_domain_record($amp_domain, $serversIpInfo)){ |
| 206 | $this->fail('AMP站点域名' . $amp_domain . '未解析至目标服务器'); | 206 | $this->fail('AMP站点域名' . $amp_domain . '未解析至目标服务器'); |
| 207 | } | 207 | } |
| 208 | } | 208 | } |
| @@ -286,64 +286,6 @@ class DomainInfoLogic extends BaseLogic | @@ -286,64 +286,6 @@ class DomainInfoLogic extends BaseLogic | ||
| 286 | return $this->success(); | 286 | return $this->success(); |
| 287 | } | 287 | } |
| 288 | 288 | ||
| 289 | - | ||
| 290 | - /** | ||
| 291 | - * 验证是否cname或者A记录解析到目标服务器 | ||
| 292 | - * @param $domain | ||
| 293 | - * @param $server_info | ||
| 294 | - * @return mixed | ||
| 295 | - * @author zbj | ||
| 296 | - * @date 2023/11/13 | ||
| 297 | - */ | ||
| 298 | - public function check_cname($domain, $server_info){ | ||
| 299 | - $process = new Process(['nslookup', '-qt=a', $domain]); | ||
| 300 | - $process->run(); | ||
| 301 | - $output = explode(PHP_EOL, $process->getOutput()); | ||
| 302 | - foreach ($output as $line){ | ||
| 303 | - if($line){ | ||
| 304 | - $checkA = strpos($line, $server_info['ip']) !== false; | ||
| 305 | - if($checkA){ | ||
| 306 | - return $domain; | ||
| 307 | - } | ||
| 308 | - } | ||
| 309 | - } | ||
| 310 | - | ||
| 311 | - //是否cname | ||
| 312 | - $process = new Process(['nslookup', '-qt=cname', $domain]); | ||
| 313 | - $process->run(); | ||
| 314 | - $output = explode(PHP_EOL, $process->getOutput()); | ||
| 315 | - foreach ($output as $line){ | ||
| 316 | - if($line){ | ||
| 317 | - $checkCname = (strpos($line, $server_info['domain']) !== false); | ||
| 318 | - if($checkCname){ | ||
| 319 | - return $domain; | ||
| 320 | - } | ||
| 321 | - } | ||
| 322 | - } | ||
| 323 | - return false; | ||
| 324 | - } | ||
| 325 | - | ||
| 326 | - /** | ||
| 327 | - * 验证是否A记录解析到目标服务器 | ||
| 328 | - * @param $domain | ||
| 329 | - * @param $ip | ||
| 330 | - * @return mixed | ||
| 331 | - */ | ||
| 332 | - public function check_a($domain, $ip){ | ||
| 333 | - $process = new Process(['nslookup', '-qt=a', $domain]); | ||
| 334 | - $process->run(); | ||
| 335 | - $output = explode(PHP_EOL, $process->getOutput()); | ||
| 336 | - foreach ($output as $line){ | ||
| 337 | - if($line){ | ||
| 338 | - $checkA = strpos($line, $ip) !== false; | ||
| 339 | - if($checkA){ | ||
| 340 | - return $domain; | ||
| 341 | - } | ||
| 342 | - } | ||
| 343 | - } | ||
| 344 | - return false; | ||
| 345 | - } | ||
| 346 | - | ||
| 347 | /** | 289 | /** |
| 348 | * 设置语种自定义跳转链接 | 290 | * 设置语种自定义跳转链接 |
| 349 | * @param $project_id | 291 | * @param $project_id |
| @@ -386,7 +328,7 @@ class DomainInfoLogic extends BaseLogic | @@ -386,7 +328,7 @@ class DomainInfoLogic extends BaseLogic | ||
| 386 | if($has_info && ($has_info['project_id'] != $project_id || $has_info['language_id'] != $this->param['language_id'])){ | 328 | if($has_info && ($has_info['project_id'] != $project_id || $has_info['language_id'] != $this->param['language_id'])){ |
| 387 | $this->fail('自定义域名已被使用'); | 329 | $this->fail('自定义域名已被使用'); |
| 388 | } | 330 | } |
| 389 | - if(!$this->check_cname($this->param['custom_domain'], $serversIpInfo)){ | 331 | + if(!check_domain_record($this->param['custom_domain'], $serversIpInfo)){ |
| 390 | $this->fail('域名' . $this->param['custom_domain'] . '未解析至目标服务器'); | 332 | $this->fail('域名' . $this->param['custom_domain'] . '未解析至目标服务器'); |
| 391 | } | 333 | } |
| 392 | }else{ | 334 | }else{ |
| @@ -24,6 +24,7 @@ class AutoPullNotify extends Base | @@ -24,6 +24,7 @@ class AutoPullNotify extends Base | ||
| 24 | public static function processMap() | 24 | public static function processMap() |
| 25 | { | 25 | { |
| 26 | return [ | 26 | return [ |
| 27 | + 'php artisan pack_site_dir' => '打包站点静态页面', | ||
| 27 | 'php artisan handle_html' => '拉取页面zip文件并解压', | 28 | 'php artisan handle_html' => '拉取页面zip文件并解压', |
| 28 | 'php artisan create_update_page_route' => '创建主站路由', | 29 | 'php artisan create_update_page_route' => '创建主站路由', |
| 29 | 'php artisan create_update_page_master' => '生成主站页面', | 30 | 'php artisan create_update_page_master' => '生成主站页面', |
-
请 注册 或 登录 后发表评论