From 402c976fde0d6a2832b6e2029673b0e01993019e Mon Sep 17 00:00:00 2001 From: "choi.jh" Date: Fri, 24 Oct 2025 17:52:28 +0900 Subject: [PATCH] dbmsv3 init...1 --- .../Admin/Customer/ServiceController.php | 21 ++ app/Controllers/CLI/Payment.php | 4 +- app/Entities/Customer/ServiceEntity.php | 25 +-- app/Entities/Equipment/ServerPartEntity.php | 25 --- app/Helpers/Equipment/ServerPartHelper.php | 2 +- app/Interfaces/Equipment/ServerInterface.php | 7 +- app/Interfaces/PaymentInterface.php | 5 +- .../Customer/ServiceV1Processor.php | 184 +++++++++++++----- app/Services/CommonService.php | 4 +- app/Services/Customer/AccountService.php | 6 +- app/Services/Customer/ServiceService.php | 183 ++++++++++------- app/Services/Equipment/ServerPartService.php | 21 +- app/Services/Equipment/ServerService.php | 62 ++---- app/Services/Part/IPService.php | 3 +- app/Services/Part/SWITCHService.php | 3 +- app/Services/PaymentService.php | 99 +++++----- app/Views/admin/service/modify_form.php | 10 +- app/Views/admin/service/view.php | 10 +- app/Views/admin/welcome/new_service.php | 2 +- app/Views/cells/service/server.php | 4 +- 20 files changed, 367 insertions(+), 313 deletions(-) diff --git a/app/Controllers/Admin/Customer/ServiceController.php b/app/Controllers/Admin/Customer/ServiceController.php index d7e9577..0f50d25 100644 --- a/app/Controllers/Admin/Customer/ServiceController.php +++ b/app/Controllers/Admin/Customer/ServiceController.php @@ -3,6 +3,7 @@ namespace App\Controllers\Admin\Customer; use App\Entities\Customer\ServiceEntity; +use App\Entities\Equipment\ServerEntity; use App\Services\Customer\ServiceService; use App\Services\PaymentService; use CodeIgniter\HTTP\RedirectResponse; @@ -72,6 +73,26 @@ class ServiceController extends CustomerController $this->getService()->setFormDatas($formDatas); parent::create_form_process(); } + //수정관련 + protected function modify_form_process(mixed $entity): ServiceEntity + { + $serverEntity = $this->getService()->getServerService()->getEntity($entity->getServerInfoUID()); + if (!$serverEntity instanceof ServerEntity) { + throw new \Exception("[{$entity->getServerInfoUID()}]에 대한 서버정보를 찾을 수 없습니다."); + } + $this->serverEntity = $serverEntity; + return parent::modify_form_process($entity); + } + //View 관련 + protected function view_process(mixed $entity): ServiceEntity + { + $serverEntity = $this->getService()->getServerService()->getEntity($entity->getServerInfoUID()); + if (!$serverEntity instanceof ServerEntity) { + throw new \Exception("[{$entity->getServerInfoUID()}]에 대한 서버정보를 찾을 수 없습니다."); + } + $this->serverEntity = $serverEntity; + return parent::view_process($entity); + } //List 관련 protected function index_process(array $entities = []): array { diff --git a/app/Controllers/CLI/Payment.php b/app/Controllers/CLI/Payment.php index b9dc5d9..065a63a 100644 --- a/app/Controllers/CLI/Payment.php +++ b/app/Controllers/CLI/Payment.php @@ -47,8 +47,8 @@ class Payment extends BaseController $entity, [ 'billing_at' => $this->getService()->getNextMonthDate($entity), - 'paymentifo_uid' => $entity->getPaymentEntity()->getPK(), - 'serverinfo_uid' => $entity->getServerEntity()->getPK() + 'paymentifo_uid' => $entity->getPaymentUID(), + 'serverinfo_uid' => $entity->getServerInfoUID() ] ); log_message("notice", sprintf("%s/%s원 결제추가\n", $entity->getCustomTitle(), $entity->getAmount())); diff --git a/app/Entities/Customer/ServiceEntity.php b/app/Entities/Customer/ServiceEntity.php index 5be2977..88d985b 100644 --- a/app/Entities/Customer/ServiceEntity.php +++ b/app/Entities/Customer/ServiceEntity.php @@ -2,8 +2,6 @@ namespace App\Entities\Customer; -use App\Entities\Equipment\ServerEntity; -use App\Entities\PaymentEntity; use App\Models\Customer\ServiceModel; class ServiceEntity extends CustomerEntity @@ -11,28 +9,7 @@ class ServiceEntity extends CustomerEntity const PK = ServiceModel::PK; const TITLE = ServiceModel::TITLE; const DEFAULT_STATUS = STATUS['AVAILABLE']; - public function setServerEntity(ServerEntity $entity): self - { - $this->attributes['serverEntity'] = $entity; - return $this; - } - final public function getServerEntity(): ServerEntity|null - { - return $this->attributes['serverEntity'] ?? null; - } - final public function setPaymentEntity(PaymentEntity $entity): self - { - $this->attributes['paymentEntity'] = $entity; - return $this; - } - final public function getPaymentEntity(): PaymentEntity|null - { - return $this->attributes['paymentEntity'] ?? null; - } - final public function getUserUID(): int|null - { - return $this->attributes['user_uid'] ?? null; - } + final public function getClientInfoUID(): int|null { return $this->attributes['clientinfo_uid'] ?? null; diff --git a/app/Entities/Equipment/ServerPartEntity.php b/app/Entities/Equipment/ServerPartEntity.php index d3dbc87..27d60a1 100644 --- a/app/Entities/Equipment/ServerPartEntity.php +++ b/app/Entities/Equipment/ServerPartEntity.php @@ -2,32 +2,12 @@ namespace App\Entities\Equipment; -use App\Entities\PaymentEntity; use App\Models\Equipment\ServerPartModel; class ServerPartEntity extends EquipmentEntity { const PK = ServerPartModel::PK; const TITLE = ServerPartModel::TITLE; - public function setPartEntity(mixed $entity): self - { - $this->attributes['partEntity'] = $entity; - return $this; - } - //여러클래스존재가능 - public function getPartEntity(): mixed - { - return $this->attributes['partEntity']; - } - final public function setPaymentEntity(PaymentEntity $entity): self - { - $this->attributes['paymentEntity'] = $entity; - return $this; - } - final public function getPaymentEntity(): PaymentEntity|null - { - return $this->attributes['paymentEntity'] ?? null; - } final public function getServerInfoUID(): int|null { return $this->attributes['serverinfo_uid'] ?? null; @@ -49,15 +29,10 @@ class ServerPartEntity extends EquipmentEntity return $this->attributes['payment_uid'] ?? null; } //기본기능용 - public function getPrice(): int - { - return $this->getPartEntity() !== null ? $this->getPartEntity()->getPrice() : 0; - } public function getTotalAmount(): int { return $this->getAmount() * $this->getCnt(); } - public function getType(): string { return $this->attributes['type']; diff --git a/app/Helpers/Equipment/ServerPartHelper.php b/app/Helpers/Equipment/ServerPartHelper.php index 3cf9f34..96051b9 100644 --- a/app/Helpers/Equipment/ServerPartHelper.php +++ b/app/Helpers/Equipment/ServerPartHelper.php @@ -95,7 +95,7 @@ class ServerPartHelper extends EquipmentHelper case 'IP': case 'CS': //파트 Entity - $title = $viewDatas['entity']->getPartEntity()->getTitle(); + $title = $viewDatas['entity']->getTitle(); $title .= $viewDatas['entity']->getCnt() > 1 ? "*" . $viewDatas['entity']->getCnt() . "개" : ""; $title .= $viewDatas['entity']->getExtra() ? "[" . $viewDatas['entity']->getExtra() . "]" : ""; if (array_key_exists('return', $extras) && $extras['return'] == 'onlyText') { diff --git a/app/Interfaces/Equipment/ServerInterface.php b/app/Interfaces/Equipment/ServerInterface.php index b9ea47f..56dec4f 100644 --- a/app/Interfaces/Equipment/ServerInterface.php +++ b/app/Interfaces/Equipment/ServerInterface.php @@ -2,12 +2,11 @@ namespace App\Interfaces\Equipment; +use App\Entities\Customer\ServiceEntity; use App\Entities\Equipment\ServerEntity; interface ServerInterface extends EquipmentInterface { - //서버 생성 - public function setServer(ServerEntity $serverEntity): void; - //서버 해지 - public function unsetServer(ServerEntity $serverEntity): void; + public function attachToService(ServiceEntity $service, string $serverinfo_uid, array $formDatas = []): ServerEntity; + public function detachFromService(string $serverinfo_uid): ServerEntity; } diff --git a/app/Interfaces/PaymentInterface.php b/app/Interfaces/PaymentInterface.php index 2b0007b..af470b9 100644 --- a/app/Interfaces/PaymentInterface.php +++ b/app/Interfaces/PaymentInterface.php @@ -2,9 +2,12 @@ namespace App\Interfaces; +use App\Entities\Customer\ServiceEntity; use App\Entities\PaymentEntity; interface PaymentInterface { - public function setPayment(PaymentEntity $paymentEntity): mixed; + public function createForService(ServiceEntity $service, int $amount): PaymentEntity; + public function updateForService(ServiceEntity $service, string $payment_uid, int $amount): PaymentEntity; + public function unlinkFromService(string $payment_uid): PaymentEntity; } diff --git a/app/Processors/Customer/ServiceV1Processor.php b/app/Processors/Customer/ServiceV1Processor.php index 6682777..b3d8086 100644 --- a/app/Processors/Customer/ServiceV1Processor.php +++ b/app/Processors/Customer/ServiceV1Processor.php @@ -24,85 +24,163 @@ class ServiceV1Processor private MyLogService $logService, ) {} - /** 1) 서비스 생성 */ - private function createService(array $formDatas): ServiceEntity + /** 서버 연결 */ + public function setServer(ServiceEntity $entity, string $serverinfo_uid, array $formDatas = []): ServerEntity { - return $this->serviceService->getModel()->create($formDatas); - } - /** 2) 서버 연결 */ - private function attachServer(ServiceEntity $entity): ServerEntity - { - $serverEntity = $this->serverService->getEntity($entity->getServerInfoUID()); + $serverEntity = $this->serverService->getEntity($serverinfo_uid); if (!$serverEntity instanceof ServerEntity) { - throw new RuntimeException(sprintf( - '[%s]에 대한 서버정보를 찾을 수 없습니다.', - $entity->getServerInfoUID() - )); + throw new RuntimeException("[{$serverinfo_uid}]에 대한 서버정보를 찾을 수 없습니다."); + } + $formDatas['clientinfo_uid'] = $entity->getClientInfoUID(); + $formDatas['serviceinfo_uid'] = $entity->getPK(); + $formDatas['status'] = STATUS['OCCUPIED']; + return $this->serverService->getModel()->modify($serverEntity, $formDatas); + } + /** 서버 연결 해지 */ + public function unsetServer(string $serverinfo_uid): ServerEntity + { + $serverEntity = $this->serverService->getEntity($serverinfo_uid); + if (!$serverEntity instanceof ServerEntity) { + throw new RuntimeException("[{$serverinfo_uid}]에 대한 서버정보를 찾을 수 없습니다."); } return $this->serverService->getModel()->modify($serverEntity, [ - 'clientinfo_uid' => $entity->getClientInfoUID(), - 'serviceinfo_uid' => $entity->getPK(), - 'status' => STATUS['OCCUPIED'], + 'clientinfo_uid' => null, + 'serviceinfo_uid' => null, + 'format_at' => date("Y-m-d"), + 'status' => STATUS['AVAILABLE'], ]); } - /** 3) 금액 계산 */ - private function calculateAmount(ServiceEntity $entity, ServerEntity $serverEntity): ServiceEntity + /** 결제 생성 */ + public function createPayment(ServiceEntity $entity, int $amount): PaymentEntity { - $amount = $this->serviceService->getCalculatedAmount($entity, $serverEntity); - return $this->serviceService->getModel()->modify($entity, ['amount' => $amount]); - } - /** 4) 결제 생성 */ - private function createPayment(ServiceEntity $entity, ServerEntity $serverEntity): PaymentEntity - { - $billingAt = new DateTimeImmutable($entity->getBillingAt() ?? 'now', new DateTimeZone('Asia/Tokyo')); - $title = sprintf('[%s/%s] %s 서비스비용', $serverEntity->getCode(), $serverEntity->getIP(), $billingAt->format('Y년 n월')); - + $billingAt = new DateTimeImmutable($entity->getBillingAt(), new DateTimeZone('Asia/Tokyo')); return $this->paymentService->getModel()->create([ 'clientinfo_uid' => $entity->getClientInfoUID(), 'serviceinfo_uid' => $entity->getPK(), - 'serverinfo_uid' => $entity->getServerInfoUID(), - 'title' => $title, - 'amount' => $entity->getAmount(), + 'serverinfo_uid' => $entity->getServerInfoUID(), //서버정보 번호 + 'title' => sprintf('[%s] %s 서비스비용', $entity->getTitle(), $billingAt->format('Y년 n월')), + 'amount' => $amount, 'billing' => PAYMENT['BILLING']['MONTH'], 'billing_at' => $billingAt->format('Y-m-d'), ]); } - /** 5) 서비스 링크 갱신(FK 반영) */ - private function updateLinks(ServiceEntity $entity, ServerEntity $serverEntity, PaymentEntity $paymentEntity): ServiceEntity + /** 결제 수정 */ + public function modifyPayment(ServiceEntity $entity, string $payment_uid, int $amount): PaymentEntity { - return $this->serviceService->getModel()->modify($entity, [ - 'serverinfo_id' => $serverEntity->getPK(), - 'payment_uid' => $paymentEntity->getPK(), - ]); - } - /** 6) 로그 */ - private function stepLog(ServiceEntity $entity): void - { - $this->logService->create([ - 'title' => sprintf('[%s] 서비스정보 추가', $entity->getCustomTitle()), - 'status' => $entity->getStatus(), + $paymentEntity = $this->paymentService->getEntity($payment_uid); + if (!$paymentEntity instanceof PaymentEntity) { + throw new RuntimeException("[{$payment_uid}]에 대한 결제정보를 찾을 수 없습니다."); + } + + $billingAt = new DateTimeImmutable($entity->getBillingAt(), new DateTimeZone('Asia/Tokyo')); + + return $this->paymentService->getModel()->modify($paymentEntity, [ + 'clientinfo_uid' => $entity->getClientInfoUID(), + 'serviceinfo_uid' => $entity->getPK(), + 'serverinfo_uid' => $entity->getServerInfoUID(), + 'title' => sprintf('[%s] %s 서비스비용', $entity->getTitle(), $billingAt->format('Y년 n월')), + 'amount' => $amount, + 'billing' => PAYMENT['BILLING']['MONTH'], + 'billing_at' => $billingAt->format('Y-m-d'), ]); } + /** 결제 삭제(서비스UID,서버UID만 NULL 처리하고 다른정보는 그냥 두고 수정한다.) */ + public function deletePayment(string $payment_uid): PaymentEntity + { + $paymentEntity = $this->paymentService->getEntity($payment_uid); + if (!$paymentEntity instanceof PaymentEntity) { + throw new RuntimeException("[{$payment_uid}]에 대한 결제정보를 찾을 수 없습니다."); + } + return $this->paymentService->getModel()->modify($paymentEntity, [ + 'serviceinfo_uid' => null, + 'serverinfo_uid' => null, + ]); + } + /** 로그 생성*/ + public function addLog(string $title, string $status): void + { + $this->logService->getModel()->create(['title' => $title, 'status' => $status,]); + } + /** 최종 결과만 필요할 때 */ - public function create(array $formDatas): ServiceEntity + public function createService(array $formDatas): ServiceEntity { $this->db->transStart(); if (!isset($formDatas['serverinfo_uid'])) { throw new RuntimeException('서버가 지정되지 않았습니다.'); } - // 1) 서비스 생성 - $entity = $this->createService($formDatas); - // 2) 서버 연결 - $serverEntity = $this->attachServer($entity); + // 1) 서비스 추가 + $entity = $this->serviceService->getModel()->create($formDatas); + // 2) 서버 연결 + $serverEntity = $this->setServer($entity, $entity->getServerInfoUID()); // 3) 금액 계산 - $entity = $this->calculateAmount($entity, $serverEntity); + $amount = $this->serviceService->getCalculatedAmount($entity, $serverEntity); // 4) 결제 생성 - $paymentEntity = $this->createPayment($entity, $serverEntity); - // 5) 서비스 링크 갱신(FK 반영) - $entity = $this->updateLinks($entity, $serverEntity, $paymentEntity); - // 6) 로그 (필요 시 이벤트로 대체) - $this->stepLog($entity); + $paymentEntity = $this->createPayment($entity, $amount); + // 5) 로그 (필요 시 이벤트로 대체) + $this->addLog("{$entity->getCustomTitle()} 서비스 추가", $entity->getStatus()); + // 6) 서비스 갱신(FK 반영) + $this->serviceService->getModel()->modify($entity, [ + 'title' => $entity->getCustomTitle(), + 'serverinfo_id' => $serverEntity->getPK(), + 'payment_uid' => $paymentEntity->getPK(), + ]); + $this->db->transComplete(); + if ($this->db->transStatus() === false) { + throw new RuntimeException('트랜잭션 실패'); + } + return $entity; + } + + public function modifyService(ServiceEntity $entity, array $formDatas): ServiceEntity + { + $this->db->transStart(); + if (!isset($formDatas['serverinfo_uid'])) { + throw new RuntimeException('변경할 서버가 지정되지 않았습니다.'); + } + // 서버번호가 변경되었다면 기존 서버 연결 해지 + if ($entity->getServerInfoUID() !== null && $entity->getServerInfoUID() !== $formDatas['serverinfo_uid']) { + $this->unsetServer($entity->getServerInfoUID()); + } + // 1) 서비스정보 수정 + $entity = $this->serviceService->getModel()->modify($entity, $formDatas); + // 2) 서버 재연결 + $serverEntity = $this->setServer($entity, $entity->getServerInfoUID()); + // 3) 금액 계산 + $amount = $this->serviceService->getCalculatedAmount($entity, $serverEntity); + // 4) 결제 정보 수정 + $paymentEntity = $this->modifyPayment($entity, $entity->getPaymentUID(), $amount); + // 5) 로그 + $this->addLog("{$entity->getCustomTitle()} 서비스 수정", $entity->getStatus()); + // 6) FK 반영 + $this->serviceService->getModel()->modify($entity, [ + 'title' => $entity->getCustomTitle(), + 'serverinfo_id' => $serverEntity->getPK(), + 'payment_uid' => $paymentEntity->getPK(), + ]); + $this->db->transComplete(); + if ($this->db->transStatus() === false) { + throw new RuntimeException('트랜잭션 실패'); + } + return $entity; + } + + public function deleteService(ServiceEntity $entity): ServiceEntity + { + $this->db->transStart(); + // 1) 결제정보 분리 + if ($entity->getPaymentUID()) { + $this->deletePayment($entity->getPaymentUID()); + } + // 2) 연결된 모든 서버 해지 (★ 오타 수정: serviceinfo_uid) + foreach ($this->serverService->getEntities(['serviceinfo_uid' => $entity->getPK()]) as $serverEntity) { + $this->unsetServer($serverEntity->getPK()); // PK가 uid면 OK + } + // 3) 로그 + $this->addLog("[{$entity->getCustomTitle()}] 서비스 해지", $entity->getStatus()); + // 4) 서비스 삭제 + $this->serviceService->delete($entity); $this->db->transComplete(); if ($this->db->transStatus() === false) { throw new RuntimeException('트랜잭션 실패'); diff --git a/app/Services/CommonService.php b/app/Services/CommonService.php index 6df87c2..06a268a 100644 --- a/app/Services/CommonService.php +++ b/app/Services/CommonService.php @@ -24,7 +24,7 @@ abstract class CommonService } abstract public function getFormFields(): array; abstract public function getFormFilters(): array; - final public function getModel(): mixed + final protected function getModel(): mixed { if (!$this->_model instanceof CommonModel) { throw new \Exception(__METHOD__ . "에서 오류발생:Model이 정의되지 않았습니다. "); @@ -140,7 +140,7 @@ abstract class CommonService { return $this->getModel()->getLastQuery(); } - protected function getEntity_process(mixed $entity): mixed + final protected function getEntity_process(mixed $entity): mixed { return $entity; } diff --git a/app/Services/Customer/AccountService.php b/app/Services/Customer/AccountService.php index 60ce02e..729717e 100644 --- a/app/Services/Customer/AccountService.php +++ b/app/Services/Customer/AccountService.php @@ -6,10 +6,9 @@ use App\Entities\Customer\AccountEntity; use App\Entities\Customer\ClientEntity; use App\Entities\PaymentEntity; use App\Helpers\Customer\AccountHelper; -use App\Interfaces\PaymentInterface; use App\Models\Customer\AccountModel; -class AccountService extends CustomerService implements PaymentInterface +class AccountService extends CustomerService { public function __construct() { @@ -53,7 +52,8 @@ class AccountService extends CustomerService implements PaymentInterface } return $this->getClientService()->setAccount($formDatas['status'], $entity, intval($formDatas['amount'])); } - public function setPayment(PaymentEntity $paymentEntity): AccountEntity + //결제관련 예치금 차감 처리용 + public function setPaymentPaid(PaymentEntity $paymentEntity): AccountEntity { $formDatas = [ 'clientinfo_uid' => $paymentEntity->getClientInfoUID(), diff --git a/app/Services/Customer/ServiceService.php b/app/Services/Customer/ServiceService.php index 816f79b..0f962ff 100644 --- a/app/Services/Customer/ServiceService.php +++ b/app/Services/Customer/ServiceService.php @@ -7,10 +7,10 @@ use App\Entities\Equipment\ServerEntity; use App\Entities\PaymentEntity; use App\Helpers\Customer\ServiceHelper; use App\Models\Customer\ServiceModel; -use App\Processors\Customer\ServiceV1Processor as ServiceProcessor; use App\Services\Equipment\ServerService; use App\Services\PaymentService; -use DateTime; +use DateTimeImmutable; +use DateTimeZone; class ServiceService extends CustomerService @@ -103,25 +103,6 @@ class ServiceService extends CustomerService } return $rule; } - protected function getEntity_process(mixed $entity): ServiceEntity - { - if (!$entity instanceof ServiceEntity) { - throw new \Exception(__METHOD__ . "에서 형식오류:ServiceEntity만 허용됩니다."); - } - //서버정보 정의 - $serverEntity = $this->getServerService()->getEntity($entity->getServerInfoUID()); - if ($serverEntity instanceof ServerEntity) { - $entity->setServerEntity($serverEntity); - } - //결제정보 정의 - if ($entity->getPaymentUID()) { - $paymentEntity = $this->getPaymentService()->getEntity($entity->getPaymentUID()); - if ($paymentEntity instanceof PaymentEntity) { - $entity->setPaymentEntity($paymentEntity); - } - } - return $entity; - } final public function getPaymentService(): PaymentService { if (!$this->_paymentService) { @@ -163,7 +144,7 @@ class ServiceService extends CustomerService // ) WHERE uid = ?"; // return $this->getModel()->query($sql, [$entity->getPK()]); // 입력된 날짜를 DateTime 객체로 변환 - $date = new DateTime($entity->getBillingAt()); + $date = new DateTimeImmutable($entity->getBillingAt(), new DateTimeZone('Asia/Tokyo')); // 현재 일(day)을 저장 $day = (int)$date->format('d'); // 다음달로 이동 (DateInterval 사용) @@ -179,11 +160,10 @@ class ServiceService extends CustomerService // 최종 결과 리턴 (YYYY-MM-DD) return $date->format('Y-m-d'); } - //총 서비스금액 설정 + //총서비스금액 계산 + //기본:상면비+회선비+서버금액(price)+서버파트연결(월비용)-할인액 public function getCalculatedAmount(ServiceEntity $entity, ServerEntity $serverEntity): int { - //총서비스금액 계산 - //기본:상면비+회선비+서버금액(price)+서버파트연결(월비용)-할인액 return $entity->getRack() + $entity->getLine() + $this->getServerService()->getCalculatedAmount($serverEntity) - $entity->getSale(); } public function setAmount(int $uid): PaymentEntity @@ -192,9 +172,14 @@ class ServiceService extends CustomerService if (!$entity instanceof ServiceEntity) { throw new \Exception(__METHOD__ . "에서 오류발생: [{$uid}]에 대한 서비스정보를 찾을수 없습니다."); } - parent::modify($entity, ['amount' => $this->getCalculatedAmount($entity, $entity->getServerEntity())]); + $serverEntity = $this->getServerService()->getEntity($entity->getServerInfoUID()); + if (!$serverEntity instanceof ServerEntity) { + throw new \Exception(__METHOD__ . "에서 오류발생: [{$entity->getServerInfoUID()}]에 대한 서버정보를 찾을수 없습니다."); + } + $amount = $this->getCalculatedAmount($entity, $serverEntity); + $entity = parent::modify($entity, ['amount' => $amount]); //결제정보 수정 - return $this->getPaymentService()->modifyService($entity); + return $this->getPaymentService()->updateForService($entity, $entity->getPaymentUID(), $amount); } //기본 기능부분 //FieldForm관련용 @@ -213,55 +198,108 @@ class ServiceService extends CustomerService //생성 public function create(array $formDatas): ServiceEntity { - if (!array_key_exists('serverinfo_uid', $formDatas)) { - throw new \Exception(__METHOD__ . "에서 오류발생: 서버가 지정되지 않았습니다."); + $db = \Config\Database::connect(); + $db->transStart(); + + if (!isset($formDatas['serverinfo_uid'])) { + throw new \Exception('서버가 지정되지 않았습니다.'); } - $processor = new ServiceProcessor( - \Config\Database::connect(), - $this, - $this->getServerService(), - $this->getPaymentservice(), - $this->getMyLogService() - ); - return $processor->create($formDatas); + // 1) 서비스 생성 + $entity = $this->getModel()->create($formDatas); + // 2) 서버 연결 + $serverEntity = $this->getServerService()->attachToService($entity, $entity->getServerInfoUID()); + // 3) 금액 계산 + 반영 + $amount = $this->getCalculatedAmount($entity, $serverEntity); + $this->getModel()->modify($entity, ['amount' => $amount]); + // 4) 결제 생성 + $paymentEntity = $this->getPaymentService()->createForService($entity, $amount); + // 5) 로그 + $this->getMyLogService()->create([ + 'title' => "{$entity->getCustomTitle()} 서비스 추가", + 'status' => $entity->getStatus(), + ]); + // 6) 서비스 FK 동기화 + $entity = $this->getModel()->modify($entity, [ + 'title' => $entity->getCustomTitle(), + 'serverinfo_id' => $serverEntity->getPK(), + 'payment_uid' => $paymentEntity->getPK(), + ]); + + $db->transComplete(); + if ($db->transStatus() === false) { + throw new \Exception('트랜잭션 실패'); + } + return $entity; } //수정 public function modify(mixed $entity, array $formDatas): ServiceEntity { - if (!array_key_exists('serverinfo_uid', $formDatas)) { - throw new \Exception(__METHOD__ . "에서 오류발생: 서버가 지정되지 않았습니다."); + if (!$entity instanceof ServiceEntity) { + $entity = $this->getEntity((int)$entity); } - //기존서버정보 해지 - $this->getServerService()->unsetService($entity, $entity->getServerInfoUID()); - //서비스 정보 수정 - $entity = parent::modify($entity, $formDatas); - //지정된 서버정보에 서비스 설정 - $serverEntity = $this->getServerService()->setService($entity, $entity->getServerInfoUID()); - //서비스 총금액 설정 - $paymentEntity = $this->setAmount($entity->getPK()); - //추가 필수정보 수정용 - $entity = parent::modify($entity, [ - 'serverinfo_id' => $serverEntity->getPK(), - 'payment_uid' => $paymentEntity->getPK() - ]); - //Log정보 등록 - $this->getMylogService()->create([ - 'title' => "[{$entity->getCustomTitle()}] 서비스정보 수정", + $db = \Config\Database::connect(); + $db->transStart(); + if (!isset($formDatas['serverinfo_uid'])) { + throw new \Exception('변경할 서버가 지정되지 않았습니다.'); + } + // 서버 변경이면 기존 서버 해지 + if ($entity->getServerInfoUID() !== null && $entity->getServerInfoUID() !== $formDatas['serverinfo_uid']) { + $this->getServerService()->detachFromService($entity->getServerInfoUID()); + } + // 1) 서비스 정보 수정 + $entity = $this->getModel()->modify($entity, $formDatas); + // 2) 서버 재지정 + $serverEntity = $this->getServerService()->attachToService($entity, $entity->getServerInfoUID()); + // 3) 금액 재계산 + 반영 + $amount = $this->getCalculatedAmount($entity, $serverEntity); + $this->getModel()->modify($entity, ['amount' => $amount]); + // 4) 결제 수정 (표준 메서드) + $billingAt = new DateTimeImmutable($entity->getBillingAt(), new DateTimeZone('Asia/Tokyo')); + $payment = $this->getPaymentService()->updateForService($entity, $entity->getPaymentUID(), $amount); + // 5) 로그 + $this->getMyLogService()->create([ + 'title' => "{$entity->getCustomTitle()} 서비스 수정", 'status' => $entity->getStatus(), ]); + // 6) 서비스 FK 동기화 + $entity = $this->getModel()->modify($entity, [ + 'title' => $entity->getCustomTitle(), + 'serverinfo_id' => $serverEntity->getPK(), + 'payment_uid' => $payment->getPK(), + ]); + $db->transComplete(); + if ($db->transStatus() === false) { + throw new \Exception('트랜잭션 실패'); + } return $entity; } //삭제 public function delete(mixed $entity): ServiceEntity { - //기존서버정보 해지 - $this->getServerService()->unsetService($entity, $entity->getServerInfoUID()); - $entity = parent::delete($entity); - //Log정보 등록 - $this->getMylogService()->create([ - 'title' => "[{$entity->getTitle()}] 서비스 해지", - 'status' => $entity->getStatus() + if (!$entity instanceof ServiceEntity) { + $entity = $this->getEntity((int)$entity); + } + $db = \Config\Database::connect(); + $db->transStart(); + // 1) 결제 분리 + if ($entity->getPaymentUID()) { + $this->getPaymentService()->unlinkFromService($entity->getPaymentUID()); + } + // 2) 연결된 모든 서버 해지 + foreach ($this->getServerService()->getEntities($entity->getPK()) as $serverEntity) { + $this->getServerService()->detachFromService($serverEntity->getPK()); + } + // 3) 로그 + $this->getMyLogService()->create([ + 'title' => "[{$entity->getCustomTitle()}] 서비스 해지", + 'status' => $entity->getStatus(), ]); + // 4) 서비스 삭제 + parent::delete($entity); + $db->transComplete(); + if ($db->transStatus() === false) { + throw new \Exception('트랜잭션 실패'); + } return $entity; } //비고(History)설정 @@ -275,35 +313,38 @@ class ServiceService extends CustomerService if (!array_key_exists('serverinfo_uid', $formDatas)) { throw new \Exception(__METHOD__ . "에서 오류발생:대체서버가 지정되지 않았습니다."); } - $this->getServerService()->setService($entity, $formDatas['serverinfo_uid'], SERVER['TYPES']['ALTERNATIVE']); + $this->getServerService()->attachToService($entity, $formDatas['serverinfo_uid'], [ + 'type' => SERVER['TYPES']['ALTERNATIVE'], + ]); return $entity; } - //대체서버를 메인서버로 설정 public function changeServer(ServiceEntity $entity, array $formDatas): ServiceEntity { if (!array_key_exists('serverinfo_uid', $formDatas)) { throw new \Exception(__METHOD__ . "에서 오류발생:메인서버로 전환할 대체서버가 지정되지 않았습니다."); } - //기존 메인서버정보 가져오기 $serverEntity = $this->getServerService()->getEntity($entity->getServerInfoUID()); if (!$serverEntity instanceof ServerEntity) { throw new \Exception(__METHOD__ . "에서 오류발생: {$entity->getServerInfoUID()}에 대한 서버정보를 찾을수 없습니다."); } - //지정된 대체서버의 Type을 메인서버의 Type으로 전환 - $this->getServerService()->setService($entity, $formDatas['serverinfo_uid'], $serverEntity->getType()); + $this->getServerService()->attachToService( + $entity, + $formDatas['serverinfo_uid'], + ['type' => $serverEntity->getType()] + ); + // 메인 서버 변경에 따른 금액/결제/링크 동기화를 위해 modify 흐름 재사용 return $this->modify($entity, $formDatas); } - //대체서버해지 + public function terminateServer(ServiceEntity $entity, array $formDatas): ServiceEntity { if (!array_key_exists('serverinfo_uid', $formDatas)) { throw new \Exception(__METHOD__ . "에서 오류발생:메인서버로 전환할 대체서버가 지정되지 않았습니다."); } - if ($entity->getServerEntity()->getPK() === $formDatas['serverinfo_uid']) { + if ($entity->getServerInfoUID() === $formDatas['serverinfo_uid']) { throw new \Exception(__METHOD__ . "에서 오류발생: 서비스의 메인 서버정보는 해지할 수 없습니다."); } - //대체서버해지 - $this->getServerService()->unsetService($entity, $formDatas['serverinfo_uid']); + $this->getServerService()->detachFromService($formDatas['serverinfo_uid']); return $entity; } } diff --git a/app/Services/Equipment/ServerPartService.php b/app/Services/Equipment/ServerPartService.php index 500cbbd..7787333 100644 --- a/app/Services/Equipment/ServerPartService.php +++ b/app/Services/Equipment/ServerPartService.php @@ -4,9 +4,7 @@ namespace App\Services\Equipment; use App\Entities\Equipment\ServerEntity; use App\Entities\Equipment\ServerPartEntity; -use App\Entities\PaymentEntity; use App\Helpers\Equipment\ServerPartHelper; -use App\Interfaces\Equipment\ServerInterface; use App\Models\Equipment\ServerPartModel; use App\Services\Customer\ServiceService; use App\Services\Equipment\EquipmentService; @@ -20,7 +18,7 @@ use App\Services\Part\SOFTWAREService; use App\Services\Part\SWITCHService; use App\Services\PaymentService; -class ServerPartService extends EquipmentService implements ServerInterface +class ServerPartService extends EquipmentService { private ?ServiceService $_serviceService = null; private ?ServerService $_serverService = null; @@ -237,23 +235,6 @@ class ServerPartService extends EquipmentService implements ServerInterface //서버정보에 기본 ServerPart를 다시 등록해준다. $this->setServer($serverEntity); } - //partEntity 정보 추가 - protected function getEntity_process(mixed $entity): ServerPartEntity - { - if (!$entity instanceof ServerPartEntity) { - throw new \Exception(__METHOD__ . "에서 형식오류:ServicePartEntity만 허용됩니다."); - } - //각 파트서비스 정의 - $entity->setPartEntity($this->getPartService($entity->getType())->getEntity($entity->getPartUID())); - //결제정보 정의 - if ($entity->getPaymentUID()) { - $paymentEntity = $this->getPaymentService()->getEntity($entity->getPaymentUID()); - if ($paymentEntity instanceof PaymentEntity) { - $entity->setPaymentEntity($paymentEntity); - } - } - return $entity; - } //기본 기능부분 // FieldForm관련용 public function getFormOption(string $field, array $options = []): array diff --git a/app/Services/Equipment/ServerService.php b/app/Services/Equipment/ServerService.php index c2b552d..070ca45 100644 --- a/app/Services/Equipment/ServerService.php +++ b/app/Services/Equipment/ServerService.php @@ -5,6 +5,7 @@ namespace App\Services\Equipment; use App\Entities\Customer\ServiceEntity; use App\Entities\Equipment\ServerEntity; use App\Helpers\Equipment\ServerHelper; +use App\Interfaces\Equipment\ServerInterface; use App\Models\Equipment\ServerModel; use App\Services\Customer\ServiceService; use App\Services\Equipment\EquipmentService; @@ -12,7 +13,7 @@ use App\Services\Equipment\ServerPartService; use App\Services\Part\IPService; use App\Services\Part\SWITCHService; -class ServerService extends EquipmentService +class ServerService extends EquipmentService implements ServerInterface { private ?ServiceService $_serviceService = null; private ?ServerPartService $_serverPartService = null; @@ -104,14 +105,6 @@ class ServerService extends EquipmentService } return $this->_serverPartService; } - //partEntity 정보 추가 - protected function getEntity_process(mixed $entity): ServerEntity - { - if (!$entity instanceof ServerEntity) { - throw new \Exception(__METHOD__ . "에서 형식오류:ServerEntity만 허용됩니다."); - } - return $entity; - } final public function getTotalServiceCount(array $where = []): array { $totalCounts = [ @@ -192,46 +185,31 @@ class ServerService extends EquipmentService } return $caculatedAmount; } - //서비스 생성 - public function setService(ServiceEntity $serviceEntity, int $uid, string $type = ""): ServerEntity + //Service관련 + public function attachToService(ServiceEntity $serviceEntity, string $serverinfo_uid, array $formDatas = []): ServerEntity { - $entity = $this->getEntity($uid); - if (!$entity instanceof ServerEntity) { - throw new \Exception(__METHOD__ . "에서 오류발생: [{$uid}]에 대한 서버정보를 찾을수 없습니다."); + $serverEntity = $this->getEntity($serverinfo_uid); + if (!$serverEntity instanceof ServerEntity) { + throw new \Exception("[{$serverinfo_uid}]에 대한 서버정보를 찾을 수 없습니다."); } - $formDatas = []; $formDatas['clientinfo_uid'] = $serviceEntity->getClientInfoUID(); $formDatas['serviceinfo_uid'] = $serviceEntity->getPK(); - if ($type !== "") { //대체서버 추가 - $formDatas['type'] = $type; - } - $formDatas['status'] = STATUS['OCCUPIED']; - return $this->modify($entity, $formDatas); + $formDatas['status'] = STATUS['OCCUPIED']; + return $this->getModel()->modify($serverEntity, $formDatas); } - //서비스 해지 - public function unsetService(ServiceEntity $serviceEntity, int $uid): void + + public function detachFromService(string $serverinfo_uid): ServerEntity { - //서버정보 가져오기 - $entity = $this->getEntity($uid); - if (!$entity instanceof ServerEntity) { - throw new \Exception(__METHOD__ . "에서 오류발생: [{$uid}]에 대한 서버정보를 찾을수 없습니다."); + $serverEntity = $this->getEntity($serverinfo_uid); + if (!$serverEntity instanceof ServerEntity) { + throw new \Exception("[{$serverinfo_uid}]에 대한 서버정보를 찾을 수 없습니다."); } - $formDatas = []; - $formDatas['clientinfo_uid'] = null; - $formDatas['serviceinfo_uid'] = null; - $formDatas['format_at'] = date("Y-m-d"); - $formDatas['status'] = STATUS['AVAILABLE']; - //Switch정보 해지 - if ($entity->getSwitch() !== null) { //기존 서버정보에 Switch가 정의되어 있으면 - $this->getSwitchService()->unsetServer($entity); - } - //IP정보해지 - if ($entity->getIP() !== null) { //기존 서버정보에 IP가 정의되어 있으면 - $this->getIPService()->unsetServer($entity); - } - //서버파트정보해지 - $this->getServerPartService()->unsetServer($entity); - $this->modify($entity, $formDatas); + return $this->getModel()->modify($serverEntity, [ + 'clientinfo_uid' => null, + 'serviceinfo_uid' => null, + 'format_at' => date("Y-m-d"), + 'status' => STATUS['AVAILABLE'], + ]); } //기본 기능부분 //FieldForm관련용 diff --git a/app/Services/Part/IPService.php b/app/Services/Part/IPService.php index 9c8e406..30176d2 100644 --- a/app/Services/Part/IPService.php +++ b/app/Services/Part/IPService.php @@ -6,14 +6,13 @@ use App\Entities\Equipment\ServerEntity; use App\Entities\Equipment\ServerPartEntity; use App\Entities\Part\IPEntity; use App\Helpers\Part\IPHelper; -use App\Interfaces\Equipment\ServerInterface; use App\Models\Part\IPModel; use App\Services\Customer\ServiceService; use App\Services\Equipment\LineService; use App\Services\Equipment\ServerService; use App\Services\Part\PartService; -class IPService extends PartService implements ServerInterface +class IPService extends PartService { private ?LineService $_lineService = null; private ?ServiceService $_serviceService = null; diff --git a/app/Services/Part/SWITCHService.php b/app/Services/Part/SWITCHService.php index f840454..73df391 100644 --- a/app/Services/Part/SWITCHService.php +++ b/app/Services/Part/SWITCHService.php @@ -6,13 +6,12 @@ use App\Entities\Equipment\ServerEntity; use App\Entities\Equipment\ServerPartEntity; use App\Entities\Part\SWITCHEntity; use App\Helpers\Part\SWITCHHelper; -use App\Interfaces\Equipment\ServerInterface; use App\Models\Part\SWITCHModel; use App\Services\Customer\ServiceService; use App\Services\Equipment\ServerService; use App\Services\Part\PartService; -class SWITCHService extends PartService implements ServerInterface +class SWITCHService extends PartService { private ?ServiceService $_serviceService = null; private ?ServerService $_serverService = null; diff --git a/app/Services/PaymentService.php b/app/Services/PaymentService.php index 9ff639b..892a5f4 100644 --- a/app/Services/PaymentService.php +++ b/app/Services/PaymentService.php @@ -4,16 +4,20 @@ namespace App\Services; use App\Entities\Customer\ClientEntity; use App\Entities\Customer\ServiceEntity; +use App\Entities\Equipment\ServerEntity; use App\Entities\Equipment\ServerPartEntity; use App\Entities\PaymentEntity; use App\Helpers\PaymentHelper; +use App\Interfaces\PaymentInterface; use App\Models\PaymentModel; use App\Services\CommonService; use App\Services\Customer\AccountService; use App\Services\Customer\ServiceService; use App\Services\Equipment\ServerPartService; +use DateTimeImmutable; +use DateTimeZone; -class PaymentService extends CommonService +class PaymentService extends CommonService implements PaymentInterface { private ?ServiceService $_serviceService = null; private ?ServerPartService $_serverPartService = null; @@ -108,57 +112,52 @@ class PaymentService extends CommonService } return $unPaids; } - //서비스 생성(월과금 결제) - public function createService(ServiceEntity $serviceEntity): PaymentEntity + //Service관련(월과금) + //서비스생성 + public function createForService(ServiceEntity $serviceEntity, int $amount): PaymentEntity { - $formDatas = []; - $formDatas['clientinfo_uid'] = $serviceEntity->getClientInfoUID(); - $formDatas['serviceinfo_uid'] = $serviceEntity->getPK(); - $formDatas['serverinfo_uid'] = $serviceEntity->getServerInfoUID(); - $formDatas['title'] = sprintf( - "[%s/%s] %s 서비스비용", - $serviceEntity->getServerEntity()->getCode(), - $serviceEntity->getServerEntity()->getIP(), - date("Y년 n월", strtotime($serviceEntity->getBillingAt())) - ); - $formDatas['amount'] = $serviceEntity->getAmount(); - $formDatas['billing'] = PAYMENT['BILLING']['MONTH']; - $formDatas['billing_at'] = $serviceEntity->getBillingAt(); - return $this->create($formDatas); + $billingAt = new DateTimeImmutable($serviceEntity->getBillingAt(), new DateTimeZone('Asia/Tokyo')); + return $this->getModel()->create([ + 'clientinfo_uid' => $serviceEntity->getClientInfoUID(), + 'serviceinfo_uid' => $serviceEntity->getPK(), + 'serverinfo_uid' => $serviceEntity->getServerInfoUID(), //서버정보 번호 + 'title' => sprintf('[%s] %s 서비스비용', $serviceEntity->getTitle(), $billingAt->format('Y년 n월')), + 'amount' => $amount, + 'billing' => PAYMENT['BILLING']['MONTH'], + 'billing_at' => $billingAt->format('Y-m-d'), + ]); } - //서비스 변경 - public function modifyService(ServiceEntity $serviceEntity): PaymentEntity + //서비스수정 + public function updateForService(ServiceEntity $serviceEntity, string $payment_uid, int $amount): PaymentEntity { - $entity = $this->getEntity($serviceEntity->getPaymentUID()); - if (!$entity instanceof PaymentEntity) { - throw new \Exception(__METHOD__ . "에서 오류발생:결제정보를 찾을수 없습니다."); + $paymentEntity = $this->getEntity($payment_uid); + if (!$paymentEntity instanceof PaymentEntity) { + throw new \Exception("[{$payment_uid}]에 대한 결제정보를 찾을 수 없습니다."); } - $formDatas = []; - $formDatas['clientinfo_uid'] = $serviceEntity->getClientInfoUID(); - $formDatas['serviceinfo_uid'] = $serviceEntity->getPK(); - $formDatas['serverinfo_uid'] = $serviceEntity->getServerInfoUID(); - $formDatas['title'] = sprintf( - "[%s/%s] %s 서비스비용", - $serviceEntity->getServerEntity()->getCode(), - $serviceEntity->getServerEntity()->getIP(), - date("Y년 n월", strtotime($serviceEntity->getBillingAt())) - ); - $formDatas['amount'] = $serviceEntity->getAmount(); - $formDatas['billing'] = PAYMENT['BILLING']['MONTH']; - $formDatas['billing_at'] = $serviceEntity->getBillingAt(); - return $this->modify($entity, $formDatas); + $billingAt = new DateTimeImmutable($serviceEntity->getBillingAt(), new DateTimeZone('Asia/Tokyo')); + return $this->getModel()->modify($paymentEntity, [ + 'clientinfo_uid' => $serviceEntity->getClientInfoUID(), + 'serviceinfo_uid' => $serviceEntity->getPK(), + 'serverinfo_uid' => $serviceEntity->getServerInfoUID(), + 'title' => sprintf('[%s] %s 서비스비용', $serviceEntity->getTitle(), $billingAt->format('Y년 n월')), + 'amount' => $amount, + 'billing' => PAYMENT['BILLING']['MONTH'], + 'billing_at' => $billingAt->format('Y-m-d'), + ]); } - //서비스 해지 - public function deleteService(ServiceEntity $serviceEntity): void + //서비스해지 + public function unlinkFromService(string $payment_uid): PaymentEntity { - if ($serviceEntity->getPaymentUID() !== null) { - $entity = $this->getEntity($serviceEntity->getPaymentUID()); - if (!$entity instanceof PaymentEntity) { - throw new \Exception(__METHOD__ . "에서 오류발생:결제정보를 찾을수 없습니다."); - } - $this->delete($entity); + $paymentEntity = $this->getEntity($payment_uid); + if (!$paymentEntity instanceof PaymentEntity) { + throw new \Exception("[{$payment_uid}]에 대한 결제정보를 찾을 수 없습니다."); } + return $this->getModel()->modify($paymentEntity, [ + 'serviceinfo_uid' => null, + 'serverinfo_uid' => null, + ]); } + //서버파트(일회성과금) final public function createServerPart(ServerPartEntity $serverPartEntity): PaymentEntity { @@ -168,7 +167,7 @@ class PaymentService extends CommonService //서버연결정보 수정시에 필요함 $formDatas['serverinfo_uid'] = $serverPartEntity->getServerInfoUID(); //타이틀은 기타의 경우 직접작성한 제목을 등록하고 아닌경우는 Part의 Title을 사용한다. - $formDatas['title'] = $serverPartEntity->getPartEntity()->getTitle(); + $formDatas['title'] = $serverPartEntity->getTitle(); $formDatas['amount'] = $serverPartEntity->getTotalAmount(); //단가*cnt $formDatas['billing'] = $serverPartEntity->getBilling(); //당일결체일로 설정 @@ -193,7 +192,7 @@ class PaymentService extends CommonService //서버연결정보 수정시에 필요함 $formDatas['serverinfo_uid'] = $serverPartEntity->getServerInfoUID(); //타이틀은 기타의 경우 직접작성한 제목을 등록하고 아닌경우는 Part의 Title을 사용한다. - $formDatas['title'] = $serverPartEntity->getPartEntity()->getTitle(); + $formDatas['title'] = $serverPartEntity->getTitle(); $formDatas['amount'] = $serverPartEntity->getTotalAmount(); //단가*cnt $formDatas['billing'] = $serverPartEntity->getBilling(); return parent::modify($entity, $formDatas); @@ -224,8 +223,12 @@ class PaymentService extends CommonService ]; } if (!array_key_exists($serviceEntity->getPK(), $rows[$clientEntity->getPK()]['services'])) { + $serverEntity = $this->getEntity($serviceEntity->getServerInfoUID()); + if (!$serverEntity instanceof ServerEntity) { + throw new \Exception("[{$serviceEntity->getServerInfoUID()}]에 대한 서버정보를 찾을 수 없습니다."); + } $rows[$clientEntity->getPK()]['services'][$serviceEntity->getPK()] = [ - 'ip' => $serviceEntity->getServerEntity()->getIP(), + 'ip' => $serverEntity->getIP(), 'billing_at' => $serviceEntity->getBillingAt(), 'items' => [], ]; @@ -286,7 +289,7 @@ class PaymentService extends CommonService 'status' => $entity->getStatus() ]); //예치금처리 - $this->getAccountService()->setPayment($entity); + $this->getAccountService()->setPaymentPaid($entity); return $entity; } //결제정보 삭제 diff --git a/app/Views/admin/service/modify_form.php b/app/Views/admin/service/modify_form.php index d0a8d2f..2ae2d93 100644 --- a/app/Views/admin/service/modify_form.php +++ b/app/Views/admin/service/modify_form.php @@ -28,13 +28,13 @@ -
서버정보[getServerEntity()->getCode() ?>]
-
Model : getServerEntity()->getTitle() ?>
-
IP : getServerEntity()->getIP() ?>
-
OS : getServerEntity()->getOS() ?>
+
서버정보[getCode() ?>]
+
Model : getTitle() ?>
+
IP : getIP() ?>
+
OS : getOS() ?>
서버파트정보
$viewDatas['entity']->getServerEntity()->getPK(), + 'serverinfo_uid' => $viewDatas['serverEntity']->getPK(), 'types' => SERVERPART['ALL_PARTTYPES'] ]) ?> diff --git a/app/Views/admin/service/view.php b/app/Views/admin/service/view.php index 8214eef..3d62f39 100644 --- a/app/Views/admin/service/view.php +++ b/app/Views/admin/service/view.php @@ -23,13 +23,13 @@ -
서버정보[getServerEntity()->getCode() ?>]
-
Model : getServerEntity()->getTitle() ?>
-
IP : getServerEntity()->getIP() ?>
-
OS : getServerEntity()->getOS() ?>
+
서버정보[getCode() ?>]
+
Model : getTitle() ?>
+
IP : getIP() ?>
+
OS : getOS() ?>
서버파트정보
$viewDatas['entity']->getServerEntity()->getPK(), + 'serverinfo_uid' => $viewDatas['serverEntity']->getPK(), 'types' => SERVERPART['ALL_PARTTYPES'] ]) ?> diff --git a/app/Views/admin/welcome/new_service.php b/app/Views/admin/welcome/new_service.php index ea6fdac..b003bdd 100644 --- a/app/Views/admin/welcome/new_service.php +++ b/app/Views/admin/welcome/new_service.php @@ -26,7 +26,7 @@ getSite()] ?> getHelper()->getFieldView('clientinfo_uid', $entity->getClientInfoUID(), $viewDatas) ?> $entity->getServerEntity()->getPK(), + 'serverinfo_uid' => $entity->getServerInfoUID(), 'types' => SERVERPART['SERVICE_PARTTYPES'], 'template' => 'partlist_service' ]) ?> diff --git a/app/Views/cells/service/server.php b/app/Views/cells/service/server.php index e2d3fbb..72e9c68 100644 --- a/app/Views/cells/service/server.php +++ b/app/Views/cells/service/server.php @@ -2,9 +2,9 @@ - getServerEntity()->getPK() == $serverEntity->getPK() ? "📌" : "getPK()}?serverinfo_uid={$serverEntity->getPK()}\">✔️" ?> + getServerInfoUID() == $serverEntity->getPK() ? "📌" : "getPK()}?serverinfo_uid={$serverEntity->getPK()}\">✔️" ?> getFieldView('SERVER', "", ['serverEntity' => $serverEntity]) ?> - getServerEntity()->getPK() != $serverEntity->getPK() ? "getPK()}?serverinfo_uid={$serverEntity->getPK()}\">❌" : "" ?> + getServerInfoUID() != $serverEntity->getPK() ? "getPK()}?serverinfo_uid={$serverEntity->getPK()}\">❌" : "" ?> getListButton('CPU', 'CPU', ['serverinfo_uid' => $serverEntity->getPK()]) ?>