cfmgrv4 init...1

This commit is contained in:
최준흠 2024-09-26 21:18:08 +09:00
parent c958bf7fe6
commit 958da4e1ee
2 changed files with 9 additions and 6 deletions

View File

@ -94,10 +94,13 @@ class ZoneController extends CloudflareController
if ($this->_account_entity === null) {
throw new \Exception("해당 계정정보를 찾을수 없습니다.");
}
foreach ($this->formDatas['domains'] as $domain) {
//Zone생성
$zone_entity = $this->getMyLibrary()->create($domain, $this->formDatas);
$zone_entitys = [];
foreach ($this->formDatas['domains'] as $domain) {
$zone_entitys[] = $this->getMyLibrary()->create($domain);
}
//Record생성
foreach ($zone_entitys as $zone_entity) {
$record = new Record($this->_account_entity, $zone_entity);
foreach ($this->formDatas['hosts'] as $host) {
$record->create($host, [

View File

@ -91,14 +91,14 @@ class Zone extends MyCloudflare
$entity->$field = $cf->result->value;
return $entity;
}
public function create(string $domain, array $formDatas): ZoneEntity
public function create(string $domain, bool $jump_start = false): ZoneEntity
{
//Socket용
//도메인생성을 위해 Cloudflare에 전송
$cf = $this->getRequest()->post('zones/', [
'accountId' => $this->_account_entity->getPK(),
'name' => $domain,
'jump_start' => array_key_exists('jump_start', $formDatas) ? $formDatas['jumb_start'] : false,
'jump_start' => $jump_start,
]);
$cf = json_decode($cf->getBody());
if (!$cf->success) {