作者 刘锟

update

@@ -75,8 +75,8 @@ class DomainSettingLogic extends BaseLogic @@ -75,8 +75,8 @@ class DomainSettingLogic extends BaseLogic
75 } 75 }
76 76
77 //获取解析服务器详情 77 //获取解析服务器详情
78 - $server_model = new ServersIp();  
79 - $record_info = $server_model->read(['domain' => $this->param['record']], ['id', 'servers_id', 'ip', 'domain']); 78 + $server_ip_model = new ServersIp();
  79 + $record_info = $server_ip_model->read(['domain' => $this->param['record']], ['id', 'servers_id', 'ip', 'domain', 'total']);
80 if (!$record_info) { 80 if (!$record_info) {
81 $this->fail('解析记录不存在'); 81 $this->fail('解析记录不存在');
82 } 82 }
@@ -107,7 +107,12 @@ class DomainSettingLogic extends BaseLogic @@ -107,7 +107,12 @@ class DomainSettingLogic extends BaseLogic
107 DB::beginTransaction(); 107 DB::beginTransaction();
108 try { 108 try {
109 //保存一条主域名记录 109 //保存一条主域名记录
110 - $this->saveWebSetting($domain); 110 + $setting_info = $this->model->read(['project_id' => $this->user['project_id']]);
  111 + if ($setting_info === false) {
  112 + $this->model->add(['seo_domain' => $domain, 'project_id' => $this->user['project_id']]);
  113 + } else {
  114 + $this->model->edit(['seo_domain' => $domain], ['id' => $setting_info['id']]);
  115 + }
111 116
112 //添加域名到域名管理 117 //添加域名到域名管理
113 $domain_model = new DomainInfo(); 118 $domain_model = new DomainInfo();
@@ -119,6 +124,14 @@ class DomainSettingLogic extends BaseLogic @@ -119,6 +124,14 @@ class DomainSettingLogic extends BaseLogic
119 $optimize_model = new DeployOptimize(); 124 $optimize_model = new DeployOptimize();
120 $optimize_model->edit(['domain' => $id], ['project_id' => $this->user['project_id']]); 125 $optimize_model->edit(['domain' => $id], ['project_id' => $this->user['project_id']]);
121 126
  127 + //保存项目ip
  128 + $project_model->edit(['serve_id' => $record_info['id']], ['id' => $this->user['project_id']]);
  129 +
  130 + //变更ip使用数量
  131 + $server_ip_model->edit(['total' => $record_info['total'] + 1], ['id' => $record_info['id']]);
  132 + $server_model = new Servers();
  133 + $server_model->edit(['being_number' => $record_info['total'] + 1], ['id' => $record_info['servers_id']]);
  134 +
122 //创建建站任务 135 //创建建站任务
123 $domain_create_model = new DomainCreateTask(); 136 $domain_create_model = new DomainCreateTask();
124 $domain_create_model->add([ 137 $domain_create_model->add([
@@ -135,22 +148,4 @@ class DomainSettingLogic extends BaseLogic @@ -135,22 +148,4 @@ class DomainSettingLogic extends BaseLogic
135 $this->fail('保存失败,请联系管理员'); 148 $this->fail('保存失败,请联系管理员');
136 } 149 }
137 } 150 }
138 -  
139 - /**  
140 - * @remark :保存主域名设置  
141 - * @name :saveWebSetting  
142 - * @author :lyh  
143 - * @method :post  
144 - * @time :2025/3/20 15:38  
145 - */  
146 - public function saveWebSetting($domain)  
147 - {  
148 - $settingInfo = $this->model->read(['project_id' => $this->user['project_id']]);  
149 - if ($settingInfo === false) {  
150 - $this->model->add(['seo_domain' => $domain, 'project_id' => $this->user['project_id']]);  
151 - } else {  
152 - $this->model->edit(['seo_domain' => $domain], ['id' => $settingInfo['id']]);  
153 - }  
154 - return $this->success();  
155 - }  
156 } 151 }