cfmgrv4 init...1

This commit is contained in:
최준흠 2024-09-30 20:34:48 +09:00
parent 241c4ea82c
commit 310130906c
9 changed files with 23 additions and 22 deletions

View File

@ -41,11 +41,11 @@ class AccountController extends CloudflareController
{ {
switch ($field) { switch ($field) {
case $this->getModel()::PARENT: case $this->getModel()::PARENT:
$this->getAuthModel()->where('status', DEFAULTS['STATUS']); $temps = [
$options[$field] = [
DEFAULTS['EMPTY'] => lang($this->class_path . '.label.' . $field) . ' 선택', DEFAULTS['EMPTY'] => lang($this->class_path . '.label.' . $field) . ' 선택',
...$this->getAuthModel()->getFormFieldOption($field, $options),
]; ];
// $this->getAuthModel()->where('status', DEFAULTS['STATUS']);
$options[$field] = $this->getAuthModel()->getFormFieldOption($field, $temps);
// echo $this->getAuthModel()->getLastQuery(); // echo $this->getAuthModel()->getLastQuery();
// dd($options); // dd($options);
break; break;

View File

@ -38,12 +38,12 @@ class RecordController extends CloudflareController
{ {
switch ($field) { switch ($field) {
case $this->getModel()::PARENT: case $this->getModel()::PARENT:
$this->getZoneModel()->where('status', 'active'); $temps = [
$options[$field] = [
DEFAULTS['EMPTY'] => lang($this->class_path . '.label.' . $field) . ' 선택', DEFAULTS['EMPTY'] => lang($this->class_path . '.label.' . $field) . ' 선택',
...$this->getZoneModel()->getFormFieldOption($field, $options),
]; ];
// echo $this->getZoneModel()->getLastQuery(); // $this->getZoneModel()->where('status', 'active');
$options[$field] = $this->getZoneModel()->getFormFieldOption($field, $temps);
// echo $this->getAccountModel()->getLastQuery();
// dd($options); // dd($options);
break; break;
default: default:

View File

@ -42,11 +42,11 @@ class ZoneController extends CloudflareController
{ {
switch ($field) { switch ($field) {
case $this->getModel()::PARENT: case $this->getModel()::PARENT:
$this->getAccountModel()->where('status', DEFAULTS['STATUS']); $temps = [
$options[$field] = [
DEFAULTS['EMPTY'] => lang($this->class_path . '.label.' . $field) . ' 선택', DEFAULTS['EMPTY'] => lang($this->class_path . '.label.' . $field) . ' 선택',
...$this->getAccountModel()->getFormFieldOption($field, $options),
]; ];
// $this->getAccountModel()->where('status', DEFAULTS['STATUS']);
$options[$field] = $this->getAccountModel()->getFormFieldOption($field, $temps);
// echo $this->getAccountModel()->getLastQuery(); // echo $this->getAccountModel()->getLastQuery();
// dd($options); // dd($options);
break; break;

View File

@ -37,6 +37,7 @@ abstract class MVController extends CommonController
} }
$options = $this->getFormFieldOption($field, $options); $options = $this->getFormFieldOption($field, $options);
} }
// dd($options);
return $options; return $options;
} }
//전송된 데이터 //전송된 데이터

View File

@ -34,8 +34,10 @@ function getFieldForm_ZoneHelper(string $field, mixed $value, array $viewDatas,
$form = form_input($field, $value, ["placeholder" => "예)exmaple.com", "style" => "width:60%; ::placeholder{color:silver; opacity: 1;}"]); $form = form_input($field, $value, ["placeholder" => "예)exmaple.com", "style" => "width:60%; ::placeholder{color:silver; opacity: 1;}"]);
break; break;
case 'domains': case 'domains':
$form = form_textarea($field, $value, ['class' => 'editor', 'rows' => '5']);
break;
case 'hosts': case 'hosts':
$form = form_textarea($field, html_entity_decode($value), ['class' => 'editor', 'rows' => '5']); $form = form_textarea($field, $value == DEFAULTS['EMPTY'] ? "@\n*\nm\nwww" : $value, ['class' => 'editor', 'rows' => '5']);
break; break;
case 'content': case 'content':
$form = form_input($field, $value, ["placeholder" => "예)123.123.123.123", "style" => "width:200px; ::placeholder{color:silver; opacity: 1;}"]); $form = form_input($field, $value, ["placeholder" => "예)123.123.123.123", "style" => "width:200px; ::placeholder{color:silver; opacity: 1;}"]);

View File

@ -48,7 +48,7 @@ class AuthModel extends CommonModel
{ {
switch ($field) { switch ($field) {
default: default:
$this->orderBy(self::TITLE, 'asc'); $this->orderBy(self::PK, 'asc');
$options = parent::getFormFieldOption($field, $options); $options = parent::getFormFieldOption($field, $options);
break; break;
} }
@ -61,7 +61,7 @@ class AuthModel extends CommonModel
} }
public function getEntityByID(string $id): null|AuthEntity public function getEntityByID(string $id): null|AuthEntity
{ {
$this->where('id', $id); $this->where(self::TITLE, $id);
return $this->getEntity(); return $this->getEntity();
} }
//create용 //create용

View File

@ -75,7 +75,11 @@ class RecordModel extends CommonModel
$this->where(self::TITLE, $id); $this->where(self::TITLE, $id);
return $this->getEntity(); return $this->getEntity();
} }
public function getEntitysByParent(ZoneEntity $zone_entity)
{
$this->where(self::PARENT, $zone_entity->getPK());
return $this->getEntitys();
}
//create용 //create용
public function create(array $formDatas = []): RecordEntity public function create(array $formDatas = []): RecordEntity
{ {
@ -86,11 +90,6 @@ class RecordModel extends CommonModel
{ {
return $this->modify_process($entity, $formDatas); return $this->modify_process($entity, $formDatas);
} }
public function getEntitysByParent(ZoneEntity $zone_entity)
{
$this->where(self::PARENT, $zone_entity->getPK());
return $this->getEntitys();
}
//도메인이 이미 존재하는지 체크 //도메인이 이미 존재하는지 체크
public function isUniqueHost($zone_uid, string $host, string $content): bool public function isUniqueHost($zone_uid, string $host, string $content): bool
{ {

View File

@ -125,6 +125,8 @@ abstract class CommonModel extends Model
} }
break; break;
} }
// dd($options);
// exit;
return $options; return $options;
} }
final public function getEntity(): array|object|null final public function getEntity(): array|object|null

View File

@ -46,9 +46,6 @@
</td> </td>
<?php foreach ($viewDatas['fields'] as $field): ?> <?php foreach ($viewDatas['fields'] as $field): ?>
<td><?= getFieldView_AccountHelper($field, $entity, $viewDatas, ['old_auth' => $old_auth]) ?></td> <td><?= getFieldView_AccountHelper($field, $entity, $viewDatas, ['old_auth' => $old_auth]) ?></td>
<?php if ($cnt == 2) {
dd($viewDatas['fields']);
} ?>
<?php endforeach ?> <?php endforeach ?>
</tr> </tr>
<?php $cnt++ ?> <?php $cnt++ ?>