作者 赵彬吉
@@ -28,7 +28,7 @@ class RemainDay extends Command @@ -28,7 +28,7 @@ class RemainDay extends Command
28 * @var 按上线时间统计 28 * @var 按上线时间统计
29 */ 29 */
30 protected $projectId = [ 30 protected $projectId = [
31 - 1434,1812,276 31 + 1434,1812,276,2414
32 ];//需要单独处理的项目 32 ];//需要单独处理的项目
33 33
34 /** 34 /**
@@ -37,7 +37,94 @@ class Temp extends Command @@ -37,7 +37,94 @@ class Temp extends Command
37 37
38 public function handle() 38 public function handle()
39 { 39 {
40 - $this->check_no_cname_projects(); 40 + $this->change_cname_projects_240();
  41 + }
  42 +
  43 + /**
  44 + * 240服务器上解析cname的项目迁移
  45 + * @author Akun
  46 + * @date 2025/02/17 14:21
  47 + */
  48 + public function change_cname_projects_240()
  49 + {
  50 + $server_ip_model = new ServersIp();
  51 +
  52 + $server_ip_ids = $server_ip_model->where('servers_id', 1)->get()->pluck('id')->toArray();
  53 +
  54 + $project_list = Project::select(['id', 'serve_id'])->whereIn('serve_id', $server_ip_ids)->get();
  55 +
  56 + $domain_model = new DomainInfo();
  57 + foreach ($project_list as $value) {
  58 + $project_id = $value->id;
  59 +
  60 + $domain_info = $domain_model->read(['project_id' => $project_id, 'status' => 1], ['id', 'domain', 'amp_status']);
  61 + if (!$domain_info) {
  62 + //过滤未绑定正式域名的项目
  63 + continue;
  64 + }
  65 + $domain_id = $domain_info['id'];
  66 + $domain = $domain_info['domain'];
  67 +
  68 + //迁移主站
  69 + $check = dns_get_record($domain, DNS_A);
  70 + $host = $check[0]['host'] ?? '';
  71 + if ($host == 'cname.globalso.com') {
  72 + //获取主站备份证书
  73 + $ssl_info = DB::table('gl_domain_ssl_backup')->select(['private_key', 'private_cert'])->where('domain', $domain)->first();
  74 + if (!$ssl_info) {
  75 + $this->output('项目id:' . $project_id . ' | 未备份主站证书');
  76 + continue;
  77 + }
  78 +
  79 + //创建主站建站任务
  80 + $task_info = DomainCreateTask::where('type', 1)->where('server_id', 20)->where('project_id', $project_id)->first();
  81 + if (!$task_info) {
  82 + $task_model = new DomainCreateTask();
  83 + $task_model->type = 1;
  84 + $task_model->server_id = 20;
  85 + $task_model->project_id = $project_id;
  86 + $task_model->domain_id = $domain_id;
  87 + $task_model->certs = json_encode(['key' => $ssl_info->private_key, 'csr' => $ssl_info->private_cert]);
  88 + $task_model->save();
  89 + }
  90 + }
  91 +
  92 + if ($domain_info['amp_status'] == 1) {
  93 + //迁移amp站
  94 + $domain_array = parse_url($domain);
  95 + $host = $domain_array['host'] ?? $domain_array['path'];
  96 + $host_array = explode('.', $host);
  97 + if (count($host_array) <= 2) {
  98 + array_unshift($host_array, 'm');
  99 + } else {
  100 + $host_array[0] = 'm';
  101 + }
  102 + $amp_domain = implode('.', $host_array);
  103 +
  104 + $check_amp = dns_get_record($amp_domain, DNS_A);
  105 + $host_amp = $check_amp[0]['host'] ?? '';
  106 + if ($host_amp == 'cname.globalso.com') {
  107 + //获取amp站备份证书
  108 + $ssl_info_amp = DB::table('gl_domain_ssl_backup')->select(['private_key', 'private_cert'])->where('domain', $amp_domain)->first();
  109 + if (!$ssl_info_amp) {
  110 + $this->output('项目id:' . $project_id . ' | 未备份amp站证书');
  111 + continue;
  112 + }
  113 +
  114 + //创建amp站建站任务
  115 + $task_info_amp = DomainCreateTask::where('type', 2)->where('server_id', 20)->where('project_id', $project_id)->first();
  116 + if (!$task_info_amp) {
  117 + $task_model = new DomainCreateTask();
  118 + $task_model->type = 2;
  119 + $task_model->server_id = 20;
  120 + $task_model->project_id = $project_id;
  121 + $task_model->domain_id = $domain_id;
  122 + $task_model->certs = json_encode(['key' => $ssl_info_amp->private_key, 'csr' => $ssl_info_amp->private_cert]);
  123 + $task_model->save();
  124 + }
  125 + }
  126 + }
  127 + }
41 } 128 }
42 129
43 /** 130 /**
@@ -425,7 +512,6 @@ class Temp extends Command @@ -425,7 +512,6 @@ class Temp extends Command
425 } 512 }
426 } 513 }
427 514
428 -  
429 /** 515 /**
430 * 检查不在所属服务器解析上的域名 516 * 检查不在所属服务器解析上的域名
431 * @author Akun 517 * @author Akun
@@ -31,7 +31,7 @@ class ServersController extends BaseController @@ -31,7 +31,7 @@ class ServersController extends BaseController
31 } 31 }
32 $this->map['status'] = 0; 32 $this->map['status'] = 0;
33 $serversModel = new ServersModel(); 33 $serversModel = new ServersModel();
34 - $lists = $serversModel->list($this->map); 34 + $lists = $serversModel->list($this->map,'sort');
35 $this->response('success',Code::SUCCESS,$lists); 35 $this->response('success',Code::SUCCESS,$lists);
36 } 36 }
37 37
@@ -68,6 +68,9 @@ class AyrReleaseController extends BaseController @@ -68,6 +68,9 @@ class AyrReleaseController extends BaseController
68 if(isset($this->param['images']) && !empty($this->param['images'])){ 68 if(isset($this->param['images']) && !empty($this->param['images'])){
69 $data['images'] = $this->param['images']; 69 $data['images'] = $this->param['images'];
70 } 70 }
  71 + if(empty($data)){
  72 + $this->fail('媒体信息不能为空');
  73 + }
71 //参数处理 74 //参数处理
72 $this->param['mediaUrls'] = $ayrReleaseLogic->image_file_param($data); 75 $this->param['mediaUrls'] = $ayrReleaseLogic->image_file_param($data);
73 $param = [ 76 $param = [
@@ -41,7 +41,7 @@ class OperationHeartbeatController extends BaseController @@ -41,7 +41,7 @@ class OperationHeartbeatController extends BaseController
41 'is_custom.required' => '是否为扩展模版', 41 'is_custom.required' => '是否为扩展模版',
42 'is_template.required' => '详情页/可视化', 42 'is_template.required' => '详情页/可视化',
43 ]); 43 ]);
44 - if(empty($this->param['source_id'])){ 44 + if(empty($this->param['source_id']) || ($this->param['source_id'] == 'NaN')){
45 $this->response('success'); 45 $this->response('success');
46 } 46 }
47 $condition = ['project_id'=>$this->user['project_id'],'source'=>$this->param['source'],'source_id'=>$this->param['source_id'], 47 $condition = ['project_id'=>$this->user['project_id'],'source'=>$this->param['source'],'source_id'=>$this->param['source_id'],