diff --git a/app/Controllers/Admin/Cloudflare/RecordController.php b/app/Controllers/Admin/Cloudflare/RecordController.php index f1cd515..c875efa 100644 --- a/app/Controllers/Admin/Cloudflare/RecordController.php +++ b/app/Controllers/Admin/Cloudflare/RecordController.php @@ -143,17 +143,10 @@ class RecordController extends CloudflareController if ($this->entity === null) { throw new \Exception("{$uid} 정보를 찾을수 없습니다."); } - //fixed 필드가 있고 값이 변경되었을때(toggle에서 fixed만 설정시사용) - if (in_array('fixed', $this->fields)) { - if (isset($this->formDatas['fixed']) && $this->formDatas['fixed'] !== $this->entity->fixed) { - $this->entity = $this->getModel()->modify($this->entity, $this->formDatas); - } - } else { - //부모데이터정의 - $this->_zone_entity = $this->getZoneModel()->getEntityByPK($this->entity->getParent()); - //Socket처리 - $this->entity = $this->getService()->modify($this->_zone_entity, $this->entity, $this->formDatas); - } + //부모데이터정의 + $this->_zone_entity = $this->getZoneModel()->getEntityByPK($this->entity->getParent()); + //Socket처리 + $this->entity = $this->getService()->modify($this->_zone_entity, $this->entity, $this->formDatas); } //단일필드작업 public function toggle(mixed $uid, string $field): RedirectResponse diff --git a/app/Services/Cloudflare/RecordService.php b/app/Services/Cloudflare/RecordService.php index 968dc43..0e1ee84 100644 --- a/app/Services/Cloudflare/RecordService.php +++ b/app/Services/Cloudflare/RecordService.php @@ -88,6 +88,14 @@ class RecordService extends CloudflareService } public function modify(ZoneEntity $parent_entity, RecordEntity $entity, array $formDatas): RecordEntity { + //fixed 필드가 있고 값이 변경되었을때(toggle에서 fixed만 설정시사용) + if (in_array('fixed', array_keys($formDatas))) { + if ($formDatas['fixed'] !== $entity->fixed) { + $entity = $this->getModel()->modify($entity, $formDatas); + } + return $entity; + } + //부모데이터정의 $this->setParentEntity($parent_entity); //TTL값은 CDN(proxied)가 사용함일때는 무조건 1, 않함일때는 120이 적용