作者 刘锟

update

@@ -169,14 +169,19 @@ class DomainSettingLogic extends BaseLogic @@ -169,14 +169,19 @@ class DomainSettingLogic extends BaseLogic
169 $this->fail('ftp信息填写未完整'); 169 $this->fail('ftp信息填写未完整');
170 } 170 }
171 171
172 - //获取自建站服务器详情  
173 - $record_info = $server_ip_model->read(['servers_id' => ServerConfig::SELF_SITE_ID], ['id', 'servers_id', 'total']);  
174 - if (!$record_info) {  
175 - $this->fail('解析记录不存在');  
176 - }  
177 -  
178 DB::beginTransaction(); 172 DB::beginTransaction();
179 try { 173 try {
  174 + //获取自建站服务器详情
  175 + $record_info = $server_ip_model->read(['servers_id' => ServerConfig::SELF_SITE_ID, 'ip' => $ftp['url']], ['id', 'servers_id', 'total']);
  176 + if (!$record_info) {
  177 + $record_id = $server_ip_model->addReturnId([
  178 + 'servers_id' => ServerConfig::SELF_SITE_ID,
  179 + 'ip' => $ftp['url'],
  180 + 'remark' => $project_info['company']
  181 + ]);
  182 + $record_info = $server_ip_model->read(['id' => $record_id], ['id', 'servers_id', 'total']);
  183 + }
  184 +
180 //保存一条主域名记录 185 //保存一条主域名记录
181 $setting_info = $this->model->read(['project_id' => $this->user['project_id']]); 186 $setting_info = $this->model->read(['project_id' => $this->user['project_id']]);
182 if ($setting_info === false) { 187 if ($setting_info === false) {