From 29cbb53e04092398b93fe780498dbe7cf92e6235 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=B5=9C=EC=A4=80=ED=9D=A0?= Date: Mon, 23 Sep 2024 19:37:20 +0900 Subject: [PATCH] Automation init...4 --- app/Config/Constants.php | 1 - app/Config/Routes.php | 1 + app/Controllers/MVController.php | 8 ++-- app/Libraries/MyCloudflare/Account.php | 13 ++++--- app/Views/layouts/admin.php | 20 ++++------ app/Views/layouts/admin/left_menu.php | 18 ++++----- public/css/admin.css | 54 +++++++++++++------------- public/css/admin/left_menu.css | 30 +++++++------- public/js/admin/side_menu.js | 13 +++---- 9 files changed, 74 insertions(+), 84 deletions(-) diff --git a/app/Config/Constants.php b/app/Config/Constants.php index c063e50..99adc53 100644 --- a/app/Config/Constants.php +++ b/app/Config/Constants.php @@ -176,7 +176,6 @@ define('ICONS', [ 'FLAG' => '', 'SEARCH' => '', 'EXCEL' => '', - 'HOME' => '', 'PLAY' => '', 'CART' => '', 'CARD' => '', diff --git a/app/Config/Routes.php b/app/Config/Routes.php index b458a29..98c18da 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -36,6 +36,7 @@ $routes->group('cloudflare', ['namespace' => 'App\Controllers\Cloudflare'], func $routes->group('account', function ($routes) { $routes->get('/', 'AccountController::index'); $routes->get('create', 'AccountController::create_form'); + $routes->post('create', 'AccountController::create'); }); $routes->group('zone', function ($routes) { $routes->get('/', 'ZoneController::index'); diff --git a/app/Controllers/MVController.php b/app/Controllers/MVController.php index 2813bb5..6c1002e 100644 --- a/app/Controllers/MVController.php +++ b/app/Controllers/MVController.php @@ -26,8 +26,8 @@ abstract class MVController extends CommonController throw new \Exception(__FUNCTION__ . "에서 {$field}의 데이터가 array가 아닙니다.\n" . var_export($temps, true)); } $options = [ - ["" => lang($this->class_name . '.label.' . $field) . ' 선택'], - lang($this->class_name . '.' . strtoupper($field)), + "" => lang($this->class_name . '.label.' . $field) . ' 선택', + ...lang($this->class_name . '.' . strtoupper($field)), ]; break; } @@ -87,10 +87,10 @@ abstract class MVController extends CommonController protected function validateFormData(): void { //변경할 값 확인 : Upload된 파일 검증시 $this->request->getVar()보다 먼처 체크필요 - $validation = \Config\Services::validation(); + $validation = service('validation'); $validation->setRules($this->getModel()->getFieldRules($this->fields)); if (!$validation->withRequest($this->request)->run()) { - throw new \Exception("데이터 검증 오류발생\n" . implode("\n", $this->validator->getErrors())); + throw new \Exception("데이터 검증 오류발생\n" . implode("\n", $validation->getErrors())); } } //전송된 데이터 diff --git a/app/Libraries/MyCloudflare/Account.php b/app/Libraries/MyCloudflare/Account.php index 7a44364..ea618de 100644 --- a/app/Libraries/MyCloudflare/Account.php +++ b/app/Libraries/MyCloudflare/Account.php @@ -37,16 +37,17 @@ class Account extends MyCloudflare // ] protected function getArrayByResult($result): array { - $formDatas[$this->getMyStorage()->getPKField()] = $result->id; + $formDatas[$this->getMyStorage()->getPKField()] = $result->id; $formDatas[$this->getMyStorage()->getTitleField()] = $result->name; - $formDatas['type'] = $result->type; - $formDatas['status'] = 'use'; - $formDatas['updated_at'] = $result->created_on; - $formDatas['created_at'] = $result->created_on; + $formDatas['type'] = $result->type; + $formDatas['status'] = 'use'; + $formDatas['updated_at'] = $result->created_on; + $formDatas['created_at'] = $result->created_on; return $formDatas; } public function create(array $formDatas): AccountEntity { + throw new \Exception(var_dump($formDatas)); //Socket용 $cf = $this->getMySocket()->request($formDatas['apikey']) ->post('accounts', [ @@ -59,7 +60,7 @@ class Account extends MyCloudflare } //Storage용 $formDatas = $this->getArrayByResult($cf->result); - $entity = $this->getMyStorage()->create($formDatas); + $entity = $this->getMyStorage()->create($formDatas); log_message("notice", "Account::" . __FUNCTION__ . "=> 작업을 완료하였습니다."); return $entity; } diff --git a/app/Views/layouts/admin.php b/app/Views/layouts/admin.php index 3634b16..dad75ba 100644 --- a/app/Views/layouts/admin.php +++ b/app/Views/layouts/admin.php @@ -24,25 +24,19 @@
-
-
- include($viewDatas['layout']['path'] . '/head'); ?> -
+
+ include($viewDatas['layout']['path'] . '/head'); ?>
-
-
- include($viewDatas['layout']['path'] . '/left_menu'); ?> -
-
+
+
include($viewDatas['layout']['path'] . '/left_menu'); ?>
+
include('templates/admin/header'); ?>
renderSection('content') ?>
-
-
- include($viewDatas['layout']['path'] . '/tail'); ?> -
+
+ include($viewDatas['layout']['path'] . '/tail'); ?>
diff --git a/app/Views/layouts/admin/left_menu.php b/app/Views/layouts/admin/left_menu.php index 259c7c5..dee0928 100644 --- a/app/Views/layouts/admin/left_menu.php +++ b/app/Views/layouts/admin/left_menu.php @@ -1,16 +1,14 @@ -