作者 刘锟

update

... ... @@ -34,6 +34,57 @@ class Temp extends Command
protected $description = '临时脚本';
/**
* 检查服务器上没有解析cname的项目
* @author Akun
* @date 2024/12/11 10:15
*/
public function handle()
{
$server_id = 14;
$server_ip_model = new ServersIp();
$server_ip_ids = $server_ip_model->where('servers_id', $server_id)->get()->pluck('id')->toArray();
$project_list = Project::select(['id', 'serve_id', 'title'])->whereIn('serve_id', $server_ip_ids)->get();
$domain_model = new DomainInfo();
$data = [];
foreach ($project_list as $value) {
$domain_info = $domain_model->read(['project_id' => $value->id, 'status' => 1], ['id', 'domain']);
if (!$domain_info) {
//过滤未绑定正式域名的项目
continue;
}
$domain = $domain_info['domain'];
$check = dns_get_record($domain, DNS_A);
$ip = $check[0]['ip'] ?? '';
$host = $check[0]['host'] ?? '';
if (!$host) {
$data[] = [
$value->id,
$value->title,
$domain,
$ip
];
}
}
$map = ['项目id', '名称', '域名', 'IP'];
if ($data) {
$table = new BatchExportService("美服2没有解析cname的项目");
$file = $table->head($map)->data($data)->save();
if (!$file) {
$this->output('文件生成失败,请重试');
} else {
$this->output('export success');
}
} else {
$this->output('no data');
}
}
/**
* 伍欣组推广项目:开启AMP站点,首页不强制跳转,批量生成AMP站点页面
* @author Akun
* @date 2024/12/10 10:43
... ...