From 490ca2bf55b859f3b94e6ff9d56b0b8d80ad9137 Mon Sep 17 00:00:00 2001 From: "choi.jh" Date: Thu, 2 Oct 2025 14:11:50 +0900 Subject: [PATCH] dbmsv3 init...1 --- .../Admin/Customer/PaymentController.php | 54 ++++++++++--------- 1 file changed, 28 insertions(+), 26 deletions(-) diff --git a/app/Controllers/Admin/Customer/PaymentController.php b/app/Controllers/Admin/Customer/PaymentController.php index 8eed310..5c1b0d6 100644 --- a/app/Controllers/Admin/Customer/PaymentController.php +++ b/app/Controllers/Admin/Customer/PaymentController.php @@ -79,33 +79,35 @@ class PaymentController extends CustomerController if (!$entity instanceof PaymentEntity) { throw new \Exception(__METHOD__ . "에서 {$uid}에 대한 결제정보를 찾을수 없습니다."); } - //entities에 고객 설정 - $clientEntity = $this->getClientService()->getEntity($entity->getClientInfoUID()); - if (!$clientEntity instanceof ClientEntity) { - throw new \Exception(__METHOD__ . "에서 {$entity->getClientInfoUID()}에 대한 고객정보를 찾을수 없습니다."); + if ($entity->getStatus() === STATUS['UNPAID']) { //미지급인경우 + //entities에 고객 설정 + $clientEntity = $this->getClientService()->getEntity($entity->getClientInfoUID()); + if (!$clientEntity instanceof ClientEntity) { + throw new \Exception(__METHOD__ . "에서 {$entity->getClientInfoUID()}에 대한 고객정보를 찾을수 없습니다."); + } + if (!array_key_exists($clientEntity->getPK(), $rows)) { + $rows[$clientEntity->getPK()] = [ + 'name' => $clientEntity->getName(), + 'total_amount' => 0, + 'services' => [], + ]; + } + //entities에 서비스 설정 + $serviceEntity = $this->getService()->getServiceService()->getEntity($entity->getServiceInfoUid()); + if (!$serviceEntity instanceof ServiceEntity) { + throw new \Exception(__METHOD__ . "에서 {$entity->getServiceInfoUid()}에 대한 서비스정보를 찾을수 없습니다."); + } + if (!array_key_exists($serviceEntity->getPK(), $rows[$clientEntity->getPK()]['services'])) { + $rows[$clientEntity->getPK()]['services'][$serviceEntity->getPK()] = [ + 'code' => $serviceEntity->getCode(), + 'billing_at' => $serviceEntity->getBillingAt(), + 'items' => [], + ]; + } + //entities에 총 결제금액 설정 + $rows[$clientEntity->getPK()]['services'][$serviceEntity->getPK()]['items'][] = ['title' => $entity->getTitle(), 'amount' => $entity->getAmount()]; + $rows[$clientEntity->getPK()]['total_amount'] += $entity->getAmount(); } - if (!array_key_exists($clientEntity->getPK(), $rows)) { - $rows[$clientEntity->getPK()] = [ - 'name' => $clientEntity->getName(), - 'total_amount' => 0, - 'services' => [] - ]; - } - //entities에 서비스 설정 - $serviceEntity = $this->getService()->getServiceService()->getEntity($entity->getServiceInfoUid()); - if (!$serviceEntity instanceof ServiceEntity) { - throw new \Exception(__METHOD__ . "에서 {$entity->getServiceInfoUid()}에 대한 서비스정보를 찾을수 없습니다."); - } - if (!array_key_exists($serviceEntity->getPK(), $rows[$clientEntity->getPK()]['services'])) { - $rows[$clientEntity->getPK()]['services'][$serviceEntity->getPK()] = [ - 'code' => $serviceEntity->getCode(), - 'billing_at' => $serviceEntity->getBillingAt(), - 'items' => [] - ]; - } - //entities에 총 결제금액 설정 - $rows[$clientEntity->getPK()]['services'][$serviceEntity->getPK()]['items'][] = ['title' => $entity->getTitle(), 'amount' => $entity->getAmount()]; - $rows[$clientEntity->getPK()]['total_amount'] += $entity->getAmount(); } // dd($rows); $this->rows = $rows;