diff --git a/app/Controllers/Admin/Customer/ServiceController.php b/app/Controllers/Admin/Customer/ServiceController.php index 0e86783..1b31bdf 100644 --- a/app/Controllers/Admin/Customer/ServiceController.php +++ b/app/Controllers/Admin/Customer/ServiceController.php @@ -102,7 +102,7 @@ class ServiceController extends CustomerController throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$uid}에 해당하는 서비스정보을 찾을수 없습니다."); } //대체서버 추가 - service('equipment_serverservice')->attatchToService($entity, $serverinfo_uid); + service('equipment_serverservice')->attatchToService($entity, $serverinfo_uid, ['type' => 'alternative']); // 트랜잭션 완료 및 커밋 $db->transComplete(); return static::class . '->' . __FUNCTION__ . "에서 {$this->getTitle()} 대체서버 추가가 완료되었습니다."; diff --git a/app/Services/Equipment/ServerService.php b/app/Services/Equipment/ServerService.php index a2b5c0d..e7e7564 100644 --- a/app/Services/Equipment/ServerService.php +++ b/app/Services/Equipment/ServerService.php @@ -156,10 +156,6 @@ class ServerService extends EquipmentService if ($oldEntity->getIP()) { service('part_ipservice')->detachFromServer($oldEntity); } - } catch (\Throwable $e) { - log_message('debug', static::class . '->' . __FUNCTION__ . '에서:' . $e->getMessage()); - } - try { if ($entity->getIP()) { service('part_ipservice')->attachToServer($entity); } @@ -276,15 +272,15 @@ class ServerService extends EquipmentService } // 신규 메인서버 - $newServer = $this->getEntity($serviceEntity->getServerInfoUid()); - if (!$newServer instanceof ServerEntity) { + $newServerEntity = $this->getEntity($serviceEntity->getServerInfoUid()); + if (!$newServerEntity instanceof ServerEntity) { throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$serviceEntity->getServerInfoUid()} 신규 메인 서버정보를 찾을수 없습니다."); } // 신규 서버를 서비스에 붙임(occupied 처리 + client/service uid 세팅) // type은 기존 메인서버의 type을 승계 (normal/dedicated/defence 등) - $this->attatchToService($serviceEntity, $newServer->getPK(), [ + $this->attatchToService($serviceEntity, $newServerEntity->getPK(), [ 'type' => $oldServer->getType() ]); @@ -292,5 +288,4 @@ class ServerService extends EquipmentService // 여기서는 기존 동작 유지: alternative로만 바꿈 parent::modify_process($oldServer, ['type' => 'alternative']); } - }