diff --git a/app/Config/Constants.php b/app/Config/Constants.php index 064c53c..a65d999 100644 --- a/app/Config/Constants.php +++ b/app/Config/Constants.php @@ -397,3 +397,10 @@ define('SERVICE_ITEM_TYPES', $_ENV['SERVICEINFO_ITEM_TYPES'] define('SERVICE_NEW_INTERVAL', $_ENV['SERVICE_NEW_INTERVAL'] ?? $_SERVER['SERVICE_NEW_INTERVAL'] ?? 7); //미지급 Item_type define('SERVICE_UNPAID_ITEM_TYPE', $_ENV['SERVICE_UNPAID_ITEM_TYPE'] ?? $_SERVER['SERVICE_UNPAID_ITEM_TYPE'] ?? "SERVER"); +define( + 'SITE_PREFIX', + [ + 'Client' => $_ENV['PREFIX_Client'] ?? $_SERVER['PREFIX_Client'] ?? 'C', + 'Service' => $_ENV['PREFIX_Service'] ?? $_SERVER['PREFIX_Service'] ?? 'S' + ], +); diff --git a/app/Models/Customer/ClientModel.php b/app/Models/Customer/ClientModel.php index ea81ed5..f947fbd 100644 --- a/app/Models/Customer/ClientModel.php +++ b/app/Models/Customer/ClientModel.php @@ -58,4 +58,12 @@ class ClientModel extends CustomerModel } return $rule; } + + protected function create_process(array $formDatas): ClientEntity + { + $entity = parent::create_process($formDatas); + // 생성 후, 추가 작업이 필요할 경우 여기에 작성 + $formDatas = ['code' => SITE_PREFIX['Client'] . $entity->getPK()]; + return $this->modify($entity, $formDatas); + } } diff --git a/app/Models/Customer/ServiceModel.php b/app/Models/Customer/ServiceModel.php index d224879..672eb5b 100644 --- a/app/Models/Customer/ServiceModel.php +++ b/app/Models/Customer/ServiceModel.php @@ -69,7 +69,8 @@ class ServiceModel extends CustomerModel protected function create_process(array $formDatas): ServiceEntity { $entity = parent::create_process($formDatas); - //고객코드 Code 자동 생성 후(timestamp값) 수정 - return $this->modify($entity, ['code' => 'S' . time()]); + // 생성 후, 추가 작업이 필요할 경우 여기에 작성 + $formDatas = ['code' => SITE_PREFIX['Service'] . time()]; + return $this->modify($entity, $formDatas); } } diff --git a/app/Services/CommonService.php b/app/Services/CommonService.php index 477c74f..581343f 100644 --- a/app/Services/CommonService.php +++ b/app/Services/CommonService.php @@ -75,7 +75,7 @@ abstract class CommonService throw new \Exception($message); } } - protected function findAllDatas(array $columns = ['*']): mixed + protected function findAllDatas_process(array $columns = ['*']): mixed { return $this->getModel()->select(implode(',', $columns))->findAll(); } @@ -86,7 +86,7 @@ abstract class CommonService $this->getModel()->where($where); } $entities = []; - foreach ($this->findAllDatas($columns) as $entity) { + foreach ($this->findAllDatas_process($columns) as $entity) { $entities[$entity->getPK()] = $entity; } return $entities; diff --git a/app/Services/Customer/ClientService.php b/app/Services/Customer/ClientService.php index 031d003..cf5d5fb 100644 --- a/app/Services/Customer/ClientService.php +++ b/app/Services/Customer/ClientService.php @@ -132,4 +132,10 @@ class ClientService extends CustomerService $this->getModel()->orLike($this->getModel()->getTable() . '.email', $word, 'both'); parent::setList_WordFilter($word); } + //OrderBy 처리 + public function setOrderBy(mixed $field = null, mixed $value = null): void + { + $this->getModel()->orderBy("name", 'ASC'); + parent::setOrderBy($field, $value); + } } diff --git a/app/Services/Customer/ServiceService.php b/app/Services/Customer/ServiceService.php index d2b72d2..5368ada 100644 --- a/app/Services/Customer/ServiceService.php +++ b/app/Services/Customer/ServiceService.php @@ -95,7 +95,7 @@ class ServiceService extends CustomerService { return $this->_searchIP; } - protected function findAllDatas(array $columns = ['*']): mixed + protected function findAllDatas_process(array $columns = ['*']): mixed { $ip = $this->getSearchIp(); if ($ip) { @@ -105,7 +105,7 @@ class ServiceService extends CustomerService AND serviceinfo_items.item_uid IN (SELECT uid FROM ipinfo WHERE ip = ?)"; return $this->getModel()->query($sql, ['IP', $ip])->getResult(ServiceEntity::class); } - return parent::findAllDatas($columns); + return parent::findAllDatas_process($columns); } //기본 기능부분 //FieldForm관련용