diff --git a/app/Controllers/AbstractCRUDController.php b/app/Controllers/AbstractCRUDController.php index 99cb293..a380e01 100644 --- a/app/Controllers/AbstractCRUDController.php +++ b/app/Controllers/AbstractCRUDController.php @@ -2,6 +2,7 @@ namespace App\Controllers; +use App\Entities\CommonEntity; use CodeIgniter\HTTP\RedirectResponse; use CodeIgniter\Validation\Exceptions\ValidationException; use RuntimeException; @@ -39,7 +40,7 @@ abstract class AbstractCRUDController extends AbstractWebController return $this->action_redirect_process('error', static::class . '->' . __FUNCTION__ . "에서 {$this->getTitle()} 생성폼 오류:" . $e->getMessage()); } } - protected function create_process(array $formDatas): object + protected function create_process(array $formDatas): CommonEntity { // POST 데이터를 DTO 객체로 변환 $dto = $this->service->createDTO($formDatas); @@ -78,7 +79,7 @@ abstract class AbstractCRUDController extends AbstractWebController } // --- 수정 (Modify) --- - protected function modify_form_process($uid): object + protected function modify_form_process($uid): CommonEntity { return $this->service->getEntity($uid); } @@ -105,7 +106,7 @@ abstract class AbstractCRUDController extends AbstractWebController } } - protected function modify_process($uid, array $formDatas): object + protected function modify_process($uid, array $formDatas): CommonEntity { // POST 데이터를 DTO 객체로 변환 $formDatas[$this->service->getPKField()] = $uid; @@ -143,7 +144,7 @@ abstract class AbstractCRUDController extends AbstractWebController } // --- 삭제 (Delete) --- - protected function delete_process($uid): object + protected function delete_process($uid): CommonEntity { return $this->service->delete($uid); } @@ -167,7 +168,7 @@ abstract class AbstractCRUDController extends AbstractWebController } // --- 상세보기 (View) --- - protected function view_process($uid): object + protected function view_process($uid): CommonEntity { return $this->service->getEntity($uid); } diff --git a/app/Database/dbmsv4_init.sql b/app/Database/dbmsv4_init.sql index 6cf6ab9..efe3f87 100644 --- a/app/Database/dbmsv4_init.sql +++ b/app/Database/dbmsv4_init.sql @@ -431,6 +431,7 @@ CREATE TABLE `payment` ( `content` text DEFAULT NULL, `amount` int(11) NOT NULL DEFAULT 0 COMMENT '청구금액', `billing` varchar(20) NOT NULL COMMENT '청구방법(month,onetime)', + `billing_month` int(11) NOT NULL DEFAULT 0, `billing_at` date NOT NULL COMMENT '지급기한일(Onetime 발행당일)', `pay` varchar(20) DEFAULT NULL COMMENT '자뷸방법(ACCOUNT,COUPON)', `status` varchar(20) NOT NULL DEFAULT 'unpaid' COMMENT '상태(PAID,UNPAID)', @@ -452,7 +453,7 @@ CREATE TABLE `payment` ( LOCK TABLES `payment` WRITE; /*!40000 ALTER TABLE `payment` DISABLE KEYS */; -INSERT INTO `payment` VALUES (17,1,820,52,NULL,'[[2548E-M68]13.220.20.6] 2025년 9월 서비스비용',NULL,500000,'month','2025-09-25','account','unpaid','2025-10-29 00:58:09','2025-09-25 06:29:25',NULL),(18,1,1161,53,NULL,'itsolution_s68d4e1b6',NULL,800000,'month','2025-11-14','account','unpaid','2025-10-16 00:58:10','2025-09-25 06:31:18',NULL),(19,1,820,52,NULL,'2G',NULL,40000,'onetime','2025-09-25','account','unpaid','2025-09-25 08:27:17','2025-09-25 08:15:08',NULL),(20,1,1087,54,NULL,'gdidc_s68d4ff1b03fab',NULL,1800000,'month','2025-09-25','account','unpaid','2025-10-16 00:58:28','2025-09-25 08:36:43',NULL),(21,1,820,52,NULL,'16G',NULL,300000,'onetime','2025-09-26','account','unpaid',NULL,'2025-09-26 07:03:50',NULL),(22,1,820,52,NULL,'NVME 512G',NULL,120000,'onetime','2025-09-30','account','paid','2025-10-02 05:07:08','2025-09-30 00:56:19',NULL),(23,1,820,52,NULL,'NVME 512G',NULL,240000,'onetime','2025-09-30','account','paid','2025-10-02 05:07:08','2025-09-30 01:02:43',NULL),(24,1,820,52,NULL,'NVME 1T',NULL,150000,'onetime','2025-09-30','account','unpaid',NULL,'2025-09-30 01:50:08',NULL),(28,1,820,52,NULL,'SSD 256G',NULL,160000,'onetime','2025-09-30','account','unpaid',NULL,'2025-09-30 05:35:30',NULL),(29,1,820,56,NULL,'[[2530Z-M22]HITACH HA3000] 2025년 10월 서비스비용',NULL,1550000,'month','2025-10-01','account','unpaid','2025-10-31 03:36:49','2025-10-01 00:08:02',NULL),(32,1,819,57,NULL,'[[JPN-S23]DESKTOP I5] 2025년 10월 서비스비용',NULL,650000,'month','2025-10-01','account','unpaid','2025-10-31 03:36:20','2025-10-01 08:19:25',NULL),(33,1,820,52,NULL,'NVME 2T',NULL,180000,'onetime','2025-10-02','account','unpaid',NULL,'2025-10-02 00:07:28',NULL),(34,1,711,58,NULL,'prime_s68ddf9a191864',NULL,1100000,'month','2025-10-02','account','unpaid','2025-10-16 01:48:27','2025-10-02 04:03:45',NULL),(35,1,1185,59,NULL,'itsolution_s68e30467',NULL,900000,'month','2025-10-06','account','unpaid','2025-10-16 01:53:30','2025-10-05 23:51:03',NULL),(36,45,1185,59,NULL,'서버비',NULL,600000,'month','2025-11-06',NULL,'paid','2025-10-05 23:54:41','2025-10-05 23:53:43',NULL),(37,45,1185,59,NULL,'서버비',NULL,400000,'month','2025-11-06','account','paid','2025-10-05 23:57:23','2025-10-05 23:56:03',NULL),(38,45,1185,59,NULL,'도메인','도메인 구매',40000,'onetime','2025-10-06','account','paid','2025-10-05 23:57:23','2025-10-05 23:56:59',NULL),(39,45,1185,59,NULL,'서버비',NULL,400000,'month','2025-10-06','account','paid','2025-10-06 00:51:24','2025-10-06 00:48:36',NULL),(40,45,1185,59,NULL,'도메인',NULL,1000000,'onetime','2025-10-06','account','paid','2025-10-06 01:02:46','2025-10-06 00:54:59',NULL),(41,1,1186,60,NULL,'prime_s68e37906ad1bd',NULL,1100000,'month','2025-10-06','account','unpaid','2025-10-16 01:53:52','2025-10-06 08:08:38',NULL),(42,1,1186,61,NULL,'prime_s68e37b9e918a2',NULL,1300000,'month','2025-10-06','account','unpaid','2025-10-16 01:54:10','2025-10-06 08:19:42',NULL),(43,11,1186,60,NULL,'SSD 2T',NULL,600000,'onetime','2025-10-06','account','paid','2025-10-06 08:36:38','2025-10-06 08:25:57',NULL),(44,11,1186,60,NULL,'SSD 1T',NULL,400000,'onetime','2025-10-06','account','paid','2025-10-06 08:36:38','2025-10-06 08:31:15',NULL),(45,11,1186,61,NULL,'8G',NULL,50000,'onetime','2025-10-06','account','paid','2025-10-06 08:38:35','2025-10-06 08:34:46',NULL),(46,1,1186,61,NULL,'test.co.kr 도메인','test.co.kr 도메인',50000,'onetime','2025-10-14','account','unpaid',NULL,'2025-10-14 02:24:26',NULL),(50,1,1161,53,NULL,'itsolution_s68d4e1b6',NULL,800000,'month','2025-10-14','account','unpaid',NULL,'2025-10-14 08:28:35',NULL),(51,1,819,57,NULL,'테스트','테스트\r\n테스트\r\n테스트\r\n테스트',100000,'onetime','2025-10-15','account','unpaid',NULL,'2025-10-15 03:35:39',NULL),(52,1,842,62,NULL,'prime_s68ef4901c563f',NULL,800000,'month','2025-10-15','account','unpaid','2025-10-16 07:52:10','2025-10-15 07:10:57',NULL),(53,1,842,63,NULL,'itsolution_s68ef4cbd',NULL,400000,'month','2025-10-15','account','unpaid','2025-10-16 01:54:36','2025-10-15 07:26:53',NULL),(54,1,820,56,NULL,'fffff','ffdgdfgdf',430000,'onetime','2025-10-15','account','unpaid',NULL,'2025-10-15 07:33:28',NULL),(55,1,1155,64,NULL,'[2543E-M32/13.220.20.25] 2025년 10월 서비스비용',NULL,900000,'month','2025-10-22','account','unpaid','2025-10-21 00:15:04','2025-10-17 06:22:15',NULL),(56,11,1186,60,NULL,'도메인 구매','<p>test.com</p>',40000,'onetime','2025-10-21','account','unpaid',NULL,'2025-10-21 05:19:26',NULL),(57,11,1186,60,NULL,'a.com','<p>도메인 구매</p>',40000,'onetime','2025-10-21','account','paid','2025-10-31 06:01:08','2025-10-21 05:20:08',NULL),(58,1,820,66,NULL,'[2549E-M65/13.220.20.4] 2025년 10월 서비스비용',NULL,1000000,'month','2025-10-22','account','unpaid','2025-10-22 09:50:41','2025-10-22 09:27:56',NULL),(59,1,820,66,NULL,'8G',NULL,80000,'onetime','2025-10-22','account','unpaid',NULL,'2025-10-22 09:45:01',NULL),(60,1,820,71,NULL,'[2548D-M67/13.220.20.15] 2025년 10월 서비스비용',NULL,400000,'month','2025-10-25','account','unpaid',NULL,'2025-10-23 05:01:53',NULL),(61,1,820,74,NULL,'[] 2025년 10월 서비스비용',NULL,1100000,'month','2025-10-23','account','unpaid','2025-10-28 08:01:13','2025-10-23 05:06:15',NULL),(64,1,820,78,NULL,'[[2547C-M26]] 2025년 10월 서비스비용',NULL,1000000,'month','2025-10-24','account','paid','2025-10-28 08:00:15','2025-10-24 01:45:56',NULL),(65,0,1161,79,NULL,'[[KCS-M33]KCS] 2025년 10월 서비스비용',NULL,850000,'month','2025-10-25','account','unpaid','2025-10-28 08:21:20','2025-10-27 02:41:33',NULL),(66,0,1161,79,NULL,'13.220.20.8',NULL,200000,'onetime','2025-10-28','account','unpaid','2025-10-28 08:23:21','2025-10-28 08:22:04',NULL),(67,1,820,78,NULL,'test.co.kr 도메인추가외 5개','<p>test1.co.kr<br>test2.co.kr<br><span style="color: #e03e2d;">test3.co.kr</span><br><span style="color: #e03e2d;">test4.co.kr</span><br>test5.co.k</p>',500000,'onetime','2025-10-29','account','paid',NULL,'2025-10-29 00:08:44',NULL),(68,0,820,80,NULL,'[[2548E-M73]13.220.20.16] 2025년 10월 서비스비용',NULL,1000000,'month','2025-10-30','account','unpaid','2025-10-30 08:14:04','2025-10-30 06:36:44',NULL),(69,1,820,NULL,NULL,'NVME 1T',NULL,150000,'onetime','2025-10-30','account','paid','2025-10-30 08:09:16','2025-10-30 06:56:29',NULL),(86,1,599,81,NULL,'[2549E-M80]23.125.207.5 2025년 12월 서비스비용',NULL,1000000,'month','2025-12-25','account','unpaid',NULL,'2025-12-02 06:28:57',NULL),(87,1,598,109,NULL,'[2548E-M106]23.125.207.6 2025년 12월 서비스비용',NULL,600000,'month','2025-12-26','account','unpaid',NULL,'2025-12-02 09:03:34',NULL),(88,1,598,109,NULL,'test.com 도메인 외 5개',NULL,500000,'onetime','2025-12-05','coupon','unpaid',NULL,'2025-12-04 23:53:44',NULL),(89,1,598,109,NULL,'[2548E-M106]23.125.207.6 2026년 03월 서비스비용',NULL,600000,'month','2026-03-05','account','unpaid',NULL,'2025-12-05 00:01:41',NULL),(90,1,598,109,NULL,'2개월 선결제처리',NULL,1200000,'prepayment','2026-01-25','account','paid',NULL,'2025-12-05 00:15:22',NULL),(91,1,598,109,NULL,'[2548E-M106]23.125.207.6 2026년 01월 서비스비용',NULL,600000,'month','2026-01-26','account','unpaid',NULL,'2025-12-05 00:33:13',NULL),(95,1,598,109,NULL,'[2547D-M107]23.125.207.7 일회성 결제',NULL,1000,'onetime','2025-12-12','account','paid',NULL,'2025-12-12 02:45:14',NULL),(96,1,598,109,NULL,'[2547D-M107]23.125.207.7 일회성 결제',NULL,10000,'onetime','2025-12-12','account','paid',NULL,'2025-12-12 02:45:45',NULL); +INSERT INTO `payment` VALUES (17,1,820,52,NULL,'[[2548E-M68]13.220.20.6] 2025년 9월 서비스비용',NULL,500000,'month',0,'2025-09-25','account','unpaid','2025-10-29 00:58:09','2025-09-25 06:29:25',NULL),(18,1,1161,53,NULL,'itsolution_s68d4e1b6',NULL,800000,'month',0,'2025-11-14','account','unpaid','2025-10-16 00:58:10','2025-09-25 06:31:18',NULL),(19,1,820,52,NULL,'2G',NULL,40000,'onetime',0,'2025-09-25','account','unpaid','2025-09-25 08:27:17','2025-09-25 08:15:08',NULL),(20,1,1087,54,NULL,'gdidc_s68d4ff1b03fab',NULL,1800000,'month',0,'2025-09-25','account','unpaid','2025-10-16 00:58:28','2025-09-25 08:36:43',NULL),(21,1,820,52,NULL,'16G',NULL,300000,'onetime',0,'2025-09-26','account','unpaid',NULL,'2025-09-26 07:03:50',NULL),(22,1,820,52,NULL,'NVME 512G',NULL,120000,'onetime',0,'2025-09-30','account','paid','2025-10-02 05:07:08','2025-09-30 00:56:19',NULL),(23,1,820,52,NULL,'NVME 512G',NULL,240000,'onetime',0,'2025-09-30','account','paid','2025-10-02 05:07:08','2025-09-30 01:02:43',NULL),(24,1,820,52,NULL,'NVME 1T',NULL,150000,'onetime',0,'2025-09-30','account','unpaid',NULL,'2025-09-30 01:50:08',NULL),(28,1,820,52,NULL,'SSD 256G',NULL,160000,'onetime',0,'2025-09-30','account','unpaid',NULL,'2025-09-30 05:35:30',NULL),(29,1,820,56,NULL,'[[2530Z-M22]HITACH HA3000] 2025년 10월 서비스비용',NULL,1550000,'month',0,'2025-10-01','account','unpaid','2025-10-31 03:36:49','2025-10-01 00:08:02',NULL),(32,1,819,57,NULL,'[[JPN-S23]DESKTOP I5] 2025년 10월 서비스비용',NULL,650000,'month',0,'2025-10-01','account','unpaid','2025-10-31 03:36:20','2025-10-01 08:19:25',NULL),(33,1,820,52,NULL,'NVME 2T',NULL,180000,'onetime',0,'2025-10-02','account','unpaid',NULL,'2025-10-02 00:07:28',NULL),(34,1,711,58,NULL,'prime_s68ddf9a191864',NULL,1100000,'month',0,'2025-10-02','account','unpaid','2025-10-16 01:48:27','2025-10-02 04:03:45',NULL),(35,1,1185,59,NULL,'itsolution_s68e30467',NULL,900000,'month',0,'2025-10-06','account','unpaid','2025-10-16 01:53:30','2025-10-05 23:51:03',NULL),(36,45,1185,59,NULL,'서버비',NULL,600000,'month',0,'2025-11-06',NULL,'paid','2025-10-05 23:54:41','2025-10-05 23:53:43',NULL),(37,45,1185,59,NULL,'서버비',NULL,400000,'month',0,'2025-11-06','account','paid','2025-10-05 23:57:23','2025-10-05 23:56:03',NULL),(38,45,1185,59,NULL,'도메인','도메인 구매',40000,'onetime',0,'2025-10-06','account','paid','2025-10-05 23:57:23','2025-10-05 23:56:59',NULL),(39,45,1185,59,NULL,'서버비',NULL,400000,'month',0,'2025-10-06','account','paid','2025-10-06 00:51:24','2025-10-06 00:48:36',NULL),(40,45,1185,59,NULL,'도메인',NULL,1000000,'onetime',0,'2025-10-06','account','paid','2025-10-06 01:02:46','2025-10-06 00:54:59',NULL),(41,1,1186,60,NULL,'prime_s68e37906ad1bd',NULL,1100000,'month',0,'2025-10-06','account','unpaid','2025-10-16 01:53:52','2025-10-06 08:08:38',NULL),(42,1,1186,61,NULL,'prime_s68e37b9e918a2',NULL,1300000,'month',0,'2025-10-06','account','unpaid','2025-10-16 01:54:10','2025-10-06 08:19:42',NULL),(43,11,1186,60,NULL,'SSD 2T',NULL,600000,'onetime',0,'2025-10-06','account','paid','2025-10-06 08:36:38','2025-10-06 08:25:57',NULL),(44,11,1186,60,NULL,'SSD 1T',NULL,400000,'onetime',0,'2025-10-06','account','paid','2025-10-06 08:36:38','2025-10-06 08:31:15',NULL),(45,11,1186,61,NULL,'8G',NULL,50000,'onetime',0,'2025-10-06','account','paid','2025-10-06 08:38:35','2025-10-06 08:34:46',NULL),(46,1,1186,61,NULL,'test.co.kr 도메인','test.co.kr 도메인',50000,'onetime',0,'2025-10-14','account','unpaid',NULL,'2025-10-14 02:24:26',NULL),(50,1,1161,53,NULL,'itsolution_s68d4e1b6',NULL,800000,'month',0,'2025-10-14','account','unpaid',NULL,'2025-10-14 08:28:35',NULL),(51,1,819,57,NULL,'테스트','테스트\r\n테스트\r\n테스트\r\n테스트',100000,'onetime',0,'2025-10-15','account','unpaid',NULL,'2025-10-15 03:35:39',NULL),(52,1,842,62,NULL,'prime_s68ef4901c563f',NULL,800000,'month',0,'2025-10-15','account','unpaid','2025-10-16 07:52:10','2025-10-15 07:10:57',NULL),(53,1,842,63,NULL,'itsolution_s68ef4cbd',NULL,400000,'month',0,'2025-10-15','account','unpaid','2025-10-16 01:54:36','2025-10-15 07:26:53',NULL),(54,1,820,56,NULL,'fffff','ffdgdfgdf',430000,'onetime',0,'2025-10-15','account','unpaid',NULL,'2025-10-15 07:33:28',NULL),(55,1,1155,64,NULL,'[2543E-M32/13.220.20.25] 2025년 10월 서비스비용',NULL,900000,'month',0,'2025-10-22','account','unpaid','2025-10-21 00:15:04','2025-10-17 06:22:15',NULL),(56,11,1186,60,NULL,'도메인 구매','<p>test.com</p>',40000,'onetime',0,'2025-10-21','account','unpaid',NULL,'2025-10-21 05:19:26',NULL),(57,11,1186,60,NULL,'a.com','<p>도메인 구매</p>',40000,'onetime',0,'2025-10-21','account','paid','2025-10-31 06:01:08','2025-10-21 05:20:08',NULL),(58,1,820,66,NULL,'[2549E-M65/13.220.20.4] 2025년 10월 서비스비용',NULL,1000000,'month',0,'2025-10-22','account','unpaid','2025-10-22 09:50:41','2025-10-22 09:27:56',NULL),(59,1,820,66,NULL,'8G',NULL,80000,'onetime',0,'2025-10-22','account','unpaid',NULL,'2025-10-22 09:45:01',NULL),(60,1,820,71,NULL,'[2548D-M67/13.220.20.15] 2025년 10월 서비스비용',NULL,400000,'month',0,'2025-10-25','account','unpaid',NULL,'2025-10-23 05:01:53',NULL),(61,1,820,74,NULL,'[] 2025년 10월 서비스비용',NULL,1100000,'month',0,'2025-10-23','account','unpaid','2025-10-28 08:01:13','2025-10-23 05:06:15',NULL),(64,1,820,78,NULL,'[[2547C-M26]] 2025년 10월 서비스비용',NULL,1000000,'month',0,'2025-10-24','account','paid','2025-10-28 08:00:15','2025-10-24 01:45:56',NULL),(65,0,1161,79,NULL,'[[KCS-M33]KCS] 2025년 10월 서비스비용',NULL,850000,'month',0,'2025-10-25','account','unpaid','2025-10-28 08:21:20','2025-10-27 02:41:33',NULL),(66,0,1161,79,NULL,'13.220.20.8',NULL,200000,'onetime',0,'2025-10-28','account','unpaid','2025-10-28 08:23:21','2025-10-28 08:22:04',NULL),(67,1,820,78,NULL,'test.co.kr 도메인추가외 5개','<p>test1.co.kr<br>test2.co.kr<br><span style="color: #e03e2d;">test3.co.kr</span><br><span style="color: #e03e2d;">test4.co.kr</span><br>test5.co.k</p>',500000,'onetime',0,'2025-10-29','account','paid',NULL,'2025-10-29 00:08:44',NULL),(68,0,820,80,NULL,'[[2548E-M73]13.220.20.16] 2025년 10월 서비스비용',NULL,1000000,'month',0,'2025-10-30','account','unpaid','2025-10-30 08:14:04','2025-10-30 06:36:44',NULL),(69,1,820,NULL,NULL,'NVME 1T',NULL,150000,'onetime',0,'2025-10-30','account','paid','2025-10-30 08:09:16','2025-10-30 06:56:29',NULL),(86,1,599,81,NULL,'[2549E-M80]23.125.207.5 2025년 12월 서비스비용',NULL,1000000,'month',0,'2025-12-25','account','unpaid',NULL,'2025-12-02 06:28:57',NULL),(87,1,598,109,NULL,'[2548E-M106]23.125.207.6 2025년 12월 서비스비용',NULL,600000,'month',0,'2025-12-26','account','unpaid',NULL,'2025-12-02 09:03:34',NULL),(88,1,598,109,NULL,'test.com 도메인 외 5개',NULL,500000,'onetime',0,'2025-12-05','coupon','unpaid',NULL,'2025-12-04 23:53:44',NULL),(89,1,598,109,NULL,'[2548E-M106]23.125.207.6 2026년 03월 서비스비용',NULL,600000,'month',0,'2026-03-05','account','unpaid',NULL,'2025-12-05 00:01:41',NULL),(90,1,598,109,NULL,'2개월 선결제처리',NULL,1200000,'prepayment',2,'2026-01-25','account','paid',NULL,'2025-12-05 00:15:22',NULL),(91,1,598,109,NULL,'[2548E-M106]23.125.207.6 2026년 01월 서비스비용',NULL,600000,'month',0,'2026-01-26','account','unpaid',NULL,'2025-12-05 00:33:13',NULL),(95,1,598,109,NULL,'[2547D-M107]23.125.207.7 일회성 결제',NULL,1000,'onetime',0,'2025-12-12','account','paid',NULL,'2025-12-12 02:45:14',NULL),(96,1,598,109,NULL,'[2547D-M107]23.125.207.7 일회성 결제',NULL,10000,'onetime',0,'2025-12-12','account','paid',NULL,'2025-12-12 02:45:45',NULL); /*!40000 ALTER TABLE `payment` ENABLE KEYS */; UNLOCK TABLES; @@ -774,4 +775,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2025-12-15 16:35:14 +-- Dump completed on 2025-12-16 13:46:13 diff --git a/app/Database/dbmsv4_test1.sql b/app/Database/dbmsv4_test1.sql index 230d05c..64be81b 100644 --- a/app/Database/dbmsv4_test1.sql +++ b/app/Database/dbmsv4_test1.sql @@ -431,6 +431,7 @@ CREATE TABLE `payment` ( `content` text DEFAULT NULL, `amount` int(11) NOT NULL DEFAULT 0 COMMENT '청구금액', `billing` varchar(20) NOT NULL COMMENT '청구방법(month,onetime)', + `billing_month` int(11) NOT NULL DEFAULT 0, `billing_at` date NOT NULL COMMENT '지급기한일(Onetime 발행당일)', `pay` varchar(20) DEFAULT NULL COMMENT '자뷸방법(ACCOUNT,COUPON)', `status` varchar(20) NOT NULL DEFAULT 'unpaid' COMMENT '상태(PAID,UNPAID)', @@ -452,7 +453,7 @@ CREATE TABLE `payment` ( LOCK TABLES `payment` WRITE; /*!40000 ALTER TABLE `payment` DISABLE KEYS */; -INSERT INTO `payment` VALUES (17,1,820,52,NULL,'[[2548E-M68]13.220.20.6] 2025년 9월 서비스비용',NULL,500000,'month','2025-09-25','account','unpaid','2025-10-29 00:58:09','2025-09-25 06:29:25',NULL),(18,1,1161,53,NULL,'itsolution_s68d4e1b6',NULL,800000,'month','2025-11-14','account','unpaid','2025-10-16 00:58:10','2025-09-25 06:31:18',NULL),(19,1,820,52,NULL,'2G',NULL,40000,'onetime','2025-09-25','account','unpaid','2025-09-25 08:27:17','2025-09-25 08:15:08',NULL),(20,1,1087,54,NULL,'gdidc_s68d4ff1b03fab',NULL,1800000,'month','2025-09-25','account','unpaid','2025-10-16 00:58:28','2025-09-25 08:36:43',NULL),(21,1,820,52,NULL,'16G',NULL,300000,'onetime','2025-09-26','account','unpaid',NULL,'2025-09-26 07:03:50',NULL),(22,1,820,52,NULL,'NVME 512G',NULL,120000,'onetime','2025-09-30','account','paid','2025-10-02 05:07:08','2025-09-30 00:56:19',NULL),(23,1,820,52,NULL,'NVME 512G',NULL,240000,'onetime','2025-09-30','account','paid','2025-10-02 05:07:08','2025-09-30 01:02:43',NULL),(24,1,820,52,NULL,'NVME 1T',NULL,150000,'onetime','2025-09-30','account','unpaid',NULL,'2025-09-30 01:50:08',NULL),(28,1,820,52,NULL,'SSD 256G',NULL,160000,'onetime','2025-09-30','account','unpaid',NULL,'2025-09-30 05:35:30',NULL),(29,1,820,56,NULL,'[[2530Z-M22]HITACH HA3000] 2025년 10월 서비스비용',NULL,1550000,'month','2025-10-01','account','unpaid','2025-10-31 03:36:49','2025-10-01 00:08:02',NULL),(32,1,819,57,NULL,'[[JPN-S23]DESKTOP I5] 2025년 10월 서비스비용',NULL,650000,'month','2025-10-01','account','unpaid','2025-10-31 03:36:20','2025-10-01 08:19:25',NULL),(33,1,820,52,NULL,'NVME 2T',NULL,180000,'onetime','2025-10-02','account','unpaid',NULL,'2025-10-02 00:07:28',NULL),(34,1,711,58,NULL,'prime_s68ddf9a191864',NULL,1100000,'month','2025-10-02','account','unpaid','2025-10-16 01:48:27','2025-10-02 04:03:45',NULL),(35,1,1185,59,NULL,'itsolution_s68e30467',NULL,900000,'month','2025-10-06','account','unpaid','2025-10-16 01:53:30','2025-10-05 23:51:03',NULL),(36,45,1185,59,NULL,'서버비',NULL,600000,'month','2025-11-06',NULL,'paid','2025-10-05 23:54:41','2025-10-05 23:53:43',NULL),(37,45,1185,59,NULL,'서버비',NULL,400000,'month','2025-11-06','account','paid','2025-10-05 23:57:23','2025-10-05 23:56:03',NULL),(38,45,1185,59,NULL,'도메인','도메인 구매',40000,'onetime','2025-10-06','account','paid','2025-10-05 23:57:23','2025-10-05 23:56:59',NULL),(39,45,1185,59,NULL,'서버비',NULL,400000,'month','2025-10-06','account','paid','2025-10-06 00:51:24','2025-10-06 00:48:36',NULL),(40,45,1185,59,NULL,'도메인',NULL,1000000,'onetime','2025-10-06','account','paid','2025-10-06 01:02:46','2025-10-06 00:54:59',NULL),(41,1,1186,60,NULL,'prime_s68e37906ad1bd',NULL,1100000,'month','2025-10-06','account','unpaid','2025-10-16 01:53:52','2025-10-06 08:08:38',NULL),(42,1,1186,61,NULL,'prime_s68e37b9e918a2',NULL,1300000,'month','2025-10-06','account','unpaid','2025-10-16 01:54:10','2025-10-06 08:19:42',NULL),(43,11,1186,60,NULL,'SSD 2T',NULL,600000,'onetime','2025-10-06','account','paid','2025-10-06 08:36:38','2025-10-06 08:25:57',NULL),(44,11,1186,60,NULL,'SSD 1T',NULL,400000,'onetime','2025-10-06','account','paid','2025-10-06 08:36:38','2025-10-06 08:31:15',NULL),(45,11,1186,61,NULL,'8G',NULL,50000,'onetime','2025-10-06','account','paid','2025-10-06 08:38:35','2025-10-06 08:34:46',NULL),(46,1,1186,61,NULL,'test.co.kr 도메인','test.co.kr 도메인',50000,'onetime','2025-10-14','account','unpaid',NULL,'2025-10-14 02:24:26',NULL),(50,1,1161,53,NULL,'itsolution_s68d4e1b6',NULL,800000,'month','2025-10-14','account','unpaid',NULL,'2025-10-14 08:28:35',NULL),(51,1,819,57,NULL,'테스트','테스트\r\n테스트\r\n테스트\r\n테스트',100000,'onetime','2025-10-15','account','unpaid',NULL,'2025-10-15 03:35:39',NULL),(52,1,842,62,NULL,'prime_s68ef4901c563f',NULL,800000,'month','2025-10-15','account','unpaid','2025-10-16 07:52:10','2025-10-15 07:10:57',NULL),(53,1,842,63,NULL,'itsolution_s68ef4cbd',NULL,400000,'month','2025-10-15','account','unpaid','2025-10-16 01:54:36','2025-10-15 07:26:53',NULL),(54,1,820,56,NULL,'fffff','ffdgdfgdf',430000,'onetime','2025-10-15','account','unpaid',NULL,'2025-10-15 07:33:28',NULL),(55,1,1155,64,NULL,'[2543E-M32/13.220.20.25] 2025년 10월 서비스비용',NULL,900000,'month','2025-10-22','account','unpaid','2025-10-21 00:15:04','2025-10-17 06:22:15',NULL),(56,11,1186,60,NULL,'도메인 구매','<p>test.com</p>',40000,'onetime','2025-10-21','account','unpaid',NULL,'2025-10-21 05:19:26',NULL),(57,11,1186,60,NULL,'a.com','<p>도메인 구매</p>',40000,'onetime','2025-10-21','account','paid','2025-10-31 06:01:08','2025-10-21 05:20:08',NULL),(58,1,820,66,NULL,'[2549E-M65/13.220.20.4] 2025년 10월 서비스비용',NULL,1000000,'month','2025-10-22','account','unpaid','2025-10-22 09:50:41','2025-10-22 09:27:56',NULL),(59,1,820,66,NULL,'8G',NULL,80000,'onetime','2025-10-22','account','unpaid',NULL,'2025-10-22 09:45:01',NULL),(60,1,820,71,NULL,'[2548D-M67/13.220.20.15] 2025년 10월 서비스비용',NULL,400000,'month','2025-10-25','account','unpaid',NULL,'2025-10-23 05:01:53',NULL),(61,1,820,74,NULL,'[] 2025년 10월 서비스비용',NULL,1100000,'month','2025-10-23','account','unpaid','2025-10-28 08:01:13','2025-10-23 05:06:15',NULL),(64,1,820,78,NULL,'[[2547C-M26]] 2025년 10월 서비스비용',NULL,1000000,'month','2025-10-24','account','paid','2025-10-28 08:00:15','2025-10-24 01:45:56',NULL),(65,0,1161,79,NULL,'[[KCS-M33]KCS] 2025년 10월 서비스비용',NULL,850000,'month','2025-10-25','account','unpaid','2025-10-28 08:21:20','2025-10-27 02:41:33',NULL),(66,0,1161,79,NULL,'13.220.20.8',NULL,200000,'onetime','2025-10-28','account','unpaid','2025-10-28 08:23:21','2025-10-28 08:22:04',NULL),(67,1,820,78,NULL,'test.co.kr 도메인추가외 5개','<p>test1.co.kr<br>test2.co.kr<br><span style="color: #e03e2d;">test3.co.kr</span><br><span style="color: #e03e2d;">test4.co.kr</span><br>test5.co.k</p>',500000,'onetime','2025-10-29','account','paid',NULL,'2025-10-29 00:08:44',NULL),(68,0,820,80,NULL,'[[2548E-M73]13.220.20.16] 2025년 10월 서비스비용',NULL,1000000,'month','2025-10-30','account','unpaid','2025-10-30 08:14:04','2025-10-30 06:36:44',NULL),(69,1,820,NULL,NULL,'NVME 1T',NULL,150000,'onetime','2025-10-30','account','paid','2025-10-30 08:09:16','2025-10-30 06:56:29',NULL),(86,1,599,81,NULL,'[2549E-M80]23.125.207.5 2025년 12월 서비스비용',NULL,1000000,'month','2025-12-25','account','unpaid',NULL,'2025-12-02 06:28:57',NULL),(87,1,598,109,NULL,'[2548E-M106]23.125.207.6 2025년 12월 서비스비용',NULL,600000,'month','2025-12-26','account','unpaid',NULL,'2025-12-02 09:03:34',NULL),(88,1,598,109,NULL,'test.com 도메인 외 5개',NULL,500000,'onetime','2025-12-05','coupon','unpaid',NULL,'2025-12-04 23:53:44',NULL),(89,1,598,109,NULL,'[2548E-M106]23.125.207.6 2026년 03월 서비스비용',NULL,600000,'month','2026-03-05','account','unpaid',NULL,'2025-12-05 00:01:41',NULL),(90,1,598,109,NULL,'2개월 선결제처리',NULL,1200000,'prepayment','2026-01-25','account','paid',NULL,'2025-12-05 00:15:22',NULL),(91,1,598,109,NULL,'[2548E-M106]23.125.207.6 2026년 01월 서비스비용',NULL,600000,'month','2026-01-26','account','unpaid',NULL,'2025-12-05 00:33:13',NULL),(95,1,598,109,NULL,'[2547D-M107]23.125.207.7 일회성 결제',NULL,1000,'onetime','2025-12-12','account','paid',NULL,'2025-12-12 02:45:14',NULL),(96,1,598,109,NULL,'[2547D-M107]23.125.207.7 일회성 결제',NULL,10000,'onetime','2025-12-12','account','paid',NULL,'2025-12-12 02:45:45',NULL); +INSERT INTO `payment` VALUES (17,1,820,52,NULL,'[[2548E-M68]13.220.20.6] 2025년 9월 서비스비용',NULL,500000,'month',0,'2025-09-25','account','unpaid','2025-10-29 00:58:09','2025-09-25 06:29:25',NULL),(18,1,1161,53,NULL,'itsolution_s68d4e1b6',NULL,800000,'month',0,'2025-11-14','account','unpaid','2025-10-16 00:58:10','2025-09-25 06:31:18',NULL),(19,1,820,52,NULL,'2G',NULL,40000,'onetime',0,'2025-09-25','account','unpaid','2025-09-25 08:27:17','2025-09-25 08:15:08',NULL),(20,1,1087,54,NULL,'gdidc_s68d4ff1b03fab',NULL,1800000,'month',0,'2025-09-25','account','unpaid','2025-10-16 00:58:28','2025-09-25 08:36:43',NULL),(21,1,820,52,NULL,'16G',NULL,300000,'onetime',0,'2025-09-26','account','unpaid',NULL,'2025-09-26 07:03:50',NULL),(22,1,820,52,NULL,'NVME 512G',NULL,120000,'onetime',0,'2025-09-30','account','paid','2025-10-02 05:07:08','2025-09-30 00:56:19',NULL),(23,1,820,52,NULL,'NVME 512G',NULL,240000,'onetime',0,'2025-09-30','account','paid','2025-10-02 05:07:08','2025-09-30 01:02:43',NULL),(24,1,820,52,NULL,'NVME 1T',NULL,150000,'onetime',0,'2025-09-30','account','unpaid',NULL,'2025-09-30 01:50:08',NULL),(28,1,820,52,NULL,'SSD 256G',NULL,160000,'onetime',0,'2025-09-30','account','unpaid',NULL,'2025-09-30 05:35:30',NULL),(29,1,820,56,NULL,'[[2530Z-M22]HITACH HA3000] 2025년 10월 서비스비용',NULL,1550000,'month',0,'2025-10-01','account','unpaid','2025-10-31 03:36:49','2025-10-01 00:08:02',NULL),(32,1,819,57,NULL,'[[JPN-S23]DESKTOP I5] 2025년 10월 서비스비용',NULL,650000,'month',0,'2025-10-01','account','unpaid','2025-10-31 03:36:20','2025-10-01 08:19:25',NULL),(33,1,820,52,NULL,'NVME 2T',NULL,180000,'onetime',0,'2025-10-02','account','unpaid',NULL,'2025-10-02 00:07:28',NULL),(34,1,711,58,NULL,'prime_s68ddf9a191864',NULL,1100000,'month',0,'2025-10-02','account','unpaid','2025-10-16 01:48:27','2025-10-02 04:03:45',NULL),(35,1,1185,59,NULL,'itsolution_s68e30467',NULL,900000,'month',0,'2025-10-06','account','unpaid','2025-10-16 01:53:30','2025-10-05 23:51:03',NULL),(36,45,1185,59,NULL,'서버비',NULL,600000,'month',0,'2025-11-06',NULL,'paid','2025-10-05 23:54:41','2025-10-05 23:53:43',NULL),(37,45,1185,59,NULL,'서버비',NULL,400000,'month',0,'2025-11-06','account','paid','2025-10-05 23:57:23','2025-10-05 23:56:03',NULL),(38,45,1185,59,NULL,'도메인','도메인 구매',40000,'onetime',0,'2025-10-06','account','paid','2025-10-05 23:57:23','2025-10-05 23:56:59',NULL),(39,45,1185,59,NULL,'서버비',NULL,400000,'month',0,'2025-10-06','account','paid','2025-10-06 00:51:24','2025-10-06 00:48:36',NULL),(40,45,1185,59,NULL,'도메인',NULL,1000000,'onetime',0,'2025-10-06','account','paid','2025-10-06 01:02:46','2025-10-06 00:54:59',NULL),(41,1,1186,60,NULL,'prime_s68e37906ad1bd',NULL,1100000,'month',0,'2025-10-06','account','unpaid','2025-10-16 01:53:52','2025-10-06 08:08:38',NULL),(42,1,1186,61,NULL,'prime_s68e37b9e918a2',NULL,1300000,'month',0,'2025-10-06','account','unpaid','2025-10-16 01:54:10','2025-10-06 08:19:42',NULL),(43,11,1186,60,NULL,'SSD 2T',NULL,600000,'onetime',0,'2025-10-06','account','paid','2025-10-06 08:36:38','2025-10-06 08:25:57',NULL),(44,11,1186,60,NULL,'SSD 1T',NULL,400000,'onetime',0,'2025-10-06','account','paid','2025-10-06 08:36:38','2025-10-06 08:31:15',NULL),(45,11,1186,61,NULL,'8G',NULL,50000,'onetime',0,'2025-10-06','account','paid','2025-10-06 08:38:35','2025-10-06 08:34:46',NULL),(46,1,1186,61,NULL,'test.co.kr 도메인','test.co.kr 도메인',50000,'onetime',0,'2025-10-14','account','unpaid',NULL,'2025-10-14 02:24:26',NULL),(50,1,1161,53,NULL,'itsolution_s68d4e1b6',NULL,800000,'month',0,'2025-10-14','account','unpaid',NULL,'2025-10-14 08:28:35',NULL),(51,1,819,57,NULL,'테스트','테스트\r\n테스트\r\n테스트\r\n테스트',100000,'onetime',0,'2025-10-15','account','unpaid',NULL,'2025-10-15 03:35:39',NULL),(52,1,842,62,NULL,'prime_s68ef4901c563f',NULL,800000,'month',0,'2025-10-15','account','unpaid','2025-10-16 07:52:10','2025-10-15 07:10:57',NULL),(53,1,842,63,NULL,'itsolution_s68ef4cbd',NULL,400000,'month',0,'2025-10-15','account','unpaid','2025-10-16 01:54:36','2025-10-15 07:26:53',NULL),(54,1,820,56,NULL,'fffff','ffdgdfgdf',430000,'onetime',0,'2025-10-15','account','unpaid',NULL,'2025-10-15 07:33:28',NULL),(55,1,1155,64,NULL,'[2543E-M32/13.220.20.25] 2025년 10월 서비스비용',NULL,900000,'month',0,'2025-10-22','account','unpaid','2025-10-21 00:15:04','2025-10-17 06:22:15',NULL),(56,11,1186,60,NULL,'도메인 구매','<p>test.com</p>',40000,'onetime',0,'2025-10-21','account','unpaid',NULL,'2025-10-21 05:19:26',NULL),(57,11,1186,60,NULL,'a.com','<p>도메인 구매</p>',40000,'onetime',0,'2025-10-21','account','paid','2025-10-31 06:01:08','2025-10-21 05:20:08',NULL),(58,1,820,66,NULL,'[2549E-M65/13.220.20.4] 2025년 10월 서비스비용',NULL,1000000,'month',0,'2025-10-22','account','unpaid','2025-10-22 09:50:41','2025-10-22 09:27:56',NULL),(59,1,820,66,NULL,'8G',NULL,80000,'onetime',0,'2025-10-22','account','unpaid',NULL,'2025-10-22 09:45:01',NULL),(60,1,820,71,NULL,'[2548D-M67/13.220.20.15] 2025년 10월 서비스비용',NULL,400000,'month',0,'2025-10-25','account','unpaid',NULL,'2025-10-23 05:01:53',NULL),(61,1,820,74,NULL,'[] 2025년 10월 서비스비용',NULL,1100000,'month',0,'2025-10-23','account','unpaid','2025-10-28 08:01:13','2025-10-23 05:06:15',NULL),(64,1,820,78,NULL,'[[2547C-M26]] 2025년 10월 서비스비용',NULL,1000000,'month',0,'2025-10-24','account','paid','2025-10-28 08:00:15','2025-10-24 01:45:56',NULL),(65,0,1161,79,NULL,'[[KCS-M33]KCS] 2025년 10월 서비스비용',NULL,850000,'month',0,'2025-10-25','account','unpaid','2025-10-28 08:21:20','2025-10-27 02:41:33',NULL),(66,0,1161,79,NULL,'13.220.20.8',NULL,200000,'onetime',0,'2025-10-28','account','unpaid','2025-10-28 08:23:21','2025-10-28 08:22:04',NULL),(67,1,820,78,NULL,'test.co.kr 도메인추가외 5개','<p>test1.co.kr<br>test2.co.kr<br><span style="color: #e03e2d;">test3.co.kr</span><br><span style="color: #e03e2d;">test4.co.kr</span><br>test5.co.k</p>',500000,'onetime',0,'2025-10-29','account','paid',NULL,'2025-10-29 00:08:44',NULL),(68,0,820,80,NULL,'[[2548E-M73]13.220.20.16] 2025년 10월 서비스비용',NULL,1000000,'month',0,'2025-10-30','account','unpaid','2025-10-30 08:14:04','2025-10-30 06:36:44',NULL),(69,1,820,NULL,NULL,'NVME 1T',NULL,150000,'onetime',0,'2025-10-30','account','paid','2025-10-30 08:09:16','2025-10-30 06:56:29',NULL),(86,1,599,81,NULL,'[2549E-M80]23.125.207.5 2025년 12월 서비스비용',NULL,1000000,'month',0,'2025-12-25','account','unpaid',NULL,'2025-12-02 06:28:57',NULL),(87,1,598,109,NULL,'[2548E-M106]23.125.207.6 2025년 12월 서비스비용',NULL,600000,'month',0,'2025-12-26','account','unpaid',NULL,'2025-12-02 09:03:34',NULL),(88,1,598,109,NULL,'test.com 도메인 외 5개',NULL,500000,'onetime',0,'2025-12-05','coupon','unpaid',NULL,'2025-12-04 23:53:44',NULL),(89,1,598,109,NULL,'[2548E-M106]23.125.207.6 2026년 03월 서비스비용',NULL,600000,'month',0,'2026-03-05','account','unpaid',NULL,'2025-12-05 00:01:41',NULL),(90,1,598,109,NULL,'2개월 선결제처리',NULL,1200000,'prepayment',2,'2026-01-25','account','paid',NULL,'2025-12-05 00:15:22',NULL),(91,1,598,109,NULL,'[2548E-M106]23.125.207.6 2026년 01월 서비스비용',NULL,600000,'month',0,'2026-01-26','account','unpaid',NULL,'2025-12-05 00:33:13',NULL),(95,1,598,109,NULL,'[2547D-M107]23.125.207.7 일회성 결제',NULL,1000,'onetime',0,'2025-12-12','account','paid',NULL,'2025-12-12 02:45:14',NULL),(96,1,598,109,NULL,'[2547D-M107]23.125.207.7 일회성 결제',NULL,10000,'onetime',0,'2025-12-12','account','paid',NULL,'2025-12-12 02:45:45',NULL); /*!40000 ALTER TABLE `payment` ENABLE KEYS */; UNLOCK TABLES; @@ -774,4 +775,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2025-12-16 11:23:58 +-- Dump completed on 2025-12-16 13:46:04 diff --git a/app/Entities/Customer/ClientEntity.php b/app/Entities/Customer/ClientEntity.php index 5715b3e..49c2aaa 100644 --- a/app/Entities/Customer/ClientEntity.php +++ b/app/Entities/Customer/ClientEntity.php @@ -79,19 +79,23 @@ class ClientEntity extends CustomerEntity public function setRole(mixed $role) { $roleArray = []; + // 입력된 데이터가 문자열인 경우에만 trim 및 explode 처리 if (is_string($role)) { - // 1. 양쪽의 불필요한 따옴표와 공백을 제거하여 깨끗한 문자열 확보 + // trim()은 여기서 안전하게 호출됩니다. $cleanRoleString = trim($role, " \t\n\r\0\x0B\""); if (!empty($cleanRoleString)) { - $role = explode(DEFAULTS["DELIMITER_ROLE"], $cleanRoleString); + // 문자열을 구분자로 분리하여 배열로 만듭니다. + $roleArray = explode(DEFAULTS["DELIMITER_ROLE"], $cleanRoleString); } } - if (is_array($role)) { - //배열에도 불필요한 따옴표와 공백을 제거 - $cleanedRoles = array_map(fn($item) => trim($item, " \t\n\r\0\x0B\""), $role); - $roleArray = array_filter($cleanedRoles); + // 입력된 데이터가 이미 배열인 경우 (modify_process에서 $formDatas가 배열로 넘어옴) + elseif (is_array($role)) { + $roleArray = $role; } - // 💡 핵심: 최종적으로 DB에 삽입될 단일 CSV 문자열로 변환하여 저장합니다. + // 배열의 각 요소를 정리 + $cleanedRoles = array_map(fn($item) => trim($item, " \t\n\r\0\x0B\""), $roleArray); + $roleArray = array_filter($cleanedRoles); + // 최종적으로 DB에 삽입될 단일 CSV 문자열로 변환하여 저장합니다. $this->attributes['role'] = implode(DEFAULTS["DELIMITER_ROLE"], $roleArray); } } diff --git a/app/Entities/UserEntity.php b/app/Entities/UserEntity.php index 347801b..4c76b17 100644 --- a/app/Entities/UserEntity.php +++ b/app/Entities/UserEntity.php @@ -54,10 +54,12 @@ class UserEntity extends CommonEntity } // --- Setter Methods --- - public function setPasswd(string $password) + public function setPasswd(string|null $password = null) { - // 비밀번호를 암호화하여 저장합니다. - $this->attributes['passwd'] = password_hash($password, PASSWORD_BCRYPT); + // 입력된 비밀번호가 null이 아니고 비어있지 않을 때만 해시 처리 + if (!empty($password)) { + $this->attributes['passwd'] = password_hash($password, PASSWORD_BCRYPT); + } } /** @@ -68,19 +70,23 @@ class UserEntity extends CommonEntity public function setRole(mixed $role) { $roleArray = []; + // 입력된 데이터가 문자열인 경우에만 trim 및 explode 처리 if (is_string($role)) { - // 1. 양쪽의 불필요한 따옴표와 공백을 제거하여 깨끗한 문자열 확보 + // trim()은 여기서 안전하게 호출됩니다. $cleanRoleString = trim($role, " \t\n\r\0\x0B\""); if (!empty($cleanRoleString)) { - $role = explode(DEFAULTS["DELIMITER_ROLE"], $cleanRoleString); + // 문자열을 구분자로 분리하여 배열로 만듭니다. + $roleArray = explode(DEFAULTS["DELIMITER_ROLE"], $cleanRoleString); } } - if (is_array($role)) { - //배열에도 불필요한 따옴표와 공백을 제거 - $cleanedRoles = array_map(fn($item) => trim($item, " \t\n\r\0\x0B\""), $role); - $roleArray = array_filter($cleanedRoles); + // 입력된 데이터가 이미 배열인 경우 (modify_process에서 $formDatas가 배열로 넘어옴) + elseif (is_array($role)) { + $roleArray = $role; } - // 💡 핵심: 최종적으로 DB에 삽입될 단일 CSV 문자열로 변환하여 저장합니다. + // 배열의 각 요소를 정리 + $cleanedRoles = array_map(fn($item) => trim($item, " \t\n\r\0\x0B\""), $roleArray); + $roleArray = array_filter($cleanedRoles); + // 최종적으로 DB에 삽입될 단일 CSV 문자열로 변환하여 저장합니다. $this->attributes['role'] = implode(DEFAULTS["DELIMITER_ROLE"], $roleArray); } } diff --git a/app/Services/CommonService.php b/app/Services/CommonService.php index 7a60019..05c78d2 100644 --- a/app/Services/CommonService.php +++ b/app/Services/CommonService.php @@ -59,7 +59,7 @@ abstract class CommonService * 단일 엔티티를 조회합니다. */ abstract protected function getEntity_process(CommonEntity $entity): CommonEntity; - final public function getEntity(string|int|array $where, ?string $message = null): ?object + final public function getEntity(string|int|array $where, ?string $message = null): ?CommonEntity { try { $entity = is_array($where) ? $this->model->where($where)->first() : $this->model->find($where); @@ -161,7 +161,7 @@ abstract class CommonService return $pk; } - protected function save_process(CommonEntity $entity): object + protected function save_process(CommonEntity $entity): CommonEntity { // INSERT 시 Entity의 PK는 0 또는 NULL이어야 함 (DB가 ID를 생성하도록) $initialPK = $entity->getPK(); @@ -175,7 +175,7 @@ abstract class CommonService } //생성용 - protected function create_process(array $formDatas): object + protected function create_process(array $formDatas): CommonEntity { // 데이터 검증 $this->getFormService()->validate($formDatas); @@ -187,7 +187,7 @@ abstract class CommonService } return $this->save_process($entity); } - final public function create(array $formDatas): object + final public function create(array $formDatas): CommonEntity { $db = \Config\Database::connect(); try { @@ -213,25 +213,18 @@ abstract class CommonService } //수정용 - protected function modify_process($entity, array $formDatas): object + protected function modify_process($entity, array $formDatas): CommonEntity { - foreach ($this->model->getAllowedFields() as $key) { - $formDatas[$key] = $formDatas[$key] ?? $entity->$key; - } - $fields = array_keys($formDatas); - $this->getFormService()->setFormFields($fields); - $this->getFormService()->setFormRules('modify', $fields); // 데이터 검증 - // var_dump($this->getFormService()->getFormRules()); - // dd($formDatas); $this->getFormService()->validate($formDatas); - foreach ($formDatas as $key => $value) { - $entity->$key = $value; - } + // 2. 폼 데이터를 엔티티에 병합합니다. (fill() 사용) + $entity->fill($formDatas); + // var_dump($formDatas); + // dd($entity); return $this->save_process($entity); } - final public function modify(string|int $uid, array $formDatas): object + final public function modify(string|int $uid, array $formDatas): CommonEntity { $db = \Config\Database::connect(); try { @@ -240,11 +233,6 @@ abstract class CommonService if (!$entity) { throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$uid}에 해당하는 정보을 찾을수 없습니다."); } - // 💡 동적으로 가져온 Entity 클래스 이름으로 instanceof 검사 - $entityClass = $this->getEntityClass(); - if (!$entity instanceof $entityClass) { - throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생:Return Type은 {$entityClass}만 가능"); - } //관리자 정보추가용 $formDatas['user_uid'] = $this->getAuthContext()->getUID(); $entity = $this->modify_process($entity, $formDatas); @@ -266,7 +254,7 @@ abstract class CommonService } //배치 작업용 수정 - protected function batchjob_process($entity, array $formDatas): object + protected function batchjob_process($entity, array $formDatas): CommonEntity { $entity = $this->modify_process($entity, $formDatas); return $entity; @@ -290,7 +278,7 @@ abstract class CommonService } //관리자 정보추가용 $formDatas['user_uid'] = $this->getAuthContext()->getUID(); - $entities[] = $this->modify_process($entity, $formDatas); + $entities[] = $this->batchjob_process($entity, $formDatas); } return $entities; } catch (\Throwable $e) { @@ -300,7 +288,7 @@ abstract class CommonService } //삭제용 (일반) - protected function delete_process($entity): object + protected function delete_process($entity): CommonEntity { $result = $this->model->delete($entity->getPK()); log_message('debug', $this->model->getLastQuery()); @@ -311,7 +299,7 @@ abstract class CommonService } return $entity; } - final public function delete(string|int $uid): object + final public function delete(string|int $uid): CommonEntity { $db = \Config\Database::connect(); try { @@ -347,7 +335,7 @@ abstract class CommonService } //삭제용 (배치 작업) - protected function batchjob_delete_process($entity): object + protected function batchjob_delete_process($entity): CommonEntity { $entity = $this->delete_process($entity); return $entity; diff --git a/app/Services/Customer/ClientService.php b/app/Services/Customer/ClientService.php index 85d782f..453a0d4 100644 --- a/app/Services/Customer/ClientService.php +++ b/app/Services/Customer/ClientService.php @@ -115,14 +115,6 @@ class ClientService extends CustomerService { return $entity; } - protected function create_process(array $formDatas): ClientEntity - { - return parent::create_process($formDatas); - } - protected function modify_process($entity, array $formDatas): ClientEntity - { - return parent::modify_process($entity, $formDatas); - } //List 검색용 //FormFilter 조건절 처리 //검색어조건절처리 diff --git a/app/Services/Customer/Wallet/AccountService.php b/app/Services/Customer/Wallet/AccountService.php index 7fc3dff..1307329 100644 --- a/app/Services/Customer/Wallet/AccountService.php +++ b/app/Services/Customer/Wallet/AccountService.php @@ -3,6 +3,7 @@ namespace App\Services\Customer\Wallet; use App\DTOs\Customer\Wallet\AccountDTO; +use App\Entities\CommonEntity; use App\Entities\Customer\ClientEntity; use App\Entities\Customer\Wallet\AccountEntity; use App\Forms\Customer\Wallet\AccountForm; @@ -118,12 +119,7 @@ class AccountService extends WalletService { return $entity; } - protected function create_process(array $formDatas): AccountEntity - { - $entity = parent::create_process($formDatas); - return $entity; - } - protected function modify_process($entity, array $formDatas): AccountEntity + protected function modify_process($entity, array $formDatas): CommonEntity { throw new RuntimeException("예치금정보는 수정이 불가합니다."); } diff --git a/app/Services/Customer/Wallet/CouponService.php b/app/Services/Customer/Wallet/CouponService.php index 72b0b95..122a7b4 100644 --- a/app/Services/Customer/Wallet/CouponService.php +++ b/app/Services/Customer/Wallet/CouponService.php @@ -3,6 +3,7 @@ namespace App\Services\Customer\Wallet; use App\DTOs\Customer\Wallet\CouponDTO; +use App\Entities\CommonEntity; use App\Entities\Customer\ClientEntity; use App\Entities\Customer\Wallet\CouponEntity; use App\Forms\Customer\Wallet\CouponForm; @@ -109,12 +110,7 @@ class CouponService extends WalletService { return $entity; } - protected function create_process(array $formDatas): CouponEntity - { - $entity = parent::create_process($formDatas); - return $entity; - } - protected function modify_process($entity, array $formDatas): CouponEntity + protected function modify_process($entity, array $formDatas): CommonEntity { throw new RuntimeException("쿠폰정보는 수정이 불가합니다."); } diff --git a/app/Services/Customer/Wallet/PointService.php b/app/Services/Customer/Wallet/PointService.php index b316434..908de8d 100644 --- a/app/Services/Customer/Wallet/PointService.php +++ b/app/Services/Customer/Wallet/PointService.php @@ -3,6 +3,7 @@ namespace App\Services\Customer\Wallet; use App\DTOs\Customer\Wallet\PointDTO; +use App\Entities\CommonEntity; use App\Entities\Customer\ClientEntity; use App\Entities\Customer\Wallet\PointEntity; use App\Forms\Customer\Wallet\PointForm; @@ -109,12 +110,7 @@ class PointService extends WalletService { return $entity; } - protected function create_process(array $formDatas): PointEntity - { - $entity = parent::create_process($formDatas); - return $entity; - } - protected function modify_process($entity, array $formDatas): PointEntity + protected function modify_process($entity, array $formDatas): CommonEntity { throw new RuntimeException("포인트정보는 수정이 불가합니다."); } diff --git a/app/Services/Customer/Wallet/WalletService.php b/app/Services/Customer/Wallet/WalletService.php index 759c120..3e620c7 100644 --- a/app/Services/Customer/Wallet/WalletService.php +++ b/app/Services/Customer/Wallet/WalletService.php @@ -2,6 +2,7 @@ namespace App\Services\Customer\Wallet; +use App\Entities\CommonEntity; use App\Entities\Customer\ClientEntity; use App\Entities\PaymentEntity; use App\Models\CommonModel; @@ -17,7 +18,7 @@ abstract class WalletService extends CustomerService } //기본기능 //생성 - protected function create_process(array $formDatas): object + protected function create_process(array $formDatas): CommonEntity { if (!array_key_exists('clientinfo_uid', $formDatas)) { throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: 고객정보가 정의되지 않았습니다."); diff --git a/app/Services/Equipment/CHASSISService.php b/app/Services/Equipment/CHASSISService.php index 617c354..9c6d110 100644 --- a/app/Services/Equipment/CHASSISService.php +++ b/app/Services/Equipment/CHASSISService.php @@ -3,6 +3,7 @@ namespace App\Services\Equipment; use App\DTOs\Equipment\CHASSISDTO; +use App\Entities\CommonEntity; use App\Entities\Equipment\CHASSISEntity; use App\Entities\Equipment\ServerEntity; use App\Forms\Equipment\CHASSISForm; @@ -98,14 +99,6 @@ class CHASSISService extends EquipmentService { return $entity; } - protected function create_process(array $formDatas): CHASSISEntity - { - return parent::create_process($formDatas); - } - protected function modify_process($entity, array $formDatas): CHASSISEntity - { - return parent::modify_process($entity, $formDatas); - } //List 검색용 //FormFilter 조건절 처리 //검색어조건절처리 @@ -126,7 +119,7 @@ class CHASSISService extends EquipmentService } return $entity; } - public function attachToServer(ServerEntity $serverEntity, array $formDatas = []): CHASSISEntity + public function attachToServer(ServerEntity $serverEntity, array $formDatas = []): CommonEntity { //부품정보가져오기 /** @var CHASSISEntity $entity IDE에 entity type알려주기*/ @@ -139,7 +132,7 @@ class CHASSISService extends EquipmentService return parent::modify_process($entity, $formDatas); } - public function detachFromServer(ServerEntity $serverEntity, array $formDatas = []): CHASSISEntity + public function detachFromServer(ServerEntity $serverEntity, array $formDatas = []): CommonEntity { //부품정보가져오기 /** @var CHASSISEntity $entity IDE에 entity type알려주기*/ diff --git a/app/Services/Equipment/LineService.php b/app/Services/Equipment/LineService.php index 23798b1..d407492 100644 --- a/app/Services/Equipment/LineService.php +++ b/app/Services/Equipment/LineService.php @@ -101,14 +101,6 @@ class LineService extends EquipmentService { return $entity; } - protected function create_process(array $formDatas): LineEntity - { - return parent::create_process($formDatas); - } - protected function modify_process($entity, array $formDatas): LineEntity - { - return parent::modify_process($entity, $formDatas); - } //List 검색용 //FormFilter 조건절 처리 //검색어조건절처리 diff --git a/app/Services/Equipment/ServerPartService.php b/app/Services/Equipment/ServerPartService.php index bd5e07d..a11c8f3 100644 --- a/app/Services/Equipment/ServerPartService.php +++ b/app/Services/Equipment/ServerPartService.php @@ -2,15 +2,16 @@ namespace App\Services\Equipment; -use RuntimeException; -use App\Services\Part\PartService; -use App\Models\Equipment\ServerPartModel; -use App\Helpers\Equipment\ServerPartHelper; -use App\Forms\Equipment\ServerPartForm; -use App\Entities\Part\PartEntity; -use App\Entities\Equipment\ServerPartEntity; -use App\Entities\Equipment\ServerEntity; use App\DTOs\Equipment\ServerPartDTO; +use App\Entities\CommonEntity; +use App\Entities\Equipment\ServerEntity; +use App\Entities\Equipment\ServerPartEntity; +use App\Entities\Part\PartEntity; +use App\Forms\Equipment\ServerPartForm; +use App\Helpers\Equipment\ServerPartHelper; +use App\Models\Equipment\ServerPartModel; +use App\Services\Part\PartService; +use RuntimeException; class ServerPartService extends EquipmentService { @@ -115,7 +116,7 @@ class ServerPartService extends EquipmentService { return $entity; } - protected function create_process(array $formDatas): ServerPartEntity + protected function create_process(array $formDatas): CommonEntity { if (!array_key_exists('type', $formDatas)) { throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생:부품형식이 지정되지 않았습니다."); @@ -144,7 +145,7 @@ class ServerPartService extends EquipmentService } return $entity; } - protected function modify_process($entity, array $formDatas): ServerPartEntity + protected function modify_process($entity, array $formDatas): CommonEntity { if (!array_key_exists('type', $formDatas)) { throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생:부품형식이 지정되지 않았습니다."); @@ -155,6 +156,9 @@ class ServerPartService extends EquipmentService $formDatas['title'] = $partEntity->getTitle(); //서버파트 수정 $entity = parent::modify_process($entity, $formDatas); + if (!$entity instanceof ServerPartEntity) { + throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생:Return Type은 PaymentEntity만 가능"); + } //서비스가 정의 되어 있으면 if ($entity->getServiceInfoUID() !== null) { //월비용 서버파트 인경우 서비스 금액 재설정 @@ -168,10 +172,13 @@ class ServerPartService extends EquipmentService } return $entity; } - protected function delete_process($entity): ServerPartEntity + protected function delete_process($entity): CommonEntity { $this->getPartService($entity->getType())->detachFromServerPart($entity); $entity = parent::delete_process($entity); + if (!$entity instanceof ServerPartEntity) { + throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생:Return Type은 PaymentEntity만 가능"); + } //서비스가 정의 되어 있으면 if ($entity->getServiceInfoUID() !== null) { //월비용 서버파트 인경우 서비스 금액 재설정 diff --git a/app/Services/Part/CPUService.php b/app/Services/Part/CPUService.php index fce075a..e347c49 100644 --- a/app/Services/Part/CPUService.php +++ b/app/Services/Part/CPUService.php @@ -98,14 +98,6 @@ class CPUService extends PartType1Service { return $entity; } - protected function create_process(array $formDatas): CPUEntity - { - return parent::create_process($formDatas); - } - protected function modify_process($entity, array $formDatas): CPUEntity - { - return parent::modify_process($entity, $formDatas); - } //List 검색용 //FormFilter 조건절 처리 //검색어조건절처리 diff --git a/app/Services/Part/CSService.php b/app/Services/Part/CSService.php index c1277ec..ebb46c0 100644 --- a/app/Services/Part/CSService.php +++ b/app/Services/Part/CSService.php @@ -126,14 +126,6 @@ class CSService extends PartType2Service { return $entity; } - protected function create_process(array $formDatas): CSEntity - { - return parent::create_process($formDatas); - } - protected function modify_process($entity, array $formDatas): CSEntity - { - return parent::modify_process($entity, $formDatas); - } //List 검색용 //FormFilter 조건절 처리 //검색어조건절처리 diff --git a/app/Services/Part/DISKService.php b/app/Services/Part/DISKService.php index cdfffd3..c88555e 100644 --- a/app/Services/Part/DISKService.php +++ b/app/Services/Part/DISKService.php @@ -101,14 +101,6 @@ class DISKService extends PartType1Service { return $entity; } - protected function create_process(array $formDatas): DISKEntity - { - return parent::create_process($formDatas); - } - protected function modify_process($entity, array $formDatas): DISKEntity - { - return parent::modify_process($entity, $formDatas); - } //List 검색용 //FormFilter 조건절 처리 //검색어조건절처리 diff --git a/app/Services/Part/IPService.php b/app/Services/Part/IPService.php index 144c8f3..24001aa 100644 --- a/app/Services/Part/IPService.php +++ b/app/Services/Part/IPService.php @@ -117,14 +117,6 @@ class IPService extends PartType3Service { return $entity; } - protected function create_process(array $formDatas): IPEntity - { - return parent::create_process($formDatas); - } - protected function modify_process($entity, array $formDatas): IPEntity - { - return parent::modify_process($entity, $formDatas); - } //List 검색용 //FormFilter 조건절 처리 //검색어조건절처리 diff --git a/app/Services/Part/RAMService.php b/app/Services/Part/RAMService.php index 8dbd155..44015da 100644 --- a/app/Services/Part/RAMService.php +++ b/app/Services/Part/RAMService.php @@ -99,14 +99,6 @@ class RAMService extends PartType1Service { return $entity; } - protected function create_process(array $formDatas): RAMEntity - { - return parent::create_process($formDatas); - } - protected function modify_process($entity, array $formDatas): RAMEntity - { - return parent::modify_process($entity, $formDatas); - } //List 검색용 //FormFilter 조건절 처리 //검색어조건절처리 diff --git a/app/Services/Part/SOFTWAREService.php b/app/Services/Part/SOFTWAREService.php index fcfe367..cd41c55 100644 --- a/app/Services/Part/SOFTWAREService.php +++ b/app/Services/Part/SOFTWAREService.php @@ -99,14 +99,6 @@ class SOFTWAREService extends PartType1Service { return $entity; } - protected function create_process(array $formDatas): SOFTWAREEntity - { - return parent::create_process($formDatas); - } - protected function modify_process($entity, array $formDatas): SOFTWAREEntity - { - return parent::modify_process($entity, $formDatas); - } //List 검색용 //FormFilter 조건절 처리 //검색어조건절처리 diff --git a/app/Services/Part/SWITCHService.php b/app/Services/Part/SWITCHService.php index 622a717..9884ad3 100644 --- a/app/Services/Part/SWITCHService.php +++ b/app/Services/Part/SWITCHService.php @@ -119,14 +119,6 @@ class SWITCHService extends PartType3Service { return $entity; } - protected function create_process(array $formDatas): SWITCHEntity - { - return parent::create_process($formDatas); - } - protected function modify_process($entity, array $formDatas): SWITCHEntity - { - return parent::modify_process($entity, $formDatas); - } //List 검색용 //FormFilter 조건절 처리 //검색어조건절처리 diff --git a/app/Views/admin/client/detail.php b/app/Views/admin/client/detail.php index d00f4a2..efae9fa 100644 --- a/app/Views/admin/client/detail.php +++ b/app/Views/admin/client/detail.php @@ -74,7 +74,7 @@