作者 赵彬吉
... ... @@ -28,7 +28,7 @@ class RemainDay extends Command
* @var 按上线时间统计
*/
protected $projectId = [
1434,1812,276
1434,1812,276,2414
];//需要单独处理的项目
/**
... ...
... ... @@ -37,7 +37,94 @@ class Temp extends Command
public function handle()
{
$this->check_no_cname_projects();
$this->change_cname_projects_240();
}
/**
* 240服务器上解析cname的项目迁移
* @author Akun
* @date 2025/02/17 14:21
*/
public function change_cname_projects_240()
{
$server_ip_model = new ServersIp();
$server_ip_ids = $server_ip_model->where('servers_id', 1)->get()->pluck('id')->toArray();
$project_list = Project::select(['id', 'serve_id'])->whereIn('serve_id', $server_ip_ids)->get();
$domain_model = new DomainInfo();
foreach ($project_list as $value) {
$project_id = $value->id;
$domain_info = $domain_model->read(['project_id' => $project_id, 'status' => 1], ['id', 'domain', 'amp_status']);
if (!$domain_info) {
//过滤未绑定正式域名的项目
continue;
}
$domain_id = $domain_info['id'];
$domain = $domain_info['domain'];
//迁移主站
$check = dns_get_record($domain, DNS_A);
$host = $check[0]['host'] ?? '';
if ($host == 'cname.globalso.com') {
//获取主站备份证书
$ssl_info = DB::table('gl_domain_ssl_backup')->select(['private_key', 'private_cert'])->where('domain', $domain)->first();
if (!$ssl_info) {
$this->output('项目id:' . $project_id . ' | 未备份主站证书');
continue;
}
//创建主站建站任务
$task_info = DomainCreateTask::where('type', 1)->where('server_id', 20)->where('project_id', $project_id)->first();
if (!$task_info) {
$task_model = new DomainCreateTask();
$task_model->type = 1;
$task_model->server_id = 20;
$task_model->project_id = $project_id;
$task_model->domain_id = $domain_id;
$task_model->certs = json_encode(['key' => $ssl_info->private_key, 'csr' => $ssl_info->private_cert]);
$task_model->save();
}
}
if ($domain_info['amp_status'] == 1) {
//迁移amp站
$domain_array = parse_url($domain);
$host = $domain_array['host'] ?? $domain_array['path'];
$host_array = explode('.', $host);
if (count($host_array) <= 2) {
array_unshift($host_array, 'm');
} else {
$host_array[0] = 'm';
}
$amp_domain = implode('.', $host_array);
$check_amp = dns_get_record($amp_domain, DNS_A);
$host_amp = $check_amp[0]['host'] ?? '';
if ($host_amp == 'cname.globalso.com') {
//获取amp站备份证书
$ssl_info_amp = DB::table('gl_domain_ssl_backup')->select(['private_key', 'private_cert'])->where('domain', $amp_domain)->first();
if (!$ssl_info_amp) {
$this->output('项目id:' . $project_id . ' | 未备份amp站证书');
continue;
}
//创建amp站建站任务
$task_info_amp = DomainCreateTask::where('type', 2)->where('server_id', 20)->where('project_id', $project_id)->first();
if (!$task_info_amp) {
$task_model = new DomainCreateTask();
$task_model->type = 2;
$task_model->server_id = 20;
$task_model->project_id = $project_id;
$task_model->domain_id = $domain_id;
$task_model->certs = json_encode(['key' => $ssl_info_amp->private_key, 'csr' => $ssl_info_amp->private_cert]);
$task_model->save();
}
}
}
}
}
/**
... ... @@ -425,7 +512,6 @@ class Temp extends Command
}
}
/**
* 检查不在所属服务器解析上的域名
* @author Akun
... ...
... ... @@ -31,7 +31,7 @@ class ServersController extends BaseController
}
$this->map['status'] = 0;
$serversModel = new ServersModel();
$lists = $serversModel->list($this->map);
$lists = $serversModel->list($this->map,'sort');
$this->response('success',Code::SUCCESS,$lists);
}
... ...
... ... @@ -68,6 +68,9 @@ class AyrReleaseController extends BaseController
if(isset($this->param['images']) && !empty($this->param['images'])){
$data['images'] = $this->param['images'];
}
if(empty($data)){
$this->fail('媒体信息不能为空');
}
//参数处理
$this->param['mediaUrls'] = $ayrReleaseLogic->image_file_param($data);
$param = [
... ...
... ... @@ -41,7 +41,7 @@ class OperationHeartbeatController extends BaseController
'is_custom.required' => '是否为扩展模版',
'is_template.required' => '详情页/可视化',
]);
if(empty($this->param['source_id'])){
if(empty($this->param['source_id']) || ($this->param['source_id'] == 'NaN')){
$this->response('success');
}
$condition = ['project_id'=>$this->user['project_id'],'source'=>$this->param['source'],'source_id'=>$this->param['source_id'],
... ...