作者 刘锟

合并分支 'akun' 到 'master'

Akun



查看合并请求 !1530
... ... @@ -75,8 +75,8 @@ class DomainSettingLogic extends BaseLogic
}
//获取解析服务器详情
$server_model = new ServersIp();
$record_info = $server_model->read(['domain' => $this->param['record']], ['id', 'servers_id', 'ip', 'domain']);
$server_ip_model = new ServersIp();
$record_info = $server_ip_model->read(['domain' => $this->param['record']], ['id', 'servers_id', 'ip', 'domain', 'total']);
if (!$record_info) {
$this->fail('解析记录不存在');
}
... ... @@ -107,7 +107,12 @@ class DomainSettingLogic extends BaseLogic
DB::beginTransaction();
try {
//保存一条主域名记录
$this->saveWebSetting($domain);
$setting_info = $this->model->read(['project_id' => $this->user['project_id']]);
if ($setting_info === false) {
$this->model->add(['seo_domain' => $domain, 'project_id' => $this->user['project_id']]);
} else {
$this->model->edit(['seo_domain' => $domain], ['id' => $setting_info['id']]);
}
//添加域名到域名管理
$domain_model = new DomainInfo();
... ... @@ -119,6 +124,14 @@ class DomainSettingLogic extends BaseLogic
$optimize_model = new DeployOptimize();
$optimize_model->edit(['domain' => $id], ['project_id' => $this->user['project_id']]);
//保存项目ip
$project_model->edit(['serve_id' => $record_info['id']], ['id' => $this->user['project_id']]);
//变更ip使用数量
$server_ip_model->edit(['total' => $record_info['total'] + 1], ['id' => $record_info['id']]);
$server_model = new Servers();
$server_model->edit(['being_number' => $record_info['total'] + 1], ['id' => $record_info['servers_id']]);
//创建建站任务
$domain_create_model = new DomainCreateTask();
$domain_create_model->add([
... ... @@ -135,22 +148,4 @@ class DomainSettingLogic extends BaseLogic
$this->fail('保存失败,请联系管理员');
}
}
/**
* @remark :保存主域名设置
* @name :saveWebSetting
* @author :lyh
* @method :post
* @time :2025/3/20 15:38
*/
public function saveWebSetting($domain)
{
$settingInfo = $this->model->read(['project_id' => $this->user['project_id']]);
if ($settingInfo === false) {
$this->model->add(['seo_domain' => $domain, 'project_id' => $this->user['project_id']]);
} else {
$this->model->edit(['seo_domain' => $domain], ['id' => $settingInfo['id']]);
}
return $this->success();
}
}
... ...