dbms_init...1
This commit is contained in:
parent
a00af50d7f
commit
48e8689239
@ -305,3 +305,6 @@ define('LAYOUTS', [
|
||||
|
||||
//List의 Page당 갯수
|
||||
define('DEFAULT_LIST_PERPAGE', $_ENV['LIST_PERPAGE'] ?? $_SERVER['LIST_PERPAGE'] ?? 20);
|
||||
|
||||
//서비스별 아이템 타입
|
||||
define('SERVICE_ITEM_TYPES', $_ENV['SERVICEINFO_ITEM_TYPSS'] ?? $_SERVER['SERVICEINFO_ITEM_TYPSS'] ?? ['LINE', 'IP', 'SERVER', 'CPU', 'RAM', 'STORAGE', 'SOFTWARE', 'DEFENCE', 'DOMAIN']);
|
||||
|
||||
@ -24,10 +24,24 @@ abstract class CustomerController extends AdminController
|
||||
}
|
||||
return $this->_clientService;
|
||||
}
|
||||
|
||||
//ServiceController,ServiceItemController,ServicePaymentController등에서 사용됨
|
||||
final protected function initServiceItemOptions(): void
|
||||
{
|
||||
//$item_type(CPU,RAM,STORAGE등)에 따라 선언된 getFormFieldOption용
|
||||
foreach (SERVICE_ITEM_TYPES as $item_type) {
|
||||
$options = [];
|
||||
foreach ($this->getService()->getEquipmentService($item_type)->getEntities() as $entity) {
|
||||
$options[$entity->getPK()] = $entity->getTitle();
|
||||
}
|
||||
$this->setFilterFieldOption($item_type, $options);
|
||||
}
|
||||
}
|
||||
protected function getFormFieldOption(string $field, array $options = []): array
|
||||
{
|
||||
switch ($field) {
|
||||
case 'clientinfo_uid':
|
||||
case 'ownerinfo_uid':
|
||||
foreach ($this->getClientService()->getEntities() as $entity) {
|
||||
$options[$entity->getPK()] = $entity->getTitle();
|
||||
}
|
||||
|
||||
@ -54,6 +54,12 @@ class ServiceController extends CustomerController
|
||||
}
|
||||
return $this->_serviceItemService;
|
||||
}
|
||||
protected function initAction(string $action): void
|
||||
{
|
||||
//$item_type(CPU,RAM,STORAGE등)에 따라 선언된 getFormFieldOption용 사용됨 (initAction보다 먼저 호출해야 됨)
|
||||
$this->initServiceItemOptions();
|
||||
parent::initAction($action);
|
||||
}
|
||||
protected function getFormFieldOption(string $field, array $options = []): array
|
||||
{
|
||||
switch ($field) {
|
||||
@ -73,19 +79,6 @@ class ServiceController extends CustomerController
|
||||
//code의 경우 사용중인 filter_options코드전달용
|
||||
$this->occupied_codes = $occupied_codes;
|
||||
break;
|
||||
case 'SERVER':
|
||||
case 'CPU':
|
||||
case 'RAM':
|
||||
case 'STORAGE':
|
||||
case 'LINE':
|
||||
case 'IP':
|
||||
case 'DEFENCE':
|
||||
case 'SOFTWARE':
|
||||
case 'DOMAIN':
|
||||
foreach ($this->getService()->getEquipmentService($field)->getEntities() as $entity) {
|
||||
$options[$entity->getPK()] = $entity->getTitle();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
$options = parent::getFormFieldOption($field, $options);
|
||||
break;
|
||||
@ -107,17 +100,12 @@ class ServiceController extends CustomerController
|
||||
//Index,FieldForm관련
|
||||
protected function index_process(): array
|
||||
{
|
||||
//추가 Field작업 처리
|
||||
$this->item_types = lang($this->getServiceItemService()->getClassName() . '.' . strtoupper('ITEM_TYPE'));
|
||||
foreach ($this->item_types as $field => $label) {
|
||||
$this->setFilterFieldOption($field, $this->getFormFieldOption($field));
|
||||
}
|
||||
$entities = [];
|
||||
foreach (parent::index_process() as $entity) {
|
||||
foreach ($this->item_types as $field => $label) {
|
||||
foreach (SERVICE_ITEM_TYPES as $item_type) {
|
||||
$entity->setItemEntities(
|
||||
$field,
|
||||
$this->getServiceItemService()->getEntities(['serviceinfo_uid' => $entity->getPK(), 'item_type' => $field])
|
||||
$item_type,
|
||||
$this->getServiceItemService()->getEntities(['serviceinfo_uid' => $entity->getPK(), 'item_type' => $item_type])
|
||||
);
|
||||
}
|
||||
$entities[] = $entity;
|
||||
|
||||
@ -3,16 +3,17 @@
|
||||
namespace App\Controllers\Admin\Customer;
|
||||
|
||||
|
||||
use App\Entities\Customer\ServiceEntity;
|
||||
use App\Entities\Customer\ServiceItemEntity;
|
||||
use App\Helpers\Customer\ServiceItemHelper;
|
||||
use App\Services\Customer\ServiceItemService;
|
||||
|
||||
use App\Services\Customer\ServiceService;
|
||||
use CodeIgniter\HTTP\RedirectResponse;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
use App\Helpers\Customer\ServiceItemHelper;
|
||||
use App\Services\Customer\ServiceItemService;
|
||||
use App\Entities\Customer\ServiceEntity;
|
||||
use App\Services\Customer\ServiceService;
|
||||
|
||||
class ServiceItemController extends CustomerController
|
||||
{
|
||||
private ?ServiceService $_serviceService = null;
|
||||
@ -47,6 +48,12 @@ class ServiceItemController extends CustomerController
|
||||
}
|
||||
return $this->_serviceService;
|
||||
}
|
||||
protected function initAction(string $action): void
|
||||
{
|
||||
//$item_type(CPU,RAM,STORAGE등)에 따라 선언된 getFormFieldOption용 사용됨 (initAction보다 먼저 호출해야 됨)
|
||||
$this->initServiceItemOptions();
|
||||
parent::initAction($action);
|
||||
}
|
||||
protected function getFormFieldOption(string $field, array $options = []): array
|
||||
{
|
||||
switch ($field) {
|
||||
@ -61,9 +68,7 @@ class ServiceItemController extends CustomerController
|
||||
throw new \Exception(__FUNCTION__ . "에서 item_type이 지정되지 않았습니다.");
|
||||
}
|
||||
//$item_type(CPU,RAM,STORAGE등)에 따라 선언된 getFormFieldOption사용 됨
|
||||
foreach ($this->getService()->getEquipmentService($item_type)->getEntities() as $entity) {
|
||||
$options[$entity->getPK()] = $entity->getTitle();
|
||||
}
|
||||
$options = $this->getFilterFieldOption($item_type);
|
||||
break;
|
||||
default:
|
||||
$options = parent::getFormFieldOption($field, $options);
|
||||
@ -97,7 +102,7 @@ class ServiceItemController extends CustomerController
|
||||
$formDatas['item_uid'] = $equipmentEntity->getPK();
|
||||
return $formDatas;
|
||||
}
|
||||
protected function create_process(array $formDatas): RedirectResponse|string
|
||||
protected function create_process(array $formDatas): ServiceItemEntity
|
||||
{
|
||||
$serviceEntity = $this->getServiceService()->getEntity($formDatas['serviceinfo_uid']);
|
||||
if (!$serviceEntity) {
|
||||
|
||||
@ -21,7 +21,6 @@ class ServicePaymentController extends CustomerController
|
||||
$this->class_path .= $this->getService()->getClassName();
|
||||
$this->uri_path .= strtolower($this->getService()->getClassName('/')) . '/';
|
||||
// $this->view_path .= strtolower($this->getService()->getClassName()) . DIRECTORY_SEPARATOR;
|
||||
|
||||
}
|
||||
|
||||
public function getService(): ServicePaymentService
|
||||
@ -45,6 +44,12 @@ class ServicePaymentController extends CustomerController
|
||||
}
|
||||
return $this->_serviceService;
|
||||
}
|
||||
protected function initAction(string $action): void
|
||||
{
|
||||
//$item_type(CPU,RAM,STORAGE등)에 따라 선언된 getFormFieldOption용 사용됨 (initAction보다 먼저 호출해야 됨)
|
||||
$this->initServiceItemOptions();
|
||||
parent::initAction($action);
|
||||
}
|
||||
protected function getFormFieldOption(string $field, array $options = []): array
|
||||
{
|
||||
switch ($field) {
|
||||
@ -54,14 +59,7 @@ class ServicePaymentController extends CustomerController
|
||||
}
|
||||
break;
|
||||
case 'item_uid':
|
||||
//$item_type(CPU,RAM,STORAGE등)에 따라 선언된 getFormFieldOption사용 됨
|
||||
$item_types = ['LINE', 'IP', 'SERVER', 'CPU', 'RAM', 'STORAGE', 'SOFTWARE', 'DEFENCE', 'DOMAIN'];
|
||||
foreach ($item_types as $item_type) {
|
||||
$options[$item_type] = [];
|
||||
foreach ($this->getService()->getEquipmentService($item_type)->getEntities() as $entity) {
|
||||
$options[$item_type][$entity->getPK()] = $entity->getTitle();
|
||||
}
|
||||
}
|
||||
$options = [];
|
||||
break;
|
||||
default:
|
||||
$options = parent::getFormFieldOption($field, $options);
|
||||
|
||||
@ -143,7 +143,7 @@ abstract class CommonController extends BaseController
|
||||
}
|
||||
$this->_control['filter_optons'][$field] = $options;
|
||||
}
|
||||
final protected function getFilterFieldOption(string $field): string
|
||||
final protected function getFilterFieldOption(string $field): array
|
||||
{
|
||||
return $this->_control['filter_optons'][$field] ?? [];
|
||||
}
|
||||
|
||||
@ -373,7 +373,7 @@ CREATE TABLE `logger` (
|
||||
PRIMARY KEY (`uid`),
|
||||
KEY `FK_user_TO_logger` (`user_uid`),
|
||||
CONSTRAINT `FK_user_TO_logger` FOREIGN KEY (`user_uid`) REFERENCES `user` (`uid`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='작업 기록 로그';
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COMMENT='작업 기록 로그';
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
@ -382,6 +382,7 @@ CREATE TABLE `logger` (
|
||||
|
||||
LOCK TABLES `logger` WRITE;
|
||||
/*!40000 ALTER TABLE `logger` DISABLE KEYS */;
|
||||
INSERT INTO `logger` VALUES (1,1,'Customer/ServicePayment','getResultFail','Undefined array key \"item_type\"','13:14:00[debug]: Undefined array key "item_type"','default','2025-06-12 04:14:00'),(2,1,'Customer/ServicePayment','getResultFail','Undefined array key \"item_type\"','14:56:59[debug]: Undefined array key "item_type"','default','2025-06-12 05:56:59'),(3,1,'Customer/ServicePayment','getResultFail','Undefined array key 2','15:01:47[debug]: Undefined array key 2','default','2025-06-12 06:01:47');
|
||||
/*!40000 ALTER TABLE `logger` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
@ -595,7 +596,7 @@ CREATE TABLE `serviceinfo_items` (
|
||||
PRIMARY KEY (`uid`),
|
||||
KEY `FK_serviceinfo_TO_serviceinfo_items` (`serviceinfo_uid`),
|
||||
CONSTRAINT `FK_serviceinfo_TO_serviceinfo_items` FOREIGN KEY (`serviceinfo_uid`) REFERENCES `serviceinfo` (`uid`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=29 DEFAULT CHARSET=utf8 COMMENT='서비스Item정보';
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=64 DEFAULT CHARSET=utf8 COMMENT='서비스Item정보';
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
@ -604,7 +605,7 @@ CREATE TABLE `serviceinfo_items` (
|
||||
|
||||
LOCK TABLES `serviceinfo_items` WRITE;
|
||||
/*!40000 ALTER TABLE `serviceinfo_items` DISABLE KEYS */;
|
||||
INSERT INTO `serviceinfo_items` VALUES (1,1,'LINE',8,'month',1000000,500000,'2025-06-11','default','2025-06-03 06:04:25','2025-06-02 07:19:58'),(2,1,'IP',12,'month',50000,40000,'2025-06-13','default',NULL,'2025-06-02 07:28:27'),(3,1,'IP',11,'month',50000,40000,'2025-06-13','default',NULL,'2025-06-02 07:28:57'),(4,1,'SERVER',3,'month',150000,100000,'2025-06-13','default','2025-06-09 06:06:43','2025-06-02 07:35:12'),(5,1,'CPU',1,'month',50000,40000,'2025-06-13','default',NULL,'2025-06-02 07:36:08'),(6,1,'CPU',1,'month',50000,40000,'2025-06-20','reservation','2025-06-04 00:40:06','2025-06-02 07:36:49'),(7,1,'RAM',2,'onetime',2000,2000,'2025-06-13','default',NULL,'2025-06-02 07:42:56'),(8,1,'RAM',2,'onetime',2000,2000,'2025-06-13','default',NULL,'2025-06-02 07:43:27'),(9,1,'STORAGE',1,'month',100000,50000,'2025-06-13','default',NULL,'2025-06-02 08:11:10'),(10,1,'STORAGE',1,'onetime',100000,100000,'2025-06-25','reservation',NULL,'2025-06-02 08:11:50'),(11,1,'SOFTWARE',1,'onetime',10000,10000,'2025-06-13','default',NULL,'2025-06-02 08:12:55'),(12,1,'SOFTWARE',4,'month',10000,10000,'2025-06-13','default',NULL,'2025-06-02 08:13:40'),(13,1,'SOFTWARE',5,'month',5000,5000,'2025-06-25','reservation',NULL,'2025-06-02 08:14:12'),(14,1,'DEFENCE',3,'month',50000,50000,'2025-06-13','default',NULL,'2025-06-02 08:14:43'),(15,1,'RAM',4,'onetime',4000,2000,'2025-06-20','reservation',NULL,'2025-06-03 07:12:04'),(17,2,'LINE',8,'month',200000,150000,'2025-06-11','default',NULL,'2025-06-09 08:28:10'),(18,2,'IP',16,'month',50000,40000,'2025-06-11','default','2025-06-09 08:38:19','2025-06-09 08:38:01'),(19,2,'SERVER',5,'month',250000,200000,'2025-06-11','default',NULL,'2025-06-09 08:39:51'),(20,2,'CPU',2,'month',100000,100000,'2025-06-11','default',NULL,'2025-06-09 08:40:18'),(21,2,'CPU',2,'month',100000,100000,'2025-06-11','default',NULL,'2025-06-09 08:40:39'),(22,2,'RAM',3,'month',5000,5000,'2025-06-11','default',NULL,'2025-06-09 08:41:15'),(23,2,'RAM',3,'onetime',5000,5000,'2025-06-11','default','2025-06-10 00:33:41','2025-06-09 08:41:37'),(24,2,'STORAGE',3,'onetime',150000,100000,'2025-06-11','default','2025-06-09 08:42:59','2025-06-09 08:42:10'),(25,2,'STORAGE',3,'onetime',150000,100000,'2025-06-11','default',NULL,'2025-06-09 08:42:37'),(26,2,'SOFTWARE',1,'month',1000,1000,'2025-06-11','default',NULL,'2025-06-09 08:43:37'),(27,2,'SOFTWARE',4,'month',200000,100000,'2025-06-11','default',NULL,'2025-06-09 08:44:07'),(28,2,'DOMAIN',1,'onetime',50000,40000,'2025-06-11','default',NULL,'2025-06-09 08:44:41');
|
||||
INSERT INTO `serviceinfo_items` VALUES (1,1,'LINE',8,'month',1000000,500000,'2025-06-11','default','2025-06-03 06:04:25','2025-06-02 07:19:58'),(2,1,'IP',12,'month',50000,40000,'2025-06-13','default',NULL,'2025-06-02 07:28:27'),(3,1,'IP',11,'month',50000,40000,'2025-06-13','default',NULL,'2025-06-02 07:28:57'),(4,1,'SERVER',3,'month',150000,100000,'2025-06-13','default','2025-06-09 06:06:43','2025-06-02 07:35:12'),(5,1,'CPU',1,'month',50000,40000,'2025-06-13','default',NULL,'2025-06-02 07:36:08'),(6,1,'CPU',1,'month',50000,40000,'2025-06-20','reservation','2025-06-04 00:40:06','2025-06-02 07:36:49'),(7,1,'RAM',2,'onetime',2000,2000,'2025-06-13','default',NULL,'2025-06-02 07:42:56'),(8,1,'RAM',2,'onetime',2000,2000,'2025-06-13','default',NULL,'2025-06-02 07:43:27'),(9,1,'STORAGE',1,'month',100000,50000,'2025-06-13','default',NULL,'2025-06-02 08:11:10'),(10,1,'STORAGE',1,'onetime',100000,100000,'2025-06-25','reservation',NULL,'2025-06-02 08:11:50'),(11,1,'SOFTWARE',1,'onetime',10000,10000,'2025-06-13','default',NULL,'2025-06-02 08:12:55'),(12,1,'SOFTWARE',4,'month',10000,10000,'2025-06-13','default',NULL,'2025-06-02 08:13:40'),(13,1,'SOFTWARE',5,'month',5000,5000,'2025-06-25','reservation',NULL,'2025-06-02 08:14:12'),(14,1,'DEFENCE',3,'month',50000,50000,'2025-06-13','default',NULL,'2025-06-02 08:14:43'),(15,1,'RAM',4,'onetime',4000,2000,'2025-06-20','reservation',NULL,'2025-06-03 07:12:04'),(17,2,'LINE',8,'month',200000,150000,'2025-06-11','default',NULL,'2025-06-09 08:28:10'),(18,2,'IP',16,'month',50000,40000,'2025-06-11','default','2025-06-09 08:38:19','2025-06-09 08:38:01'),(19,2,'SERVER',5,'month',250000,200000,'2025-06-11','default',NULL,'2025-06-09 08:39:51'),(20,2,'CPU',2,'month',100000,100000,'2025-06-11','default',NULL,'2025-06-09 08:40:18'),(21,2,'CPU',2,'month',100000,100000,'2025-06-11','default',NULL,'2025-06-09 08:40:39'),(22,2,'RAM',3,'month',5000,5000,'2025-06-11','default',NULL,'2025-06-09 08:41:15'),(23,2,'RAM',3,'onetime',5000,5000,'2025-06-11','default','2025-06-10 00:33:41','2025-06-09 08:41:37'),(24,2,'STORAGE',3,'onetime',150000,100000,'2025-06-11','default','2025-06-09 08:42:59','2025-06-09 08:42:10'),(25,2,'STORAGE',3,'onetime',150000,100000,'2025-06-11','default',NULL,'2025-06-09 08:42:37'),(26,2,'SOFTWARE',1,'month',1000,1000,'2025-06-11','default',NULL,'2025-06-09 08:43:37'),(27,2,'SOFTWARE',4,'month',200000,100000,'2025-06-11','default',NULL,'2025-06-09 08:44:07'),(28,2,'DOMAIN',1,'onetime',50000,40000,'2025-06-11','default',NULL,'2025-06-09 08:44:41'),(62,3,'RAM',2,'onetime',10000,5000,'2025-06-11','default',NULL,'2025-06-12 03:36:55'),(63,3,'RAM',2,'month',10000,5000,'2025-06-11','default',NULL,'2025-06-12 03:53:05');
|
||||
/*!40000 ALTER TABLE `serviceinfo_items` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
@ -618,6 +619,7 @@ DROP TABLE IF EXISTS `serviceinfo_payment`;
|
||||
CREATE TABLE `serviceinfo_payment` (
|
||||
`uid` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`serviceinfo_uid` int(11) NOT NULL COMMENT '서비스정보',
|
||||
`ownerinfo_uid` int(11) NOT NULL COMMENT '관리자정보',
|
||||
`item_type` varchar(20) NOT NULL,
|
||||
`item_uid` int(11) NOT NULL,
|
||||
`billing_cycle` varchar(20) NOT NULL COMMENT '청구방식',
|
||||
@ -629,8 +631,10 @@ CREATE TABLE `serviceinfo_payment` (
|
||||
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
|
||||
PRIMARY KEY (`uid`),
|
||||
KEY `FK_serviceinfo_TO_serviceinfo_payment` (`serviceinfo_uid`),
|
||||
KEY `FK_clientinfo_TO_serviceinfo_payment` (`ownerinfo_uid`),
|
||||
CONSTRAINT `FK_clientinfo_TO_serviceinfo_payment` FOREIGN KEY (`ownerinfo_uid`) REFERENCES `clientinfo` (`uid`),
|
||||
CONSTRAINT `FK_serviceinfo_TO_serviceinfo_payment` FOREIGN KEY (`serviceinfo_uid`) REFERENCES `serviceinfo` (`uid`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='결제정보';
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COMMENT='결제정보';
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
@ -639,6 +643,7 @@ CREATE TABLE `serviceinfo_payment` (
|
||||
|
||||
LOCK TABLES `serviceinfo_payment` WRITE;
|
||||
/*!40000 ALTER TABLE `serviceinfo_payment` DISABLE KEYS */;
|
||||
INSERT INTO `serviceinfo_payment` VALUES (4,3,4,'RAM',2,'onetime',5000,'2025-06-25','2025-06-12','default',NULL,'2025-06-12 03:36:55');
|
||||
/*!40000 ALTER TABLE `serviceinfo_payment` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
@ -743,4 +748,4 @@ UNLOCK TABLES;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
-- Dump completed on 2025-06-11 18:52:37
|
||||
-- Dump completed on 2025-06-12 19:09:18
|
||||
|
||||
@ -4,9 +4,9 @@
|
||||
"settings": {
|
||||
"width": 3000,
|
||||
"height": 3000,
|
||||
"scrollTop": -861.8844,
|
||||
"scrollLeft": -401.9322,
|
||||
"zoomLevel": 0.79,
|
||||
"scrollTop": -898.5025,
|
||||
"scrollLeft": -208.0376,
|
||||
"zoomLevel": 0.73,
|
||||
"show": 511,
|
||||
"database": 4,
|
||||
"databaseName": "",
|
||||
@ -65,7 +65,8 @@
|
||||
"o8yw46vm30cC7wl9cRMdo",
|
||||
"ocWjncqwtYkP02mw4A0-8",
|
||||
"6oBuPqT-ikPI7X8a05Trv",
|
||||
"Hj5AZkoYGvM_syvnqMeOi"
|
||||
"Hj5AZkoYGvM_syvnqMeOi",
|
||||
"dgALp3F5aQw7gy6h_Ejcl"
|
||||
],
|
||||
"indexIds": [],
|
||||
"memoIds": []
|
||||
@ -718,6 +719,7 @@
|
||||
"columnIds": [
|
||||
"GMPyqxaroK2OjQZnoCRwn",
|
||||
"ZWV8iXrgQovfYTm32QGbZ",
|
||||
"yc1mNA3iMmF8xoUX60z6F",
|
||||
"xWCCXo-zVdNuL4E9AhjCN",
|
||||
"4O3Qit9vqva-izvWHJLTD",
|
||||
"N-ESuxOk84rEdS2SzpVcx",
|
||||
@ -731,6 +733,7 @@
|
||||
"seqColumnIds": [
|
||||
"GMPyqxaroK2OjQZnoCRwn",
|
||||
"ZWV8iXrgQovfYTm32QGbZ",
|
||||
"yc1mNA3iMmF8xoUX60z6F",
|
||||
"2Re7GlIDs1MKhwQ1n_5Ty",
|
||||
"xWCCXo-zVdNuL4E9AhjCN",
|
||||
"4O3Qit9vqva-izvWHJLTD",
|
||||
@ -751,7 +754,7 @@
|
||||
"color": ""
|
||||
},
|
||||
"meta": {
|
||||
"updateAt": 1749616861214,
|
||||
"updateAt": 1749701095112,
|
||||
"createAt": 1748484896313
|
||||
}
|
||||
},
|
||||
@ -763,11 +766,11 @@
|
||||
"N_yJVoCN4oUEDhYqdzApb",
|
||||
"NzxkmndrTbH7xb6fbnGV7",
|
||||
"f1hR1JRFHBHwiJSSX34gw",
|
||||
"O7aGU_LJxCO1NeNVWbB-J",
|
||||
"SGWWOOHjCF81V4O5tUiJu",
|
||||
"uuDbJDSDQLey7Km1W9hlJ",
|
||||
"Gb6fmS40Q3wvnvD1HMTqR",
|
||||
"_UFwKNcesG423815BIYBi",
|
||||
"O7aGU_LJxCO1NeNVWbB-J",
|
||||
"FJtEzmrQUsMMbrWbzr8IR",
|
||||
"hQ5EOPiUpDbVpWQwawtw4",
|
||||
"9o7wfPp7WK2nZoxkDZ9Y1",
|
||||
@ -789,11 +792,11 @@
|
||||
"GLfHynBuy8Bzby9_5oRkq",
|
||||
"Fx2k158yi9P2l5An09ae1",
|
||||
"f1hR1JRFHBHwiJSSX34gw",
|
||||
"O7aGU_LJxCO1NeNVWbB-J",
|
||||
"SGWWOOHjCF81V4O5tUiJu",
|
||||
"uuDbJDSDQLey7Km1W9hlJ",
|
||||
"Gb6fmS40Q3wvnvD1HMTqR",
|
||||
"_UFwKNcesG423815BIYBi",
|
||||
"O7aGU_LJxCO1NeNVWbB-J",
|
||||
"RpyPtXKwtu3XFr5BM61TA",
|
||||
"FJtEzmrQUsMMbrWbzr8IR",
|
||||
"hQ5EOPiUpDbVpWQwawtw4",
|
||||
@ -813,7 +816,7 @@
|
||||
"color": ""
|
||||
},
|
||||
"meta": {
|
||||
"updateAt": 1749529381866,
|
||||
"updateAt": 1749687034731,
|
||||
"createAt": 1748485662214
|
||||
}
|
||||
},
|
||||
@ -6828,6 +6831,26 @@
|
||||
"updateAt": 1749615248043,
|
||||
"createAt": 1749615226177
|
||||
}
|
||||
},
|
||||
"yc1mNA3iMmF8xoUX60z6F": {
|
||||
"id": "yc1mNA3iMmF8xoUX60z6F",
|
||||
"tableId": "QCNA57Pi6A9dJDgybxS5v",
|
||||
"name": "ownerinfo_uid",
|
||||
"comment": "관리자정보",
|
||||
"dataType": "INT",
|
||||
"default": "",
|
||||
"options": 8,
|
||||
"ui": {
|
||||
"keys": 2,
|
||||
"widthName": 77,
|
||||
"widthComment": 62,
|
||||
"widthDataType": 60,
|
||||
"widthDefault": 60
|
||||
},
|
||||
"meta": {
|
||||
"updateAt": 1749700784536,
|
||||
"createAt": 1749700754351
|
||||
}
|
||||
}
|
||||
},
|
||||
"relationshipEntities": {
|
||||
@ -7010,7 +7033,7 @@
|
||||
"_AcWUYKzNJd-V0fRHq8Cx"
|
||||
],
|
||||
"x": 1615.2084,
|
||||
"y": 784.0748,
|
||||
"y": 864.0747999999999,
|
||||
"direction": 1
|
||||
},
|
||||
"end": {
|
||||
@ -7094,7 +7117,7 @@
|
||||
"_AcWUYKzNJd-V0fRHq8Cx"
|
||||
],
|
||||
"x": 1615.2084,
|
||||
"y": 944.0748,
|
||||
"y": 970.7414666666665,
|
||||
"direction": 1
|
||||
},
|
||||
"end": {
|
||||
@ -7187,13 +7210,41 @@
|
||||
"ZWV8iXrgQovfYTm32QGbZ"
|
||||
],
|
||||
"x": 682.6305,
|
||||
"y": 958.9288,
|
||||
"y": 1056.9288000000001,
|
||||
"direction": 2
|
||||
},
|
||||
"meta": {
|
||||
"updateAt": 1749615226177,
|
||||
"createAt": 1749615226177
|
||||
}
|
||||
},
|
||||
"dgALp3F5aQw7gy6h_Ejcl": {
|
||||
"id": "dgALp3F5aQw7gy6h_Ejcl",
|
||||
"identification": false,
|
||||
"relationshipType": 16,
|
||||
"startRelationshipType": 2,
|
||||
"start": {
|
||||
"tableId": "6ajvOCaGuXU9pzV0Y9jEi",
|
||||
"columnIds": [
|
||||
"_AcWUYKzNJd-V0fRHq8Cx"
|
||||
],
|
||||
"x": 1615.2084,
|
||||
"y": 757.4081333333332,
|
||||
"direction": 1
|
||||
},
|
||||
"end": {
|
||||
"tableId": "QCNA57Pi6A9dJDgybxS5v",
|
||||
"columnIds": [
|
||||
"yc1mNA3iMmF8xoUX60z6F"
|
||||
],
|
||||
"x": 682.6305,
|
||||
"y": 884.9288,
|
||||
"direction": 2
|
||||
},
|
||||
"meta": {
|
||||
"updateAt": 1749700754352,
|
||||
"createAt": 1749700754352
|
||||
}
|
||||
}
|
||||
},
|
||||
"indexEntities": {},
|
||||
|
||||
@ -8,7 +8,7 @@ class ServiceEntity extends CustomerEntity
|
||||
{
|
||||
const PK = ServiceModel::PK;
|
||||
const TITLE = ServiceModel::TITLE;
|
||||
final public function getOwnertUID(): int
|
||||
final public function getOwnerUID(): int
|
||||
{
|
||||
return intval($this->attributes['ownerinfo_uid']);
|
||||
}
|
||||
|
||||
@ -20,6 +20,10 @@ class ServiceItemEntity extends CustomerEntity
|
||||
{
|
||||
return intval($this->attributes['item_uid']);
|
||||
}
|
||||
public function getBillingCycle(): string
|
||||
{
|
||||
return $this->attributes['billing_cycle'];
|
||||
}
|
||||
public function getPrice(): int
|
||||
{
|
||||
return intval($this->attributes['price']);
|
||||
@ -38,6 +42,6 @@ class ServiceItemEntity extends CustomerEntity
|
||||
}
|
||||
public function getView_BillingCycle(): string
|
||||
{
|
||||
return $this->attributes['billing_cycle'] == "month" ? "" : ICONS['ONETIME'];;
|
||||
return $this->getBillingCycle() == "month" ? "" : ICONS['ONETIME'];;
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
namespace App\Entities\Customer;
|
||||
|
||||
use App\Models\Customer\ServicePaymentModel;
|
||||
use DateTime;
|
||||
|
||||
class ServicePaymentEntity extends CustomerEntity
|
||||
{
|
||||
@ -12,6 +13,10 @@ class ServicePaymentEntity extends CustomerEntity
|
||||
{
|
||||
return intval($this->attributes['serviceinfo_uid']);
|
||||
}
|
||||
public function getItemType(): string
|
||||
{
|
||||
return $this->attributes['item_type'];
|
||||
}
|
||||
public function getItemUid(): int
|
||||
{
|
||||
return intval($this->attributes['item_uid']);
|
||||
@ -20,8 +25,23 @@ class ServicePaymentEntity extends CustomerEntity
|
||||
{
|
||||
return intval($this->attributes['amount']);
|
||||
}
|
||||
public function getView_BillingCycle(): string
|
||||
|
||||
public function getBillingAt(): string
|
||||
{
|
||||
return $this->attributes['billing_cycle'] == "month" ? "" : ICONS['ONETIME'];;
|
||||
return $this->attributes['billing_at'];
|
||||
}
|
||||
public function getView_CounDueAt(): string
|
||||
{
|
||||
$now = new DateTime(); // 오늘 날짜
|
||||
$due = new DateTime($this->getBillingAt());
|
||||
if ($due < $now) {
|
||||
$interval = $due->diff($now);
|
||||
return "{$interval->days}일 전";
|
||||
} else if ($due > $now) {
|
||||
$interval = $now->diff($due);
|
||||
return "{$interval->days}일 남음";
|
||||
} else {
|
||||
return "당일";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -17,17 +17,32 @@ class ServicePaymentHelper extends CustomerHelper
|
||||
//ItemType에 따른 조건부 추가 Index Page
|
||||
public function getFieldFormByItemType(string $field, mixed $value, array $viewDatas, array $extras = []): string
|
||||
{
|
||||
$form = "";
|
||||
if (in_array($viewDatas['control']['action'], ['create', 'modify', 'create_form', 'modify_form'])) {
|
||||
$extras = (strpos($viewDatas['control']['field_rules'][$field], 'required') !== false) ? ["class" => "form-control", "required" => "", ...$extras] : ["class" => "form-control", ...$extras];
|
||||
}
|
||||
switch ($viewDatas['item_type']) {
|
||||
case 'DOMAIN':
|
||||
if (in_array($viewDatas['control']['action'], ['create', 'modify', 'create_form', 'modify_form'])) {
|
||||
$form = form_input($field, $value ?? "", ["placeholder" => "예)example.com", ...$extras]);
|
||||
} else {
|
||||
$form = parent::getFieldForm($field, $value, $viewDatas, $extras);
|
||||
switch ($field) {
|
||||
case "LINE":
|
||||
case "IP":
|
||||
case "SERVER":
|
||||
case "CPU":
|
||||
case "RAM":
|
||||
case "STORAGE":
|
||||
case "SOFTWARE":
|
||||
case "DEFENCE":
|
||||
case "DOMAIN":
|
||||
if (!is_array($viewDatas['control']['filter_optons'][$field])) {
|
||||
throw new \Exception(__METHOD__ . "에서 {$field}의 field_options가 array형태가 아닙니다.");
|
||||
}
|
||||
$formOptions = ["" => lang($viewDatas['class_path'] . '.label.' . $field) . ' 선택'];
|
||||
foreach ($viewDatas['control']['filter_optons'][$field] as $key => $label) {
|
||||
$formOptions[$key] = $label;
|
||||
}
|
||||
$extra_class = isset($extras['class']) ? $extras['class'] . ' select-field' : 'select-field';
|
||||
// create, modify, create_form, modify_form 액션에서는 기본값:DEFAULTS['STATUS']을 설정
|
||||
if (in_array($viewDatas['control']['action'], ['create', 'modify', 'create_form', 'modify_form'])) {
|
||||
$value = $value ?? DEFAULTS['STATUS'];
|
||||
}
|
||||
$form = form_dropdown($field, $formOptions, $value, ['class' => $extra_class, ...array_diff_key($extras, ['class' => ''])]);
|
||||
break;
|
||||
default:
|
||||
$form = parent::getFieldForm($field, $value, $viewDatas, $extras);
|
||||
@ -42,7 +57,11 @@ class ServicePaymentHelper extends CustomerHelper
|
||||
}
|
||||
switch ($field) {
|
||||
case 'item_uid':
|
||||
$form = $this->getFieldFormByItemType($field, $value, $viewDatas, $extras);
|
||||
if (array_key_exists('entity', $viewDatas)) {
|
||||
$form = $this->getFieldFormByItemType($viewDatas['entity']->getItemType(), $value, $viewDatas, $extras);
|
||||
} else {
|
||||
$form = parent::getFieldForm($field, $value, $viewDatas, $extras);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
$form = parent::getFieldForm($field, $value, $viewDatas, $extras);
|
||||
@ -50,4 +69,20 @@ class ServicePaymentHelper extends CustomerHelper
|
||||
}
|
||||
return $form;
|
||||
}
|
||||
public function getFieldView(string $field, mixed $value, array $viewDatas, array $extras = []): string|null
|
||||
{
|
||||
switch ($field) {
|
||||
case "due_at":
|
||||
$value = $viewDatas['entity']->getView_CounDueAt();
|
||||
break;
|
||||
default:
|
||||
$value = parent::getFieldView($field, $value, $viewDatas, $extras);
|
||||
break;
|
||||
}
|
||||
if (is_array($value)) {
|
||||
echo __METHOD__ . "에서 오류: {$field}의 값이 Array형태입니다";
|
||||
exit;
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
<?php
|
||||
return [
|
||||
'title' => "서비스결제제정보",
|
||||
'title' => "서비스결제정보",
|
||||
'label' => [
|
||||
'serviceinfo_uid' => "서비스명",
|
||||
'ownerinfo_uid' => "관리자",
|
||||
'item_type' => "항목형식",
|
||||
'item_uid' => "항목",
|
||||
'billing_cycle' => "청구방식",
|
||||
@ -13,6 +14,16 @@ return [
|
||||
'updated_at' => "수정일",
|
||||
'created_at' => "신청일",
|
||||
'deleted_at' => "삭제일",
|
||||
'due_at' => "결제일",
|
||||
"LINE" => "라인",
|
||||
"IP" => "IP주소",
|
||||
"SERVER" => "서버",
|
||||
"CPU" => "CPU",
|
||||
"RAM" => "메모리",
|
||||
"STORAGE" => "저장장치",
|
||||
"SOFTWARE" => "소프트웨어",
|
||||
"DEFENCE" => "방어(CS)",
|
||||
"DOMAIN" => "도메인",
|
||||
],
|
||||
'DEFAULTS' => [
|
||||
'item_type' => "server",
|
||||
|
||||
@ -61,7 +61,7 @@ abstract class GoogleSocket extends MySocket
|
||||
'detail' => $detail,
|
||||
'status' => 'unuse',
|
||||
];
|
||||
$entity = $this->getService()->getModel()->create($formDatas);
|
||||
$entity = $this->getService()->create($formDatas);
|
||||
$this->getService()->getModel()->transCommit();
|
||||
} catch (\Exception $e) {
|
||||
//Transaction Rollback
|
||||
|
||||
@ -157,27 +157,29 @@ abstract class CommonModel extends Model
|
||||
return $entity;
|
||||
}
|
||||
|
||||
private function save_process(mixed $entity): mixed
|
||||
final protected function save_process(mixed $entity): mixed
|
||||
{
|
||||
// 최종 변경사항이 없으면
|
||||
if (!$entity->hasChanged()) {
|
||||
try {
|
||||
// 최종 변경사항이 없으면
|
||||
if (!$entity->hasChanged()) {
|
||||
return $entity;
|
||||
}
|
||||
// 최종 저장 시 오류 발생하면
|
||||
if (!$this->save($entity)) {
|
||||
throw new \Exception(sprintf(
|
||||
"\n------%s 오류-----\n%s\n------------------------------\n",
|
||||
__METHOD__,
|
||||
var_export($this->errors(), true)
|
||||
));
|
||||
}
|
||||
return $entity;
|
||||
} catch (\Exception $e) {
|
||||
LogCollector::error($e->getMessage());
|
||||
throw $e;
|
||||
}
|
||||
// 최종 저장 시 오류 발생하면
|
||||
if (!$this->save($entity)) {
|
||||
$message = sprintf(
|
||||
"\n------%s 오류-----\n%s\n%s\n------------------------------\n",
|
||||
__FUNCTION__,
|
||||
$this->getLastQuery(),
|
||||
var_export($this->errors(), true)
|
||||
);
|
||||
LogCollector::error($message);
|
||||
throw new \Exception($message);
|
||||
}
|
||||
return $entity;
|
||||
}
|
||||
|
||||
final function create(array $formDatas, mixed $entity): mixed
|
||||
public function create(array $formDatas, mixed $entity): mixed
|
||||
{
|
||||
// Field에 맞는 Validation Rule 재정의
|
||||
$this->setValidationRules($this->getFormFieldRules(__FUNCTION__, $this->getAllowedFields()));
|
||||
@ -201,7 +203,7 @@ abstract class CommonModel extends Model
|
||||
LogCollector::debug(var_export($entity->toArray(), true));
|
||||
return $entity;
|
||||
}
|
||||
final function modify(mixed $entity, array $formDatas): mixed
|
||||
final public function modify(mixed $entity, array $formDatas): mixed
|
||||
{
|
||||
// Field에 맞는 Validation Rule 재정의
|
||||
$this->setValidationRules($this->getFormFieldRules(__FUNCTION__, $this->getAllowedFields()));
|
||||
|
||||
@ -61,4 +61,29 @@ class ServiceModel extends CustomerModel
|
||||
}
|
||||
return $rule;
|
||||
}
|
||||
//다음 달로 결제일을 연장합니다.
|
||||
public function extendPaymentDate(int $uid): mixed
|
||||
{
|
||||
$sql = "UPDATE ? SET billing_at = IF(
|
||||
DAY(billing_at) = DAY(LAST_DAY(billing_at)),
|
||||
LAST_DAY(DATE_ADD(billing_at, INTERVAL 1 MONTH)),
|
||||
DATE_ADD(billing_at, INTERVAL 1 MONTH))
|
||||
WHERE uid = ? AND status = ?";
|
||||
$sql = $this->setQuery($sql)
|
||||
->setParameter(1, $this->getTableName())
|
||||
->setParameter(2, $uid)
|
||||
->setParameter(3, DEFAULTS['STATUS'])
|
||||
->getSQL();
|
||||
if (!$sql) {
|
||||
throw new \Exception("SQL문이 생성되지 않았습니다.");
|
||||
}
|
||||
if (!$this->isValidQuery($sql)) {
|
||||
throw new \Exception("SQL문이 유효하지 않습니다: " . $sql);
|
||||
}
|
||||
// 쿼리 실행
|
||||
if (!$this->execute($sql)) {
|
||||
throw new \Exception("SQL문 실행에 실패했습니다: " . $sql);
|
||||
}
|
||||
return $this->query($sql);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
namespace App\Models\Customer;
|
||||
|
||||
use App\Entities\Customer\ServicePaymentEntity;
|
||||
use App\Libraries\LogCollector;
|
||||
|
||||
class ServicePaymentModel extends CustomerModel
|
||||
{
|
||||
@ -14,6 +15,7 @@ class ServicePaymentModel extends CustomerModel
|
||||
protected $returnType = ServicePaymentEntity::class;
|
||||
protected $allowedFields = [
|
||||
"serviceinfo_uid",
|
||||
"ownerinfo_uid",
|
||||
"item_type",
|
||||
"item_uid",
|
||||
"billing_cycle",
|
||||
@ -34,15 +36,18 @@ class ServicePaymentModel extends CustomerModel
|
||||
}
|
||||
switch ($field) {
|
||||
case "serviceinfo_uid":
|
||||
case "ownerinfo_uid":
|
||||
case "item_uid":
|
||||
case "amount":
|
||||
$rule = "required|numeric";
|
||||
break;
|
||||
case "item_type":
|
||||
case "billing_cycle":
|
||||
case "status":
|
||||
$rule = "required|trim|string";
|
||||
break;
|
||||
case "status":
|
||||
$rule = "if_exist|trim|string";
|
||||
break;
|
||||
case "billing_at":
|
||||
case "issue_at":
|
||||
$rule = "required|valid_date";
|
||||
|
||||
@ -7,8 +7,6 @@ use CodeIgniter\HTTP\IncomingRequest;
|
||||
use App\Models\Customer\ServiceItemModel;
|
||||
use App\Entities\Customer\ServiceItemEntity;
|
||||
use App\Services\Customer\ServiceService;
|
||||
use App\Entities\Customer\ServiceEntity;
|
||||
use App\Entities\Customer\ServicePaymentEntity;
|
||||
|
||||
class ServiceItemService extends CustomerService
|
||||
{
|
||||
@ -67,30 +65,13 @@ class ServiceItemService extends CustomerService
|
||||
return ['serviceinfo_uid', 'item_type', 'item_uid', 'billing_cycle', 'price', 'amount', 'start_at', 'updated_at', 'status'];
|
||||
}
|
||||
|
||||
private function createPayment(ServiceEntity $serviceEntity,): ServicePaymentEntity
|
||||
{
|
||||
//서비스 결제정보를 생성함
|
||||
$entity = $this->getServicePaymentService()->create([
|
||||
'serviceinfo_uid' => $serviceEntity->getPK(),
|
||||
'item_type' => $formDatas['item_type'],
|
||||
'item_uid' => $formDatas['item_uid'],
|
||||
'billing_cycle' => $formDatas['billing_cycle'],
|
||||
'amount' => $formDatas['amount'],
|
||||
'billing_at' => $serviceEntity->getBillingAt(),
|
||||
'issue_at' => $formDatas['issue_at'],
|
||||
]);
|
||||
dd($formDatas);
|
||||
return $entity;
|
||||
}
|
||||
public function create(array $formDatas, mixed $entity = null): ServiceItemEntity
|
||||
{
|
||||
$serviceEntity = $this->getServiceService()->getEntity($formDatas['serviceinfo_uid']);
|
||||
if (!$serviceEntity) {
|
||||
throw new \Exception("{$formDatas['serviceinfo_uid']}에 대한 서비스정보를 찾을수 없습니다.");
|
||||
}
|
||||
$entity = parent::create($formDatas, $entity);
|
||||
// 결제정보 ServicePaymentService에 등록
|
||||
$this->createPayment($serviceEntity, $formDatas);
|
||||
//결제방식이 ontime인경우에는 바로 결제정보 ServicePaymentService에 등록
|
||||
if ($entity->getBillingCycle() !== 'ontime') {
|
||||
$this->getServicePaymentService()->createPaymentByServiceItem($entity);
|
||||
}
|
||||
return $entity;
|
||||
}
|
||||
public function modify(mixed $entity, array $formDatas): ServiceItemEntity
|
||||
|
||||
@ -2,13 +2,17 @@
|
||||
|
||||
namespace App\Services\Customer;
|
||||
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
|
||||
use App\Entities\Customer\ServiceItemEntity;
|
||||
use App\Entities\Customer\ServicePaymentEntity;
|
||||
use App\Models\Customer\ServicePaymentModel;
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
use App\Services\Customer\ServiceService;
|
||||
|
||||
class ServicePaymentService extends CustomerService
|
||||
{
|
||||
protected ?IncomingRequest $request = null;
|
||||
private ?ServiceService $_serviceService = null;
|
||||
public function __construct(?IncomingRequest $request = null)
|
||||
{
|
||||
parent::__construct($request);
|
||||
@ -26,6 +30,7 @@ class ServicePaymentService extends CustomerService
|
||||
{
|
||||
return [
|
||||
"serviceinfo_uid",
|
||||
"ownerinfo_uid",
|
||||
"item_type",
|
||||
"item_uid",
|
||||
"billing_cycle",
|
||||
@ -37,7 +42,7 @@ class ServicePaymentService extends CustomerService
|
||||
}
|
||||
public function getFilterFields(): array
|
||||
{
|
||||
return ["serviceinfo_uid", 'item_type', 'item_uid', 'billing_cycle', 'status'];
|
||||
return ["serviceinfo_uid", "ownerinfo_uid", 'item_type', 'item_uid', 'billing_cycle', 'status'];
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
@ -45,6 +50,34 @@ class ServicePaymentService extends CustomerService
|
||||
}
|
||||
public function getIndexFields(): array
|
||||
{
|
||||
return ['serviceinfo_uid', 'item_type', 'item_uid', 'billing_cycle', 'amount', 'billing_at', 'issue_at', 'status'];
|
||||
return ['serviceinfo_uid', "ownerinfo_uid", 'item_type', 'item_uid', 'billing_cycle', 'amount', 'billing_at', 'issue_at', 'due_at', 'status'];
|
||||
}
|
||||
|
||||
public function getServiceService(): ServiceService
|
||||
{
|
||||
if (!$this->_serviceService) {
|
||||
$this->_serviceService = new ServiceService($this->request);
|
||||
}
|
||||
return $this->_serviceService;
|
||||
}
|
||||
|
||||
//ServiceItemService에서 사용
|
||||
public function createPaymentByServiceItem(ServiceItemEntity $serviceItemEntity): ServicePaymentEntity
|
||||
{
|
||||
$serviceEntity = $this->getServiceService()->getEntity($serviceItemEntity->getServiceUid());
|
||||
if (!$serviceEntity) {
|
||||
throw new \Exception("{$serviceItemEntity->getServiceUid()}에 대한 서비스정보를 찾을수 없습니다.");
|
||||
}
|
||||
$formDatas = [
|
||||
'serviceinfo_uid' => $serviceItemEntity->getServiceUid(),
|
||||
'ownerinfo_uid' => $serviceEntity->getOwnerUid(),
|
||||
'item_type' => $serviceItemEntity->getItemType(),
|
||||
'item_uid' => $serviceItemEntity->getItemUid(),
|
||||
'billing_cycle' => $serviceItemEntity->getBillingCycle(),
|
||||
'amount' => $serviceItemEntity->getAmount(),
|
||||
'billing_at' => $serviceEntity->getBillingAt(),
|
||||
'issue_at' => $serviceItemEntity->getBillingCycle() === 'onetime' ? date('Y-m-d') : $serviceEntity->getBillingAt(),
|
||||
];
|
||||
return $this->create($formDatas);
|
||||
}
|
||||
}
|
||||
|
||||
@ -62,6 +62,11 @@ class ServiceService extends CustomerService
|
||||
}
|
||||
return $this->_codeService;
|
||||
}
|
||||
//다음 달로 결제일을 연장합니다.
|
||||
public function extendPaymentDate(ServiceEntity $entity): void
|
||||
{
|
||||
$this->getModel()->extendPaymentDate($entity->getPK());
|
||||
}
|
||||
public function create(array $formDatas, mixed $entity = null): ServiceEntity
|
||||
{
|
||||
//code의 경우 서비스중으로 설정작업
|
||||
|
||||
@ -57,6 +57,6 @@ class MyLogService extends CommonService
|
||||
'content' => LogCollector::dump(),
|
||||
];
|
||||
LogCollector::clear();
|
||||
return $this->getModel()->create($formDatas, new MyLogEntity());
|
||||
return $this->create($formDatas);
|
||||
}
|
||||
}
|
||||
|
||||
@ -48,13 +48,13 @@
|
||||
<td colspan="<?= count($viewDatas['control']['index_fields']) + 2 ?>">
|
||||
<table class="table table-bordered table-hover table-striped">
|
||||
<tr>
|
||||
<?php foreach ($viewDatas['item_types'] as $field => $label): ?>
|
||||
<th data-rtc-resizable="<?= $field ?>" nowrap><?= $viewDatas['helper']->getFieldLabel($field, $viewDatas) ?></th>
|
||||
<?php foreach (SERVICE_ITEM_TYPES as $item_type): ?>
|
||||
<th data-rtc-resizable="<?= $item_type ?>" nowrap><?= $viewDatas['helper']->getFieldLabel($item_type, $viewDatas) ?></th>
|
||||
<?php endforeach ?>
|
||||
</tr>
|
||||
<tr>
|
||||
<?php foreach ($viewDatas['item_types'] as $field => $label): ?>
|
||||
<td><?= $viewDatas['helper']->getFieldView($field, $entity->$field, $viewDatas) ?></td>
|
||||
<?php foreach (SERVICE_ITEM_TYPES as $item_type): ?>
|
||||
<td><?= $viewDatas['helper']->getFieldView($item_type, $entity->$item_type, $viewDatas) ?></td>
|
||||
<?php endforeach ?>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user