From 3b6557d55ce7bb4c25ec65ad636ae948e23124e2 Mon Sep 17 00:00:00 2001 From: "choi.jh" Date: Fri, 3 Oct 2025 17:03:03 +0900 Subject: [PATCH] dbmsv3 init...1 --- app/Services/Equipment/ServerService.php | 13 +++++++++++-- app/Services/Part/IPService.php | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/app/Services/Equipment/ServerService.php b/app/Services/Equipment/ServerService.php index 4116c11..287e140 100644 --- a/app/Services/Equipment/ServerService.php +++ b/app/Services/Equipment/ServerService.php @@ -197,7 +197,12 @@ class ServerService extends EquipmentService implements ServiceInterface } public function create(array $formDatas): ServerEntity { - $entity = parent::create($formDatas); + //서버정보 생성 + try { + $entity = parent::create($formDatas); + } catch (\CodeIgniter\Database\Exceptions\DatabaseException $e) { + throw new \Exception(__METHOD__ . "오류발생: IP중복일 가능성이 있습니다."); + } //서버의 Type별 서버파트정보등록(서버파트연결 자동등록용) $entity = $this->getServerPartService()->setServer('create', $entity, []); if ($entity->getIP() !== null) { //IP가 정의되어 있으면 @@ -211,7 +216,11 @@ class ServerService extends EquipmentService implements ServiceInterface //수정전 정보 $oldEntity = clone $entity; //반드시 clone 할것 //서버정보 수정 - $entity = parent::modify($entity, $formDatas); + try { + $entity = parent::modify($entity, $formDatas); + } catch (\CodeIgniter\Database\Exceptions\DatabaseException $e) { + throw new \Exception(__METHOD__ . "오류발생: IP중복일 가능성이 있습니다."); + } //서비스가 연결되어 있고 대체서버가 아니면, 서비스정보수정(청구액수정) if ($entity->getServiceInfoUID() !== null && $entity->getType() !== "alternative") { $this->getServiceService()->setAmount($this->getServiceService()->getEntity($entity->getServiceInfoUID())); diff --git a/app/Services/Part/IPService.php b/app/Services/Part/IPService.php index b47d57f..e516ec1 100644 --- a/app/Services/Part/IPService.php +++ b/app/Services/Part/IPService.php @@ -155,7 +155,7 @@ class IPService extends PartService implements ServerInterface } break; default: - throw new \Exception("{$action}은 정의되지 않은 작업입니다."); + throw new \Exception(__METHOD__ . ":{$action}에서 오류발생: 정의되지 않은 작업입니다."); // break; } return $serverEntity;