From 41cf819a7e1d299ad837523efd75db62a8c9f2ca Mon Sep 17 00:00:00 2001 From: "choi.jh" Date: Wed, 13 Aug 2025 10:45:59 +0900 Subject: [PATCH] dbms_init...1 --- app/Config/Routes.php | 3 + app/Controllers/Admin/AdminController.php | 20 +++++ .../Admin/Customer/CustomerController.php | 20 ----- .../Customer/ServiceHistoryController.php | 9 -- .../Admin/Customer/ServiceItemController.php | 9 -- .../Customer/ServicePaymentController.php | 9 -- app/Controllers/Admin/SearchController.php | 84 +++++++++++++++++++ app/Controllers/CLI/Payment.php | 8 -- app/Language/en/Customer/Service.php | 8 +- app/Views/admin/search/index.php | 70 ++++++++++++++++ app/Views/layouts/admin/top.php | 12 +-- 11 files changed, 185 insertions(+), 67 deletions(-) create mode 100644 app/Controllers/Admin/SearchController.php create mode 100644 app/Views/admin/search/index.php diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 81ee6cc..09d5a0a 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -49,6 +49,9 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au $routes->get('/', 'MyLogController::index'); $routes->get('view/(:num)', 'MyLogController::view/$1'); }); + $routes->group('search', ['namespace' => 'App\Controllers\Admin'], function ($routes) { + $routes->get('/', 'SearchController::index'); + }); $routes->group('customer', ['namespace' => 'App\Controllers\Admin\Customer'], function ($routes) { $routes->group('client', ['namespace' => 'App\Controllers\Admin\Customer'], function ($routes) { $routes->get('/', 'ClientController::index'); diff --git a/app/Controllers/Admin/AdminController.php b/app/Controllers/Admin/AdminController.php index e71b87a..973755b 100644 --- a/app/Controllers/Admin/AdminController.php +++ b/app/Controllers/Admin/AdminController.php @@ -6,9 +6,11 @@ use App\Controllers\CommonController; use CodeIgniter\HTTP\RequestInterface; use CodeIgniter\HTTP\ResponseInterface; use Psr\Log\LoggerInterface; +use App\Services\Customer\ServiceService; abstract class AdminController extends CommonController { + private ?ServiceService $_serviceService = null; public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger) { parent::initController($request, $response, $logger); @@ -18,4 +20,22 @@ abstract class AdminController extends CommonController $this->content_title = "관리자"; $this->helper = $this->getHelper(); } + //Service,ServicePaymentController사용 + final public function getServiceService(): ServiceService + { + if (!$this->_serviceService) { + $this->_serviceService = new ServiceService(); + } + return $this->_serviceService; + } + + //LINE,IP,SERVER등 추가 FilterOption 셋팅용 + final protected function setFilterOptionsByItemType(): void + { + //LINE,IP,SERVER등 추가 FilterOption 셋팅용 + foreach (SERVICE_ITEM_TYPES as $item_type => $label) { + $this->setFieldRule($item_type, $this->getFormFieldRule($this->getAction(), $item_type)); + $this->setFilterFieldOption($item_type, $this->getServiceService()->getFilterOptionsByItemType($item_type)); + } + } } diff --git a/app/Controllers/Admin/Customer/CustomerController.php b/app/Controllers/Admin/Customer/CustomerController.php index d60e25f..d445186 100644 --- a/app/Controllers/Admin/Customer/CustomerController.php +++ b/app/Controllers/Admin/Customer/CustomerController.php @@ -7,32 +7,12 @@ use CodeIgniter\HTTP\RequestInterface; use CodeIgniter\HTTP\ResponseInterface; use Psr\Log\LoggerInterface; -use App\Services\Customer\ServiceService; abstract class CustomerController extends AdminController { - private ?ServiceService $_serviceService = null; public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger) { parent::initController($request, $response, $logger); } - public function getServiceService(): ServiceService - { - if (!$this->_serviceService) { - $this->_serviceService = new ServiceService(); - } - return $this->_serviceService; - } //Index,FieldForm관련 - - //Service,ServicePaymentController사용 - //LINE,IP,SERVER등 추가 FilterOption 셋팅용 - final protected function setFilterOptionsByItemType(): void - { - //LINE,IP,SERVER등 추가 FilterOption 셋팅용 - foreach (SERVICE_ITEM_TYPES as $item_type => $label) { - $this->setFieldRule($item_type, $this->getFormFieldRule($this->getAction(), $item_type)); - $this->setFilterFieldOption($item_type, $this->getServiceService()->getFilterOptionsByItemType($item_type)); - } - } } diff --git a/app/Controllers/Admin/Customer/ServiceHistoryController.php b/app/Controllers/Admin/Customer/ServiceHistoryController.php index 98739d5..e4f68aa 100644 --- a/app/Controllers/Admin/Customer/ServiceHistoryController.php +++ b/app/Controllers/Admin/Customer/ServiceHistoryController.php @@ -9,11 +9,9 @@ use Psr\Log\LoggerInterface; use App\Helpers\Customer\ServiceHistoryHelper; use App\Services\Customer\ServiceHistoryService; -use App\Services\Customer\ServiceService; class ServiceHistoryController extends CustomerController { - private ?ServiceService $_serviceService = null; public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger) { parent::initController($request, $response, $logger); @@ -38,13 +36,6 @@ class ServiceHistoryController extends CustomerController } return $this->_helper; } - public function getServiceService(): ServiceService - { - if (!$this->_serviceService) { - $this->_serviceService = new ServiceService(); - } - return $this->_serviceService; - } protected function getResultSuccess(string $message = MESSAGES["SUCCESS"], ?string $actionTemplate = null): RedirectResponse|string { diff --git a/app/Controllers/Admin/Customer/ServiceItemController.php b/app/Controllers/Admin/Customer/ServiceItemController.php index 32052ed..8417c9d 100644 --- a/app/Controllers/Admin/Customer/ServiceItemController.php +++ b/app/Controllers/Admin/Customer/ServiceItemController.php @@ -7,7 +7,6 @@ use App\Helpers\Customer\ServiceItemHelper; use App\Services\Customer\ServiceItemService; use App\Services\Customer\ServicePaymentService; -use App\Services\Customer\ServiceService; use CodeIgniter\HTTP\RedirectResponse; use CodeIgniter\HTTP\RequestInterface; use CodeIgniter\HTTP\ResponseInterface; @@ -15,7 +14,6 @@ use Psr\Log\LoggerInterface; class ServiceItemController extends CustomerController { - private ?ServiceService $_serviceService = null; private ?ServicePaymentService $_servicePaymentService = null; public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger) { @@ -46,13 +44,6 @@ class ServiceItemController extends CustomerController } return $this->_helper; } - public function getServiceService(): ServiceService - { - if (!$this->_serviceService) { - $this->_serviceService = new ServiceService(); - } - return $this->_serviceService; - } public function getServicePaymentService(): ServicePaymentService { if (!$this->_servicePaymentService) { diff --git a/app/Controllers/Admin/Customer/ServicePaymentController.php b/app/Controllers/Admin/Customer/ServicePaymentController.php index abb4553..b85fbb5 100644 --- a/app/Controllers/Admin/Customer/ServicePaymentController.php +++ b/app/Controllers/Admin/Customer/ServicePaymentController.php @@ -9,7 +9,6 @@ use App\Helpers\Customer\ServicePaymentHelper; use App\Libraries\LogCollector; use App\Services\Customer\ServicePaymentService; -use App\Services\Customer\ServiceService; use App\Services\Customer\ClientService; use CodeIgniter\HTTP\RedirectResponse; @@ -19,7 +18,6 @@ use Psr\Log\LoggerInterface; class ServicePaymentController extends CustomerController { - private ?ServiceService $_serviceService = null; private ?ClientService $_clientService = null; public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger) { @@ -43,13 +41,6 @@ class ServicePaymentController extends CustomerController } return $this->_helper; } - public function getServiceService(): ServiceService - { - if (!$this->_serviceService) { - $this->_serviceService = new ServiceService(); - } - return $this->_serviceService; - } public function getClientService(): ClientService { if (!$this->_clientService) { diff --git a/app/Controllers/Admin/SearchController.php b/app/Controllers/Admin/SearchController.php new file mode 100644 index 0000000..bc2a3bd --- /dev/null +++ b/app/Controllers/Admin/SearchController.php @@ -0,0 +1,84 @@ +content_title = lang("{$this->getService()->getClassName()}.title"); + $this->class_path .= $this->getService()->getClassName(); + $this->uri_path .= strtolower($this->getService()->getClassName('/')) . '/'; + // $this->view_path .= strtolower($this->getService()->getClassName()) . DIRECTORY_SEPARATOR; + + } + public function getService(): ServiceService + { + if (!$this->_service) { + $this->_service = new ServiceService(); + } + return $this->_service; + } + public function getHelper(): ServiceHelper + { + if (!$this->_helper) { + $this->_helper = new ServiceHelper(); + } + return $this->_helper; + } + public function getCodeService(): CodeService + { + if (!$this->_codeService) { + $this->_codeService = new CodeService(); + } + return $this->_codeService; + } + public function getServicePaymentService(): ServicePaymentService + { + if (!$this->_servicePaymentService) { + $this->_servicePaymentService = new ServicePaymentService(); + } + return $this->_servicePaymentService; + } + protected function getResultSuccess(string $message = MESSAGES["SUCCESS"], ?string $actionTemplate = null): RedirectResponse|string + { + switch ($this->getAction()) { + case 'index': + $result = parent::getResultSuccess($message, $this->request->getVar('ActionTemplate') ?? $actionTemplate ?? 'search'); + break; + default: + $result = parent::getResultSuccess($message, $actionTemplate); + break; + } + return $result; + } + //Index,FieldForm관련 + //List 관련 + protected function index_process(): void + { + //LINE,IP,SERVER등 추가 FilterOption 셋팅용 + $this->setFilterOptionsByItemType(); + //부모함수처리 + parent::index_process(); + //추가처리 + $entities = []; + foreach ($this->entities as $entity) { + //각각의 Item항목 정의 + $entities[$entity->getPK()] = $this->getService()->setItemEntitiesByService($entity); + } + $this->entities = $entities; + } +} diff --git a/app/Controllers/CLI/Payment.php b/app/Controllers/CLI/Payment.php index 21281e9..4f9f764 100644 --- a/app/Controllers/CLI/Payment.php +++ b/app/Controllers/CLI/Payment.php @@ -14,7 +14,6 @@ use Psr\Log\LoggerInterface; class Payment extends BaseController { private $_db; - private ?ServiceService $_serviceService = null; private ?ServiceItemService $_servicItemeService = null; private ?ServicePaymentService $_servicePaymentService = null; public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger) @@ -22,13 +21,6 @@ class Payment extends BaseController parent::initController($request, $response, $logger); $this->_db = \Config\Database::connect(); } - public function getServiceService(): ServiceService - { - if (!$this->_serviceService) { - $this->_serviceService = new ServiceService(); - } - return $this->_serviceService; - } public function getServiceItemService(): ServiceItemService { if (!$this->_servicItemeService) { diff --git a/app/Language/en/Customer/Service.php b/app/Language/en/Customer/Service.php index c537b1a..cdcdf21 100644 --- a/app/Language/en/Customer/Service.php +++ b/app/Language/en/Customer/Service.php @@ -2,14 +2,14 @@ return [ 'title' => "고객서비스정보", 'label' => [ - 'clientinfo_uid' => "고객", - 'ownerinfo_uid' => "관리자", + 'clientinfo_uid' => "총관리자", + 'ownerinfo_uid' => "실고객", 'user_uid' => "작업자", 'code' => "서비스코드", 'type' => "서비스형식", 'location' => "위치", - 'switchinfo_uid' => "스위치코드", - 'codeinfo_uid' => "서버코드", + 'switchinfo_uid' => "스위치정보", + 'codeinfo_uid' => "장비번호", 'raid' => "RAID", 'billing_at' => "결제일", 'start_at' => "개통일", diff --git a/app/Views/admin/search/index.php b/app/Views/admin/search/index.php new file mode 100644 index 0000000..40df972 --- /dev/null +++ b/app/Views/admin/search/index.php @@ -0,0 +1,70 @@ +extend(LAYOUTS[$viewDatas['layout']]['path']) ?> +section('content') ?> +alert($error) ?> +
include(LAYOUTS[$viewDatas['layout']]['path'] . '/top'); ?>
+ + + + + + +
+ + include(LAYOUTS[$viewDatas['layout']]['path'] . '/left_menu'); ?> + + + +
include("templates/{$viewDatas['layout']}/index_header"); ?>
+
+ +
+ include("templates/{$viewDatas['layout']}/index_content_top"); ?> + 'batchjob_form', 'method' => "post"]) ?> + + + + + + + + + + + + + + + getListRowColor($entity) ?>> + + + + + + + + + + + + + +
번호getListLabel($field, lang("{$viewDatas['class_path']}.label.{$field}"), $viewDatas) ?>작업
getListButton('modify', '', $viewDatas) ?>getFieldView($field, $entity->$field, $viewDatas) ?> + getListButton('view', '', $viewDatas) ?>  + getListButton('history', '', $viewDatas) ?>  + getListButton('delete', '', $viewDatas) ?> +
+ + $label): ?> + $label): ?> +
getFieldLabel($item_type, $label, $viewDatas) ?>
getFieldView($item_type, $entity->$item_type, $viewDatas) ?>
+
+ include("templates/{$viewDatas['layout']}/index_content_bottom"); ?> + +
+
+ + +
+ +
include(LAYOUTS[$viewDatas['layout']]['path'] . '/bottom'); ?>
+endSection() ?> \ No newline at end of file diff --git a/app/Views/layouts/admin/top.php b/app/Views/layouts/admin/top.php index 0a26820..f1e56aa 100644 --- a/app/Views/layouts/admin/top.php +++ b/app/Views/layouts/admin/top.php @@ -2,20 +2,16 @@