From a0d5fa9a1cb83878479a33bf3eb842be851258e4 Mon Sep 17 00:00:00 2001 From: "choi.jh" Date: Thu, 19 Jun 2025 15:53:46 +0900 Subject: [PATCH] dbms_init...1 --- .../Admin/Customer/ServiceController.php | 4 ++- .../Customer/ServicePaymentController.php | 35 ++++++++++++++----- app/Entities/Customer/CustomerEntity.php | 10 ------ app/Entities/Customer/ServiceEntity.php | 12 ------- .../Customer/ServiceHistoryEntity.php | 12 ------- app/Entities/Customer/ServiceItemEntity.php | 12 ------- .../Customer/ServicePaymentEntity.php | 13 ------- app/Helpers/Customer/ServiceItemHelper.php | 10 ++++-- app/Helpers/Customer/ServicePaymentHelper.php | 3 -- app/Services/CommonService.php | 11 ++---- app/Services/Customer/AccountService.php | 7 ---- app/Services/Customer/CouponService.php | 7 ---- app/Services/Customer/PointService.php | 7 ---- .../Customer/ServiceHistoryService.php | 9 ----- app/Services/Customer/ServiceItemService.php | 7 ---- .../Customer/ServicePaymentService.php | 8 ----- app/Services/Customer/ServiceService.php | 8 ----- app/Services/MyLogService.php | 1 - app/Views/admin/popup/index.php | 2 +- 19 files changed, 42 insertions(+), 136 deletions(-) diff --git a/app/Controllers/Admin/Customer/ServiceController.php b/app/Controllers/Admin/Customer/ServiceController.php index 93ae37c..fc46825 100644 --- a/app/Controllers/Admin/Customer/ServiceController.php +++ b/app/Controllers/Admin/Customer/ServiceController.php @@ -2,6 +2,7 @@ namespace App\Controllers\Admin\Customer; +use App\Entities\Customer\ServiceItemEntity; use CodeIgniter\HTTP\RedirectResponse; use CodeIgniter\HTTP\RequestInterface; use CodeIgniter\HTTP\ResponseInterface; @@ -85,6 +86,7 @@ class ServiceController extends CustomerController $options = $this->getService()->getServiceItemLinkService($item_type)->getEntities(); $this->setFilterFieldOption($item_type, $options); } + // dd($this->getFilterFieldOptions()); $entities = []; foreach (parent::index_process() as $entity) { foreach (SERVICE_ITEM_TYPES as $item_type => $label) { @@ -95,7 +97,7 @@ class ServiceController extends CustomerController } $entities[] = $entity; } - // $this->modal_type = 'modal_fetch_v2'; //기본은 modal_iframe임 + // $entities = parent::index_process(); return $entities; } } diff --git a/app/Controllers/Admin/Customer/ServicePaymentController.php b/app/Controllers/Admin/Customer/ServicePaymentController.php index 261b3eb..fde8b9e 100644 --- a/app/Controllers/Admin/Customer/ServicePaymentController.php +++ b/app/Controllers/Admin/Customer/ServicePaymentController.php @@ -10,6 +10,8 @@ use App\Libraries\LogCollector; use App\Services\Customer\ServicePaymentService; use App\Services\Customer\ServiceService; +use App\Services\Customer\ClientService; + use CodeIgniter\HTTP\RedirectResponse; use CodeIgniter\HTTP\RequestInterface; use CodeIgniter\HTTP\ResponseInterface; @@ -18,6 +20,7 @@ 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) { parent::initController($request, $response, $logger); @@ -26,7 +29,6 @@ class ServicePaymentController extends CustomerController $this->uri_path .= strtolower($this->getService()->getClassName('/')) . '/'; // $this->view_path .= strtolower($this->getService()->getClassName()) . DIRECTORY_SEPARATOR; } - public function getService(): ServicePaymentService { if (!$this->_service) { @@ -48,6 +50,13 @@ class ServicePaymentController extends CustomerController } return $this->_serviceService; } + public function getClientService(): ClientService + { + if (!$this->_clientService) { + $this->_clientService = new ClientService($this->request); + } + return $this->_clientService; + } protected function getResultSuccess(string $message = MESSAGES["SUCCESS"], ?string $actionTemplate = null): RedirectResponse|string { switch ($this->getAction()) { @@ -72,6 +81,7 @@ class ServicePaymentController extends CustomerController return $result; } //Index,FieldForm관련 + protected function index_process(): array { //LINE,IP,SERVER등 추가 FilterOption 셋팅용 @@ -79,9 +89,9 @@ class ServicePaymentController extends CustomerController $options = $this->getService()->getServiceItemLinkService($item_type)->getEntities(); $this->setFilterFieldOption($item_type, $options); } + // dd($this->getFilterFieldOptions()); return parent::index_process(); } - private function getOwnersForInvoice(ClientEntity $ownerEntity): array { $temps = [ @@ -102,10 +112,9 @@ class ServicePaymentController extends CustomerController } private function getItemsForInvoice(ServicePaymentEntity $entity): array { - // dd($this->getFilterFieldOptions()); $temps = [ 'item_type' => SERVICE_ITEM_TYPES[$entity->getItemType()], - 'item_uid' => $this->getFilterFieldOption($entity->getItemType())[$entity->getItemUid()], + 'item_uid' => $this->getFilterFieldOption($entity->getItemType())[$entity->getItemUid()]->getTitle(), 'amount' => $entity->getAmount() ]; return $temps; @@ -117,17 +126,19 @@ class ServicePaymentController extends CustomerController if (!is_array($uids) || !count($uids)) { throw new \Exception("청구서에 적용될 리스트를 선택하셔야합니다."); } - $this->item_fields = ['item_type', 'ammount', 'biiling_cycle']; $owner_pk = false; $entities = []; foreach ($uids as $uid) { //기존 Entity 가져오기 $entity = $this->getService()->getEntity($uid); if (!$entity) { - LogCollector::debug(__METHOD__ . "에서 {$uid}에 대한 정보를 찾을수 없습니다."); + LogCollector::debug(__METHOD__ . "에서 {$uid}에 대한 결제정보를 찾을수 없습니다."); } //entities에 관리자 설정 - $ownerEntity = $entity->getOwner(); + $ownerEntity = $this->getClientService()->getEntity($entity->getOwnerUID()); + if (!$ownerEntity) { + LogCollector::debug(__METHOD__ . "에서 {$entity->getOwnerUID()}에 대한 관라자정보를 찾을수 없습니다."); + } if ($ownerEntity->getPK() !== $owner_pk) { if (!array_key_exists($ownerEntity->getPK(), $entities)) { $entities[$ownerEntity->getPK()] = $this->getOwnersForInvoice($ownerEntity); @@ -135,7 +146,10 @@ class ServicePaymentController extends CustomerController $owner_pk = $ownerEntity->getPK(); } //entities에 서비스 설정 - $serviceEntity = $entity->getService(); + $serviceEntity = $this->getServiceService()->getEntity($entity->getServiceUid()); + if (!$serviceEntity) { + LogCollector::debug(__METHOD__ . "에서 {$entity->getServiceUid()}에 대한 서비스정보를 찾을수 없습니다."); + } if (!array_key_exists($serviceEntity->getPK(), $entities[$owner_pk]['services'])) { $entities[$owner_pk]['services'][$serviceEntity->getPK()] = $this->getServicesForInvoice($serviceEntity); } @@ -153,6 +167,11 @@ class ServicePaymentController extends CustomerController { try { $this->initAction(__FUNCTION__); + //LINE,IP,SERVER등 추가 FilterOption 셋팅용 + foreach (SERVICE_ITEM_TYPES as $item_type => $label) { + $options = $this->getService()->getServiceItemLinkService($item_type)->getEntities(); + $this->setFilterFieldOption($item_type, $options); + } $this->entities = $this->invoice_process(); return $this->getResultSuccess(); } catch (\Exception $e) { diff --git a/app/Entities/Customer/CustomerEntity.php b/app/Entities/Customer/CustomerEntity.php index e5fafdf..b44101e 100644 --- a/app/Entities/Customer/CustomerEntity.php +++ b/app/Entities/Customer/CustomerEntity.php @@ -3,7 +3,6 @@ namespace App\Entities\Customer; use App\Entities\CommonEntity; -use App\Entities\Customer\ClientEntity; abstract class CustomerEntity extends CommonEntity { @@ -17,13 +16,4 @@ abstract class CustomerEntity extends CommonEntity { return intval($this->attributes['clientinfo_uid']); } - final public function getClient(): ClientEntity|null - { - return $this->_clientEntity; - } - final public function setClient(ClientEntity $clientEntity): void - { - $this->_clientEntity = $clientEntity; - } - //타 객체정의 부분 } diff --git a/app/Entities/Customer/ServiceEntity.php b/app/Entities/Customer/ServiceEntity.php index 49390b1..b454422 100644 --- a/app/Entities/Customer/ServiceEntity.php +++ b/app/Entities/Customer/ServiceEntity.php @@ -9,22 +9,10 @@ class ServiceEntity extends CustomerEntity { const PK = ServiceModel::PK; const TITLE = ServiceModel::TITLE; - private ?ClientEntity $_ownerEntity = null; - //고객정보객체-상속 - //관리자정보객체 final public function getOwnerUID(): int { return intval($this->attributes['ownerinfo_uid']); } - final public function getOwner(): ClientEntity|null - { - return $this->_ownerEntity; - } - final public function setOwner(ClientEntity $ownerEntity): void - { - $this->_ownerEntity = $ownerEntity; - } - //타 객체정의 부분 public function getTitle(): string { return "S" . $this->getPK(); diff --git a/app/Entities/Customer/ServiceHistoryEntity.php b/app/Entities/Customer/ServiceHistoryEntity.php index c21c674..9d91537 100644 --- a/app/Entities/Customer/ServiceHistoryEntity.php +++ b/app/Entities/Customer/ServiceHistoryEntity.php @@ -2,26 +2,14 @@ namespace App\Entities\Customer; -use App\Entities\Customer\ServiceEntity; use App\Models\Customer\ServiceHistoryModel; class ServiceHistoryEntity extends CustomerEntity { const PK = ServiceHistoryModel::PK; const TITLE = ServiceHistoryModel::TITLE; - private ?ServiceEntity $_serviceEntity = null; - //서비스정보객체 public function getServiceUid(): int { return intval($this->attributes['serviceinfo_uid']); } - final public function getService(): ServiceEntity|null - { - return $this->_serviceEntity; - } - final public function setService(ServiceEntity $serviceEntity): void - { - $this->_serviceEntity = $serviceEntity; - } - //타 객체정의 부분 } diff --git a/app/Entities/Customer/ServiceItemEntity.php b/app/Entities/Customer/ServiceItemEntity.php index 95db9fb..7d6da68 100644 --- a/app/Entities/Customer/ServiceItemEntity.php +++ b/app/Entities/Customer/ServiceItemEntity.php @@ -2,29 +2,17 @@ namespace App\Entities\Customer; -use App\Entities\Customer\ServiceEntity; use App\Models\Customer\ServiceItemModel; class ServiceItemEntity extends CustomerEntity { const PK = ServiceItemModel::PK; const TITLE = ServiceItemModel::TITLE; - private ?ServiceEntity $_serviceEntity = null; //서비스정보객체 final public function getServiceUid(): int { return intval($this->attributes['serviceinfo_uid']); } - final public function getService(): ServiceEntity|null - { - return $this->_serviceEntity; - } - final public function setService(ServiceEntity $serviceEntity): void - { - $this->_serviceEntity = $serviceEntity; - } - //타 객체정의 부분 - public function getItemType(): string { return $this->attributes['item_type']; diff --git a/app/Entities/Customer/ServicePaymentEntity.php b/app/Entities/Customer/ServicePaymentEntity.php index cd6f2bb..a6d1824 100644 --- a/app/Entities/Customer/ServicePaymentEntity.php +++ b/app/Entities/Customer/ServicePaymentEntity.php @@ -2,7 +2,6 @@ namespace App\Entities\Customer; -use App\Entities\Customer\ServiceEntity; use App\Models\Customer\ServicePaymentModel; use DateTime; @@ -10,23 +9,11 @@ class ServicePaymentEntity extends CustomerEntity { const PK = ServicePaymentModel::PK; const TITLE = ServicePaymentModel::TITLE; - private ?ServiceEntity $_serviceEntity = null; - private ?ClientEntity $_ownerEntity = null; - //고객정보객체-상속 //관리자정보객체 final public function getOwnerUID(): int { return intval($this->attributes['ownerinfo_uid']); } - final public function getOwner(): ClientEntity|null - { - return $this->_ownerEntity; - } - final public function setOwner(ClientEntity $ownerEntity): void - { - $this->_ownerEntity = $ownerEntity; - } - //서비스정보객체 final public function getServiceUid(): int { return intval($this->attributes['serviceinfo_uid']); diff --git a/app/Helpers/Customer/ServiceItemHelper.php b/app/Helpers/Customer/ServiceItemHelper.php index 1945836..22978e6 100644 --- a/app/Helpers/Customer/ServiceItemHelper.php +++ b/app/Helpers/Customer/ServiceItemHelper.php @@ -37,7 +37,10 @@ class ServiceItemHelper extends CustomerHelper $form_temps = [""]; $form_temps[] = ""; foreach ($viewDatas['control']['filter_optons'][$item_type] as $key => $filterEntity) { - $disabled = in_array($filterEntity->getStatus(), [IpEntity::STATUS_OCCUPIED, IpEntity::STATUS_FORBIDDEN]) ? 'disabled="disabled"' : ''; + $disabled = ""; + if (!array_key_exists('index_content_top_filter', $extras)) { + $disabled = in_array($filterEntity->getStatus(), [IpEntity::STATUS_OCCUPIED, IpEntity::STATUS_FORBIDDEN]) ? 'disabled="disabled"' : ''; + } $selected = ($value === $key) ? 'selected="selected"' : ''; $form_temps[] = ""; } diff --git a/app/Helpers/Customer/ServicePaymentHelper.php b/app/Helpers/Customer/ServicePaymentHelper.php index fe74b71..61ebef5 100644 --- a/app/Helpers/Customer/ServicePaymentHelper.php +++ b/app/Helpers/Customer/ServicePaymentHelper.php @@ -20,9 +20,6 @@ class ServicePaymentHelper extends CustomerHelper case "countdown": //결제일Countdown $value = $viewDatas['entity']->getView_CounDueAt(); break; - case 'item_uid': - $value = $viewDatas['control']['filter_optons'][$viewDatas['entity']->getItemType()][$value]->getTitle(); - break; case 'amount': $value = number_format($value); break; diff --git a/app/Services/CommonService.php b/app/Services/CommonService.php index c05ebbd..f945f81 100644 --- a/app/Services/CommonService.php +++ b/app/Services/CommonService.php @@ -58,18 +58,13 @@ abstract class CommonService } return $this->_model; } - //Entity의 관련객체정의용 - protected function setRelatedEntity(mixed $entity): mixed - { - return $entity; - } public function getEntity(mixed $where, ?string $message = null): mixed { $entity = is_array($where) ? $this->getModel()->where($where)->first() : $this->getModel()->find($where); if (!$entity) { throw new \Exception($message ?? __METHOD__ . "에서 해당 정보가 존재하지 않습니다"); } - return $this->setRelatedEntity($entity); + return $entity; } protected function findAllDatas(array $columns = ['*']): mixed { @@ -82,7 +77,7 @@ abstract class CommonService } $entities = []; foreach ($this->findAllDatas($columns) as $entity) { - $entities[$entity->getPK()] = $this->setRelatedEntity($entity); + $entities[$entity->getPK()] = $entity; } if (env('app.debug.index')) { echo $this->getModel()->getLastQuery() . "
"; @@ -100,12 +95,12 @@ abstract class CommonService foreach (lang($this->getClassName() . '.' . strtoupper($field)) as $key => $value) { $options[$key] = new FormOptionEntity(['uid' => $key, 'title' => $value]); } + // dd($options); break; } if (!is_array($options)) { throw new \Exception(__FUNCTION__ . "에서 field의 options 값이 array가 아닙니다.\n" . var_export($options, true)); } - // dd($options); return $options; } public function getFormFieldRule(string $action, string $field): string diff --git a/app/Services/Customer/AccountService.php b/app/Services/Customer/AccountService.php index fcb7f23..e49b94f 100644 --- a/app/Services/Customer/AccountService.php +++ b/app/Services/Customer/AccountService.php @@ -39,13 +39,6 @@ class AccountService extends CustomerService { return ['status']; } - //Entity의 관련객체정의용 - protected function setRelatedEntity(mixed $entity): AccountEntity - { - //고객정보정의 - $entity->setClient($this->getClient($entity->getClientUID())); - return parent::setRelatedEntity($entity); - } //기본 기능부분 //고객예치금처리 diff --git a/app/Services/Customer/CouponService.php b/app/Services/Customer/CouponService.php index a6ade47..a21af02 100644 --- a/app/Services/Customer/CouponService.php +++ b/app/Services/Customer/CouponService.php @@ -38,13 +38,6 @@ class CouponService extends CustomerService { return ['status']; } - //Entity의 관련객체정의용 - protected function setRelatedEntity(mixed $entity): CouponEntity - { - //고객정보정의 - $entity->setClient($this->getClient($entity->getClientUID())); - return parent::setRelatedEntity($entity); - } //기본 기능부분 //고객예치금처리 diff --git a/app/Services/Customer/PointService.php b/app/Services/Customer/PointService.php index 167ef6d..e0e6678 100644 --- a/app/Services/Customer/PointService.php +++ b/app/Services/Customer/PointService.php @@ -38,13 +38,6 @@ class PointService extends CustomerService { return ['status']; } - //Entity의 관련객체정의용 - protected function setRelatedEntity(mixed $entity): PointEntity - { - //고객정보정의 - $entity->setClient($this->getClient($entity->getClientUID())); - return parent::setRelatedEntity($entity); - } //기본 기능부분 private function setBalance(array $formDatas): ClientEntity diff --git a/app/Services/Customer/ServiceHistoryService.php b/app/Services/Customer/ServiceHistoryService.php index 1b54fbe..4a2cd84 100644 --- a/app/Services/Customer/ServiceHistoryService.php +++ b/app/Services/Customer/ServiceHistoryService.php @@ -49,15 +49,6 @@ class ServiceHistoryService extends CustomerService { return ['serviceinfo_uid', 'title', 'status', 'created_at']; } - //Entity의 관련객체정의용 - protected function setRelatedEntity(mixed $entity): ServiceHistoryEntity - { - //서비스정보정의 - $entity->setService($this->getServiceService()->getEntity($entity->getServiceUid())); - return parent::setRelatedEntity($entity); - } - //기본 기능부분 - //FieldForm관련용 public function getFormFieldOption(string $field, array $options = []): array { diff --git a/app/Services/Customer/ServiceItemService.php b/app/Services/Customer/ServiceItemService.php index 3d913e0..72c5a55 100644 --- a/app/Services/Customer/ServiceItemService.php +++ b/app/Services/Customer/ServiceItemService.php @@ -64,13 +64,6 @@ class ServiceItemService extends CustomerService return ['serviceinfo_uid', 'item_type', 'item_uid', 'billing_cycle', 'price', 'amount', 'start_at', 'updated_at', 'status']; } //Entity의 관련객체정의용 - protected function setRelatedEntity(mixed $entity): ServiceItemEntity - { - //서비스정보정의 - $entity->setService($this->getServiceService()->getEntity($entity->getServiceUid())); - return parent::setRelatedEntity($entity); - } - //기본 기능부분 //FieldForm관련용 public function getFormFieldOption(string $field, array $options = []): array { diff --git a/app/Services/Customer/ServicePaymentService.php b/app/Services/Customer/ServicePaymentService.php index ddeade7..b5b9826 100644 --- a/app/Services/Customer/ServicePaymentService.php +++ b/app/Services/Customer/ServicePaymentService.php @@ -58,14 +58,6 @@ class ServicePaymentService extends CustomerService return $this->_serviceService; } //Entity의 관련객체정의용 - protected function setRelatedEntity(mixed $entity): ServicePaymentEntity - { - //서비스정보정의 - $entity->setService($this->getServiceService()->getEntity($entity->getServiceUid())); - //관리자정보정의 - $entity->setOwner($this->getClient($entity->getOwnerUID())); - return parent::setRelatedEntity($entity); - } //기본 기능부분 //FieldForm관련용 public function getFormFieldOption(string $field, array $options = []): array diff --git a/app/Services/Customer/ServiceService.php b/app/Services/Customer/ServiceService.php index 0954a30..9f3ae8b 100644 --- a/app/Services/Customer/ServiceService.php +++ b/app/Services/Customer/ServiceService.php @@ -60,14 +60,6 @@ class ServiceService extends CustomerService return $this->_codeService; } //Entity의 관련객체정의용 - protected function setRelatedEntity(mixed $entity): ServiceEntity - { - //고객정보정의 - $entity->setClient($this->getClient($entity->getClientUID())); - //관리자정보정의 - $entity->setOwner($this->getClient($entity->getOwnerUID())); - return parent::setRelatedEntity($entity); - } public function setSearchIp(string $ip): void { $this->_searchIP = $ip; diff --git a/app/Services/MyLogService.php b/app/Services/MyLogService.php index 605054c..ed6fedf 100644 --- a/app/Services/MyLogService.php +++ b/app/Services/MyLogService.php @@ -67,7 +67,6 @@ class MyLogService extends CommonService $options = parent::getFormFieldOption($field, $options); break; } - // dd($options); return $options; } public function save($service, string $method, AuthService $myauth, string $title): MyLogEntity diff --git a/app/Views/admin/popup/index.php b/app/Views/admin/popup/index.php index e8910a5..32ce989 100644 --- a/app/Views/admin/popup/index.php +++ b/app/Views/admin/popup/index.php @@ -11,7 +11,7 @@