cfmgrv4 init...3

This commit is contained in:
최준흠 2024-10-25 10:40:44 +09:00
parent ed55aad2fd
commit e91eb63cef
2 changed files with 12 additions and 11 deletions

View File

@ -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

View File

@ -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이 적용