dbmsv2 init...1

This commit is contained in:
choi.jh 2025-08-18 14:55:18 +09:00
parent 20a41ad317
commit 631093b171
92 changed files with 6115 additions and 3082 deletions

View File

@ -67,19 +67,6 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au
$routes->post('batchjob_delete', 'ClientController::batchjob_delete');
$routes->get('download/(:alpha)', 'ClientController::download/$1');
});
$routes->group('clienthistory', ['namespace' => 'App\Controllers\Admin\Customer'], function ($routes) {
$routes->get('/', 'ClientHistoryController::index');
$routes->get('create', 'ClientHistoryController::create_form');
$routes->post('create', 'ClientHistoryController::create');
$routes->get('modify/(:num)', 'ClientHistoryController::modify_form/$1');
$routes->post('modify/(:num)', 'ClientHistoryController::modify/$1');
$routes->get('view/(:num)', 'ClientHistoryController::view/$1');
$routes->get('delete/(:num)', 'ClientHistoryController::delete/$1');
$routes->get('toggle/(:num)/(:any)', 'ClientHistoryController::toggle/$1/$2');
$routes->post('batchjob', 'ClientHistoryController::batchjob');
$routes->post('batchjob_delete', 'ClientHistoryController::batchjob_delete');
$routes->get('download/(:alpha)', 'ClientHistoryController::download/$1');
});
$routes->group('account', ['namespace' => 'App\Controllers\Admin\Customer'], function ($routes) {
$routes->get('/', 'AccountController::index');
$routes->get('create', 'AccountController::create_form');
@ -145,19 +132,6 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au
$routes->post('batchjob_delete', 'ServiceItemController::batchjob_delete');
$routes->get('download/(:alpha)', 'ServiceItemController::download/$1');
});
$routes->group('servicehistory', ['namespace' => 'App\Controllers\Admin\Customer'], function ($routes) {
$routes->get('/', 'ServiceHistoryController::index');
$routes->get('create', 'ServiceHistoryController::create_form');
$routes->post('create', 'ServiceHistoryController::create');
$routes->get('modify/(:num)', 'ServiceHistoryController::modify_form/$1');
$routes->post('modify/(:num)', 'ServiceHistoryController::modify/$1');
$routes->get('view/(:num)', 'ServiceHistoryController::view/$1');
$routes->get('delete/(:num)', 'ServiceHistoryController::delete/$1');
$routes->get('toggle/(:num)/(:any)', 'ServiceHistoryController::toggle/$1/$2');
$routes->post('batchjob', 'ServiceHistoryController::batchjob');
$routes->post('batchjob_delete', 'ServiceHistoryController::batchjob_delete');
$routes->get('download/(:alpha)', 'ServiceHistoryController::download/$1');
});
$routes->group('payment', ['namespace' => 'App\Controllers\Admin\Customer'], function ($routes) {
$routes->get('/', 'ServicePaymentController::index');
$routes->get('create', 'ServicePaymentController::create_form');
@ -187,19 +161,6 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au
$routes->post('batchjob_delete', 'SwitchController::batchjob_delete');
$routes->get('download/(:alpha)', 'SwitchController::download/$1');
});
$routes->group('code', ['namespace' => 'App\Controllers\Admin\Equipment'], function ($routes) {
$routes->get('/', 'CodeController::index');
$routes->get('create', 'CodeController::create_form');
$routes->post('create', 'CodeController::create');
$routes->get('modify/(:alphanum)', 'CodeController::modify_form/$1');
$routes->post('modify/(:alphanum)', 'CodeController::modify/$1');
$routes->get('view/(:alphanum)', 'CodeController::view/$1');
$routes->get('delete/(:alphanum)', 'CodeController::delete/$1');
$routes->get('toggle/(:alphanum)/(:any)', 'CodeController::toggle/$1/$2');
$routes->post('batchjob', 'CodeController::batchjob');
$routes->post('batchjob_delete', 'CodeController::batchjob_delete');
$routes->get('download/(:alpha)', 'CodeController::download/$1');
});
$routes->group('server', ['namespace' => 'App\Controllers\Admin\Equipment'], function ($routes) {
$routes->get('/', 'ServerController::index');
$routes->get('create', 'ServerController::create_form');

View File

@ -2,6 +2,8 @@
namespace Config;
use App\Models\UserModel;
use App\Services\Auth\LocalService;
use CodeIgniter\Config\BaseService;
/**
@ -29,4 +31,13 @@ class Services extends BaseService
* return new \CodeIgniter\Example();
* }
*/
public static function myauth($getShared = true): LocalService
{
if ($getShared) {
return static::getSharedInstance('myauth');
} else {
return new LocalService(new UserModel());
}
}
}

View File

@ -1,53 +0,0 @@
<?php
namespace App\Controllers\Admin\Customer;
use CodeIgniter\HTTP\RedirectResponse;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
use App\Helpers\Customer\ClientHistoryHelper;
use App\Services\Customer\ClientHistoryService;
class ClientHistoryController extends CustomerController
{
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
$this->content_title = lang("{$this->getService()->getClassName()}.title");
$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(): ClientHistoryService
{
if (!$this->_service) {
$this->_service = new ClientHistoryService();
}
return $this->_service;
}
public function getHelper(): ClientHistoryHelper
{
if (!$this->_helper) {
$this->_helper = new ClientHistoryHelper();
}
return $this->_helper;
}
protected function getResultSuccess(string $message = MESSAGES["SUCCESS"], ?string $actionTemplate = null): RedirectResponse|string
{
switch ($this->getAction()) {
case 'index':
$result = parent::getResultSuccess($message, $this->request->getVar('ActionTemplate') ?? $actionTemplate ?? 'popup');
break;
default:
$result = parent::getResultSuccess($message, $actionTemplate);
break;
}
return $result;
}
//Index,FieldForm관련
}

View File

@ -1,53 +0,0 @@
<?php
namespace App\Controllers\Admin\Customer;
use CodeIgniter\HTTP\RedirectResponse;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
use App\Helpers\Customer\ServiceHistoryHelper;
use App\Services\Customer\ServiceHistoryService;
class ServiceHistoryController extends CustomerController
{
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
$this->content_title = lang("{$this->getService()->getClassName()}.title");
$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(): ServiceHistoryService
{
if (!$this->_service) {
$this->_service = new ServiceHistoryService();
}
return $this->_service;
}
public function getHelper(): ServiceHistoryHelper
{
if (!$this->_helper) {
$this->_helper = new ServiceHistoryHelper();
}
return $this->_helper;
}
protected function getResultSuccess(string $message = MESSAGES["SUCCESS"], ?string $actionTemplate = null): RedirectResponse|string
{
switch ($this->getAction()) {
case 'index':
$result = parent::getResultSuccess($message, $this->request->getVar('ActionTemplate') ?? $actionTemplate ?? 'popup');
break;
default:
$result = parent::getResultSuccess($message, $actionTemplate);
break;
}
return $result;
}
//Index,FieldForm관련
}

View File

@ -1,38 +0,0 @@
<?php
namespace App\Controllers\Admin\Equipment;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
use App\Helpers\Equipment\CodeHelper;
use App\Services\Equipment\CodeService;
class CodeController extends EquipmentController
{
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
$this->content_title = lang("{$this->getService()->getClassName()}.title");
$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(): CodeService
{
if (!$this->_service) {
$this->_service = new CodeService();
}
return $this->_service;
}
public function getHelper(): CodeHelper
{
if (!$this->_helper) {
$this->_helper = new CodeHelper();
}
return $this->_helper;
}
//Index,FieldForm관련
}

View File

@ -0,0 +1,190 @@
<?php
namespace App\Controllers\Admin\Customer;
use App\Entities\Customer\ClientEntity;
use App\Entities\Customer\ServiceEntity;
use App\Entities\Customer\ServicePaymentEntity;
use App\Helpers\Customer\ServicePaymentHelper;
use App\Libraries\LogCollector;
use App\Services\Customer\ServicePaymentService;
use App\Services\Customer\ClientService;
use CodeIgniter\HTTP\RedirectResponse;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
class ServicePaymentController extends CustomerController
{
private ?ClientService $_clientService = null;
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
$this->content_title = lang("{$this->getService()->getClassName()}.title");
$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
{
if (!$this->_service) {
$this->_service = new ServicePaymentService();
}
return $this->_service;
}
public function getHelper(): ServicePaymentHelper
{
if (!$this->_helper) {
$this->_helper = new ServicePaymentHelper();
}
return $this->_helper;
}
public function getClientService(): ClientService
{
if (!$this->_clientService) {
$this->_clientService = new ClientService();
}
return $this->_clientService;
}
protected function getResultSuccess(string $message = MESSAGES["SUCCESS"], ?string $actionTemplate = null): RedirectResponse|string
{
switch ($this->getAction()) {
case 'invoice':
$this->control = $this->getControlDatas();
$this->getHelper()->setViewDatas($this->getViewDatas());
$actionTemplate = $this->request->getVar('ActionTemplate') ?? $actionTemplate ?? 'payment';
if ($actionTemplate) {
$view_file = $this->view_path . $actionTemplate . DIRECTORY_SEPARATOR . $this->getAction();
} else {
$view_file = $this->view_path . $this->getAction();
}
$result = view($view_file, ['viewDatas' => $this->getViewDatas()]);
break;
default:
$result = parent::getResultSuccess($message, $actionTemplate);
break;
}
return $result;
}
//Index,FieldForm관련
//생성관련
protected function create_process(array $formDatas): void
{
// 관리자 UID는 현재 인증된 사용자로 설정
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
parent::create_process($formDatas);
}
//수정관련
protected function modify_process(mixed $entity, array $formDatas): void
{
// 관리자 UID는 현재 인증된 사용자로 설정
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
parent::modify_process($entity, $formDatas);
}
//View 관련
protected function view_process(mixed $entity): void
{
//LINE,IP,SERVER등 추가 FilterOption 셋팅용
$this->setFilterOptionsByItemType();
//부모처리
parent::view_process($entity);
}
//List 관련
protected function index_process(): void
{
//LINE,IP,SERVER등 추가 FilterOption 셋팅용
$this->setFilterOptionsByItemType();
//부모처리
parent::index_process();
}
//Invoice 관련
private function getOwnersForInvoice(ClientEntity $ownerEntity): array
{
$temps = [
'name' => $ownerEntity->getName(),
'total_amount' => 0,
'services' => []
];
return $temps;
}
private function getServicesForInvoice(ServiceEntity $serviceEntity): array
{
$temps = [
'code' => $serviceEntity->getTitle(),
'billing_at' => $serviceEntity->getBillingAt(),
'items' => []
];
return $temps;
}
private function getItemsForInvoice(ServicePaymentEntity $entity): array
{
$partEntites = $this->getFilterFieldOption($entity->getItemType());
// dd($partEntites);
$temps = [
'item_type' => SERVICE_ITEM_TYPES[$entity->getItemType()],
'item_uid' => $partEntites[$entity->getItemUid()]->getTitle(),
'amount' => $entity->getAmount()
];
return $temps;
}
private function invoice_process(): void
{
//변경할 UIDS
$uids = $this->request->getPost('batchjob_uids[]');
if (!is_array($uids) || !count($uids)) {
throw new \Exception("청구서에 적용될 리스트를 선택하셔야합니다.");
}
$owner_pk = false;
$entities = [];
foreach ($uids as $uid) {
//기존 Entity 가져오기
$entity = $this->getService()->getEntity($uid);
if (!$entity) {
LogCollector::debug(__METHOD__ . "에서 {$uid}에 대한 결제정보를 찾을수 없습니다.");
}
//entities에 관리자 설정
$ownerEntity = $this->getClientService()->getEntity($entity->getOwnerUID());
if (!$ownerEntity) {
LogCollector::debug(__METHOD__ . "에서 {$entity->getOwnerUID()}에 대한 관라자정보를 찾을수 없습니다.");
}
if ($ownerEntity->getPK() !== $owner_pk) {
if (!array_key_exists($ownerEntity->getPK(), $entities)) {
$entities[$ownerEntity->getPK()] = $this->getOwnersForInvoice($ownerEntity);
}
$owner_pk = $ownerEntity->getPK();
}
//entities에 서비스 설정
$serviceEntity = $this->getServiceService()->getEntity($entity->getServiceUid());
if (!$serviceEntity) {
LogCollector::debug(__METHOD__ . "에서 {$entity->getServiceUid()}에 대한 서비스정보를 찾을수 없습니다.");
}
if (!array_key_exists($serviceEntity->getPK(), $entities[$owner_pk]['services'])) {
$entities[$owner_pk]['services'][$serviceEntity->getPK()] = $this->getServicesForInvoice($serviceEntity);
}
//entities에 서비스 Item Type,Item 설정
if (!array_key_exists($entity->getPK(), $entities[$owner_pk]['services'][$serviceEntity->getPK()])) {
$entities[$owner_pk]['services'][$serviceEntity->getPK()]['items'][] = $this->getItemsForInvoice($entity);
}
//entities에 총 결제금액 설정
$entities[$ownerEntity->getPK()]['total_amount'] += $entity->getAmount();
}
// dd($entities);
$this->entities = $entities;
}
public function invoice(): RedirectResponse|string
{
try {
$this->initAction(__FUNCTION__);
//LINE,IP,SERVER등 추가 FilterOption 셋팅용
foreach (SERVICE_ITEM_TYPES as $item_type => $label) {
$this->setFilterFieldOption($item_type, $this->getServiceService()->getFilterOptionsByItemType($item_type));
}
$this->invoice_process();
return $this->getResultSuccess();
} catch (\Exception $e) {
return $this->getResultFail($e->getMessage());
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -15,6 +15,492 @@
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `accountinfo`
--
DROP TABLE IF EXISTS `accountinfo`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `accountinfo` (
`uid` int(11) NOT NULL AUTO_INCREMENT,
`userinfo_uid` int(11) NOT NULL COMMENT '관리자정보',
`clientinfo_code` varchar(20) NOT NULL COMMENT '고객코드',
`bank` int(11) NOT NULL COMMENT '은행',
`title` varchar(255) NOT NULL COMMENT '사유',
`alias` varchar(50) NOT NULL COMMENT '입출금자명',
`issue_at` date NOT NULL COMMENT '입출금일자',
`amount` int(11) NOT NULL DEFAULT 0 COMMENT '압출금액',
`status` varchar(20) NOT NULL DEFAULT 'default',
`updated_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
`deleted_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`uid`),
KEY `FK_user_TO_accountinfo` (`userinfo_uid`),
KEY `FK_clientinfo_TO_accountinfo` (`clientinfo_code`),
CONSTRAINT `FK_clientinfo_TO_accountinfo` FOREIGN KEY (`clientinfo_code`) REFERENCES `clientinfo` (`code`),
CONSTRAINT `FK_user_TO_accountinfo` FOREIGN KEY (`userinfo_uid`) REFERENCES `user` (`uid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='예치금계좌';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `accountinfo`
--
LOCK TABLES `accountinfo` WRITE;
/*!40000 ALTER TABLE `accountinfo` DISABLE KEYS */;
/*!40000 ALTER TABLE `accountinfo` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `clientinfo`
--
DROP TABLE IF EXISTS `clientinfo`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `clientinfo` (
`code` varchar(20) NOT NULL COMMENT '고객코드',
`user_uid` int(11) NOT NULL COMMENT '관리자정보',
`role` varchar(50) NOT NULL DEFAULT 'user',
`name` varchar(100) NOT NULL,
`phone` varchar(50) DEFAULT NULL,
`email` varchar(50) NOT NULL,
`history` text DEFAULT NULL COMMENT 'history',
`account_balance` int(11) NOT NULL DEFAULT 0 COMMENT '예치금',
`coupon_balance` int(11) NOT NULL DEFAULT 0 COMMENT '쿠폰수',
`point_balance` int(11) NOT NULL DEFAULT 0 COMMENT '포인트',
`status` varchar(20) NOT NULL DEFAULT 'default',
`updated_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
`deleted_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`code`),
UNIQUE KEY `UQ_name` (`name`),
KEY `FK_user_TO_clientinfo` (`user_uid`),
CONSTRAINT `FK_user_TO_clientinfo` FOREIGN KEY (`user_uid`) REFERENCES `user` (`uid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='고객정보';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `clientinfo`
--
LOCK TABLES `clientinfo` WRITE;
/*!40000 ALTER TABLE `clientinfo` DISABLE KEYS */;
/*!40000 ALTER TABLE `clientinfo` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `couponinfo`
--
DROP TABLE IF EXISTS `couponinfo`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `couponinfo` (
`uid` int(11) NOT NULL AUTO_INCREMENT,
`userinfo_uid` int(11) NOT NULL COMMENT '관리자정보',
`clientinfo_code` varchar(20) NOT NULL COMMENT '고객코드',
`title` varchar(255) NOT NULL,
`cnt` int(11) NOT NULL DEFAULT 0 COMMENT '갯수',
`status` varchar(20) NOT NULL DEFAULT 'default',
`updated_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
`deleted_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`uid`),
KEY `FK_user_TO_couponinfo` (`userinfo_uid`),
KEY `FK_clientinfo_TO_couponinfo` (`clientinfo_code`),
CONSTRAINT `FK_clientinfo_TO_couponinfo` FOREIGN KEY (`clientinfo_code`) REFERENCES `clientinfo` (`code`),
CONSTRAINT `FK_user_TO_couponinfo` FOREIGN KEY (`userinfo_uid`) REFERENCES `user` (`uid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='쿠폰정보';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `couponinfo`
--
LOCK TABLES `couponinfo` WRITE;
/*!40000 ALTER TABLE `couponinfo` DISABLE KEYS */;
/*!40000 ALTER TABLE `couponinfo` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `csinfo`
--
DROP TABLE IF EXISTS `csinfo`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `csinfo` (
`uid` int(11) NOT NULL AUTO_INCREMENT,
`serverinfo_code` varchar(20) DEFAULT NULL COMMENT '서버코드',
`type` varchar(20) NOT NULL COMMENT '구분(KCS,VCS)',
`ip` varchar(50) NOT NULL,
`accountid` varchar(50) DEFAULT NULL,
`domain` varchar(100) DEFAULT NULL,
`price` int(11) NOT NULL DEFAULT 0 COMMENT '기본금액',
`amount` int(11) NOT NULL DEFAULT 0 COMMENT '서비스금액',
`status` varchar(20) NOT NULL DEFAULT 'default',
`updated_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
`deleted_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`uid`),
UNIQUE KEY `UQ_ip` (`ip`),
KEY `FK_serverinfo_TO_csinfo` (`serverinfo_code`),
CONSTRAINT `FK_serverinfo_TO_csinfo` FOREIGN KEY (`serverinfo_code`) REFERENCES `serverinfo` (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='CS정보(한서버 여러개 앞단 등록가능)';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `csinfo`
--
LOCK TABLES `csinfo` WRITE;
/*!40000 ALTER TABLE `csinfo` DISABLE KEYS */;
/*!40000 ALTER TABLE `csinfo` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `ipinfo`
--
DROP TABLE IF EXISTS `ipinfo`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ipinfo` (
`uid` int(11) NOT NULL AUTO_INCREMENT,
`lineinfo_uid` int(11) NOT NULL COMMENT '회선정보',
`serverinfo_code` varchar(20) DEFAULT NULL COMMENT '서버코드',
`ip` char(16) NOT NULL,
`price` int(11) NOT NULL DEFAULT 0 COMMENT '기본금액',
`amount` int(11) NOT NULL DEFAULT 0 COMMENT '서비스금액',
`status` varchar(20) NOT NULL DEFAULT 'default',
`updated_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
`deleted_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`uid`),
UNIQUE KEY `UQ_ip` (`ip`),
KEY `FK_lineinfo_TO_ipinfo` (`lineinfo_uid`),
KEY `FK_serverinfo_TO_ipinfo` (`serverinfo_code`),
CONSTRAINT `FK_lineinfo_TO_ipinfo` FOREIGN KEY (`lineinfo_uid`) REFERENCES `lineinfo` (`uid`),
CONSTRAINT `FK_serverinfo_TO_ipinfo` FOREIGN KEY (`serverinfo_code`) REFERENCES `serverinfo` (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT=' IP 정보';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `ipinfo`
--
LOCK TABLES `ipinfo` WRITE;
/*!40000 ALTER TABLE `ipinfo` DISABLE KEYS */;
/*!40000 ALTER TABLE `ipinfo` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `lineinfo`
--
DROP TABLE IF EXISTS `lineinfo`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `lineinfo` (
`uid` int(11) NOT NULL AUTO_INCREMENT,
`type` varchar(20) NOT NULL COMMENT '회선구분',
`title` varchar(100) NOT NULL,
`bandwith` varchar(20) NOT NULL COMMENT 'IP 대역',
`start_at` date DEFAULT NULL COMMENT '개통일',
`status` varchar(20) NOT NULL DEFAULT 'default',
`updated_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
`deleted_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`uid`),
UNIQUE KEY `UQ_title` (`title`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='회선 정보';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `lineinfo`
--
LOCK TABLES `lineinfo` WRITE;
/*!40000 ALTER TABLE `lineinfo` DISABLE KEYS */;
/*!40000 ALTER TABLE `lineinfo` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `partinfo`
--
DROP TABLE IF EXISTS `partinfo`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `partinfo` (
`uid` int(11) NOT NULL AUTO_INCREMENT,
`type` enum('CPU','RAM','DISK','SOFTWARE') NOT NULL COMMENT '형식',
`title` varchar(50) NOT NULL,
`price` int(11) NOT NULL DEFAULT 0 COMMENT '기본금액',
`status` varchar(20) NOT NULL DEFAULT 'default',
`updated_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
`deleted_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`uid`),
UNIQUE KEY `UQ_title` (`title`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='PART정보';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `partinfo`
--
LOCK TABLES `partinfo` WRITE;
/*!40000 ALTER TABLE `partinfo` DISABLE KEYS */;
/*!40000 ALTER TABLE `partinfo` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `payment_month`
--
DROP TABLE IF EXISTS `payment_month`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `payment_month` (
`uid` int(11) NOT NULL AUTO_INCREMENT,
`user_uid` int(11) NOT NULL COMMENT '관리자정보(결제처리자)',
`clientinfo_code` varchar(20) NOT NULL COMMENT '고객코드',
`serviceinfo_coide` varchar(20) NOT NULL COMMENT '서비스코드',
`amount` int(11) NOT NULL DEFAULT 0 COMMENT '청구금액',
`billing_at` date DEFAULT NULL COMMENT '지급기한일',
`pay_method` varchar(20) DEFAULT NULL COMMENT '자뷸방법(ACCOUNT,COUPON)',
`status` varchar(20) NOT NULL DEFAULT 'default' COMMENT '상태(PAID,UNPAID)',
`updated_at` timestamp NULL DEFAULT NULL COMMENT '지불처리일',
`created_at` timestamp NOT NULL DEFAULT current_timestamp() COMMENT '청구발행일',
`deleted_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`uid`),
KEY `FK_user_TO_payment_month` (`user_uid`),
KEY `FK_serviceinfo_TO_payment_month` (`serviceinfo_coide`),
KEY `FK_clientinfo_TO_payment_month` (`clientinfo_code`),
CONSTRAINT `FK_clientinfo_TO_payment_month` FOREIGN KEY (`clientinfo_code`) REFERENCES `clientinfo` (`code`),
CONSTRAINT `FK_serviceinfo_TO_payment_month` FOREIGN KEY (`serviceinfo_coide`) REFERENCES `serviceinfo` (`code`),
CONSTRAINT `FK_user_TO_payment_month` FOREIGN KEY (`user_uid`) REFERENCES `user` (`uid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='월별결제정보';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `payment_month`
--
LOCK TABLES `payment_month` WRITE;
/*!40000 ALTER TABLE `payment_month` DISABLE KEYS */;
/*!40000 ALTER TABLE `payment_month` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `payment_onetime`
--
DROP TABLE IF EXISTS `payment_onetime`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `payment_onetime` (
`uid` int(11) NOT NULL AUTO_INCREMENT,
`user_uid` int(11) NOT NULL COMMENT '관리자정보(결제처리자)',
`clientinfo_code` varchar(20) NOT NULL COMMENT '고객코드',
`serviceinfo_code` varchar(20) NOT NULL COMMENT '서비스코드',
`title` varchar(50) DEFAULT NULL COMMENT '일회성 제목(제품명)',
`amount` int(11) NOT NULL DEFAULT 0 COMMENT '청구금액',
`pay_method` varchar(20) DEFAULT NULL COMMENT '지불방법(ACCOUNT,COUPON)',
`status` varchar(20) NOT NULL DEFAULT 'default' COMMENT '상태(PAID,UNPAID)',
`updated_at` timestamp NULL DEFAULT NULL COMMENT '지불처리일',
`created_at` timestamp NOT NULL DEFAULT current_timestamp() COMMENT '청구발행일(지불기한일)',
`deleted_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`uid`),
KEY `FK_user_TO_payment_onetime` (`user_uid`),
KEY `FK_serviceinfo_TO_payment_onetime` (`serviceinfo_code`),
KEY `FK_clientinfo_TO_payment_onetime` (`clientinfo_code`),
CONSTRAINT `FK_clientinfo_TO_payment_onetime` FOREIGN KEY (`clientinfo_code`) REFERENCES `clientinfo` (`code`),
CONSTRAINT `FK_serviceinfo_TO_payment_onetime` FOREIGN KEY (`serviceinfo_code`) REFERENCES `serviceinfo` (`code`),
CONSTRAINT `FK_user_TO_payment_onetime` FOREIGN KEY (`user_uid`) REFERENCES `user` (`uid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='일회성결제정보';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `payment_onetime`
--
LOCK TABLES `payment_onetime` WRITE;
/*!40000 ALTER TABLE `payment_onetime` DISABLE KEYS */;
/*!40000 ALTER TABLE `payment_onetime` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `pointinfo`
--
DROP TABLE IF EXISTS `pointinfo`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `pointinfo` (
`uid` int(11) NOT NULL AUTO_INCREMENT,
`userinfo_uid` int(11) NOT NULL COMMENT '관리자정보',
`clientinfo_code` varchar(20) NOT NULL COMMENT '고객코드',
`title` varchar(255) NOT NULL,
`amount` int(11) NOT NULL DEFAULT 0 COMMENT '포인트액',
`status` varchar(20) NOT NULL DEFAULT 'default',
`updated_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
`deleted_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`uid`),
KEY `FK_user_TO_pointinfo` (`userinfo_uid`),
KEY `FK_clientinfo_TO_pointinfo` (`clientinfo_code`),
CONSTRAINT `FK_clientinfo_TO_pointinfo` FOREIGN KEY (`clientinfo_code`) REFERENCES `clientinfo` (`code`),
CONSTRAINT `FK_user_TO_pointinfo` FOREIGN KEY (`userinfo_uid`) REFERENCES `user` (`uid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='포인트정보';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `pointinfo`
--
LOCK TABLES `pointinfo` WRITE;
/*!40000 ALTER TABLE `pointinfo` DISABLE KEYS */;
/*!40000 ALTER TABLE `pointinfo` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `serverinfo`
--
DROP TABLE IF EXISTS `serverinfo`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `serverinfo` (
`code` varchar(20) NOT NULL COMMENT '서버코드',
`serviceinfo_code` varchar(20) DEFAULT NULL COMMENT '서비스코드',
`title` varchar(50) NOT NULL,
`price` int(11) NOT NULL DEFAULT 0 COMMENT '기본금액',
`amount` int(11) NOT NULL DEFAULT 0 COMMENT '서비스금액',
`status` varchar(20) NOT NULL DEFAULT 'default',
`manufactur_at` timestamp NOT NULL DEFAULT current_timestamp() COMMENT '제조일',
`updated_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
`deleted_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`code`),
KEY `FK_serviceinfo_TO_serverinfo` (`serviceinfo_code`),
CONSTRAINT `FK_serviceinfo_TO_serverinfo` FOREIGN KEY (`serviceinfo_code`) REFERENCES `serviceinfo` (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='서버정보';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `serverinfo`
--
LOCK TABLES `serverinfo` WRITE;
/*!40000 ALTER TABLE `serverinfo` DISABLE KEYS */;
/*!40000 ALTER TABLE `serverinfo` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `serverinfo_partinfo`
--
DROP TABLE IF EXISTS `serverinfo_partinfo`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `serverinfo_partinfo` (
`uid` int(11) NOT NULL AUTO_INCREMENT,
`serverinfo_code` varchar(20) NOT NULL COMMENT '서버코드',
`partinfo_uid` int(11) NOT NULL COMMENT 'part정보',
`cnt` tinyint(4) NOT NULL DEFAULT 1 COMMENT 'cpu 갯수',
`amount` int(11) NOT NULL DEFAULT 0 COMMENT '서비스금액',
`extra` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '추가정보(RAID등)',
`updated_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
PRIMARY KEY (`uid`),
KEY `FK_serverinfo_TO_serverinfo_partinfo` (`serverinfo_code`),
KEY `FK_partinfo_TO_serverinfo_partinfo` (`partinfo_uid`),
CONSTRAINT `FK_partinfo_TO_serverinfo_partinfo` FOREIGN KEY (`partinfo_uid`) REFERENCES `partinfo` (`uid`),
CONSTRAINT `FK_serverinfo_TO_serverinfo_partinfo` FOREIGN KEY (`serverinfo_code`) REFERENCES `serverinfo` (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='서버정보_part정보(CASECADE)';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `serverinfo_partinfo`
--
LOCK TABLES `serverinfo_partinfo` WRITE;
/*!40000 ALTER TABLE `serverinfo_partinfo` DISABLE KEYS */;
/*!40000 ALTER TABLE `serverinfo_partinfo` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `serviceinfo`
--
DROP TABLE IF EXISTS `serviceinfo`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `serviceinfo` (
`code` varchar(20) NOT NULL COMMENT '서비스코드',
`user_uid` int(11) NOT NULL COMMENT '관리자정보',
`clientinfo_code` varchar(20) NOT NULL COMMENT '고객코드',
`type` varchar(20) NOT NULL COMMENT '서비스형식((일발, 방어,전용,VPN,대체,,테스트,자사,코로케이션)',
`location` varchar(20) DEFAULT NULL COMMENT '지역코드(chiba,tokyo,3center)',
`billing_at` date NOT NULL COMMENT '청구일',
`start_at` date NOT NULL COMMENT '시작일',
`end_at` date DEFAULT NULL COMMENT '종료일',
`amount` int(11) NOT NULL DEFAULT 0 COMMENT '서비스금액(IP+월별ITEM+CS의 서비스금액의 총합금액)',
`history` text DEFAULT NULL COMMENT 'history',
`status` varchar(20) NOT NULL DEFAULT 'default' COMMENT '상태',
`updated_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
`deleted_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`code`),
KEY `FK_user_TO_serviceinfo` (`user_uid`),
KEY `FK_clientinfo_TO_serviceinfo` (`clientinfo_code`),
CONSTRAINT `FK_clientinfo_TO_serviceinfo` FOREIGN KEY (`clientinfo_code`) REFERENCES `clientinfo` (`code`),
CONSTRAINT `FK_user_TO_serviceinfo` FOREIGN KEY (`user_uid`) REFERENCES `user` (`uid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='서비스정보';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `serviceinfo`
--
LOCK TABLES `serviceinfo` WRITE;
/*!40000 ALTER TABLE `serviceinfo` DISABLE KEYS */;
/*!40000 ALTER TABLE `serviceinfo` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `switchinfo`
--
DROP TABLE IF EXISTS `switchinfo`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `switchinfo` (
`code` varchar(20) NOT NULL COMMENT 'switch코드',
`serverinfo_code` varchar(20) DEFAULT NULL COMMENT '서버코드',
`status` varchar(20) NOT NULL DEFAULT 'default',
`updated_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
`deleted_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`code`),
KEY `FK_serverinfo_TO_switchinfo` (`serverinfo_code`),
CONSTRAINT `FK_serverinfo_TO_switchinfo` FOREIGN KEY (`serverinfo_code`) REFERENCES `serverinfo` (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='스위치정보';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `switchinfo`
--
LOCK TABLES `switchinfo` WRITE;
/*!40000 ALTER TABLE `switchinfo` DISABLE KEYS */;
/*!40000 ALTER TABLE `switchinfo` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `user`
--
@ -49,6 +535,37 @@ LOCK TABLES `user` WRITE;
INSERT INTO `user` VALUES (1,'choi.jh','$2y$10$.vl2FtwJsjMNFCJJm3ISDu7m3vBB85mZ5fRQxcfI0uK/2D1e8Xora','최준흠','choi.jh@prime-idc.jp','0434434327','manager,cloudflare,firewall,security,director,master','default','2025-08-08 01:03:54','2023-03-23 06:50:04',NULL),(2,'cho.jh','$2y$10$ot/aUXR/W1n4Q3dZA2dZCOxQrpVb2Bq31Y7xFQS3G6D1gtImmyBjm','조준희','cho.jh@prime-idc.jp','','manager,cloudflare,security','default','2025-08-08 01:03:41','2023-03-24 02:20:48',NULL),(4,'kimdy','$2y$10$18uyn94xdprzAnt.oYZ5weAvb8rRLhkz/SdQrjEK7yuGhCr9PlUCC','김동윤','kimdy@prime-idc.jp',NULL,'manager,cloudflare,security','default','2025-06-24 01:10:17','2023-03-24 02:21:50',NULL),(5,'kimhy','$2y$10$.yEKVqY.F7HoSOZijl4uyeulUtfAQ4EDRiyR2JpgFYBuKw.mZoZvG','김효영','khy@prime-idc.jp',NULL,'manager,security,director','default','2025-06-24 01:11:41','2023-03-24 02:23:18',NULL),(6,'kim.eh','$2y$10$YmwicI.Br4XNyGamfRADMOu.qlkwKd2fmnNkL7YIkNHGndvqYPnCq','김은혁','kim.eh@prime-idc.jp',NULL,'manager,cloudflare,security','default','2025-06-24 01:09:38','2023-03-24 02:23:52',NULL),(7,'leeph','$2y$10$lR739WzJsW6rDLgchYs7buek4BYeTlKHTQY60RDqRms9Io7RSY3AC','이풍호','leeph@prime-idc.jp',NULL,'manager,cloudflare','default','2023-05-29 16:32:52','2023-03-24 02:24:21',NULL),(8,'jinmingyu','$2y$10$PI8WA6d/z4hDE6hxJoUhbuMH3vTTWH0Ry2Z6fTLUUpwQGaE/9bEZa','김명옥','jinmingyu@idcjp.jp',NULL,'manager,cloudflare,security','default','2025-06-24 01:09:47','2023-03-24 02:25:00',NULL),(9,'kangdh','$2y$10$gu9OS2DDQQ5H.Hh61t3BSOUp87l35q.xsduVSxvCcn8IgA4jrATgG','강동헌','kang.dh@idcjp.jp','','manager,cloudflare,security','default','2025-08-08 01:06:54','2023-03-24 02:25:48',NULL),(10,'yoohs','$2y$10$TGASk98FuZ6Ux6FDquu1aO3rztA01MCle/Vs1.3iaEMQzakAbCzJy','유혜성','yoo.hs@idcjp.jp','','manager,cloudflare,security','default','2025-08-08 01:08:08','2023-03-24 02:26:31',NULL),(11,'kim.yh','$2y$10$8GciQXpKYiR3TDWQfh9JjOQAQ.YWGoOSCL0a0/w4XACO0mUgjjbWy','김영환','kim.yh@idcjp.jp','','manager,cloudflare,firewall,security','default','2025-08-08 01:08:02','2023-03-24 02:27:05',NULL),(12,'yunmuj','$2y$10$zkgwGVj2JSOVIsxLe8fePe1gvWWaCemfZMktzBlrN8oLb3CKydkZC','윤무정','yunmuj@idcjp.jp','','manager,cloudflare','default','2025-08-08 01:07:57','2023-03-24 02:27:59',NULL),(13,'kim.mt','$2y$10$3dfkA0oq4LqiJOmjbBGKe.p0Dhj/MDqjoTdw11BOPF/H2qJqnEuHO','김문태','kim.mt@idcjp.jp','','manager,cloudflare,security','default','2025-08-08 01:07:44','2023-03-24 02:28:31',NULL),(14,'shin.ms','$2y$10$.jaDkGtm/gZK3ZDF.fJUGOwMI7Zif5588X5AxSMvvk238RDI7spQ6','신민수','shin.ms@idcjp.jp',NULL,'manager,cloudflare','default','2023-03-24 02:29:00','2023-03-24 02:29:00',NULL),(15,'park.sm','$2y$10$BwMxw0uvw2tAdQ0EZQ2/hu.Q7zYu7mbuBPPRTaa14bwG3VLf0cXfu','박선미','park.sm@idcjp.jp','','manager,cloudflare,security','default','2025-08-08 01:07:33','2023-03-24 02:29:34',NULL),(24,'kobn','$2y$10$pWM/XFfSNeSng32sypbDX.WaR4UlM4EDkYKCQfFkYIOC7Ppg0nc5G','고병남','ko@prime-idc.jp',NULL,'manager,cloudflare,security','default','2025-06-24 01:10:02','2024-10-29 06:30:19',NULL),(25,'jeong.sg','$2y$10$OzH6140JztiUEs4s/VHbPOxfxubFooqwqVhGpdFG8OJCGAFXNu546','정상구','jeong.sg@prime-idc.jp','','manager,cloudflare,security','default','2025-08-08 01:07:26','2025-01-23 00:29:46',NULL),(43,'test1234','$2y$10$21wlqjmdfDlIr0vAjDzs6ubIchc1DwOG61GGkZUwY7gb9GMTxA96K','test1234','test@gmail.com','0434434327','manager,cloudflare','default','2025-07-02 08:03:20','2025-07-01 06:05:11',NULL),(44,'test233332','$2y$10$9FqxChYQ3qlbGL0dFvHsQuEl3ELiH3R5kDytQqmFa2b2i9RYpjeQy','123423422','test2333@co.kr22','2343422','manager','default','2025-07-11 07:24:04','2025-07-11 07:23:13',NULL),(45,'kim.jh','$2y$10$voCle9yFWWhGhQ0JrH46puLYySJYq6O41/BSrKxx0MHWyO8KDf97u','김준한','kim.jh@prime-idc.jp','','manager,cloudflare,security','default',NULL,'2025-08-08 02:27:49',NULL);
/*!40000 ALTER TABLE `user` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `user_history`
--
DROP TABLE IF EXISTS `user_history`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `user_history` (
`uid` int(11) NOT NULL AUTO_INCREMENT,
`user_uid` int(11) NOT NULL COMMENT '관리자정보',
`title` varchar(255) NOT NULL,
`content` text DEFAULT NULL,
`status` varchar(20) DEFAULT 'default',
`updated_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
`deleted_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`uid`),
KEY `FK_user_TO_user_history` (`user_uid`),
CONSTRAINT `FK_user_TO_user_history` FOREIGN KEY (`user_uid`) REFERENCES `user` (`uid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='작업 기록 로그';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `user_history`
--
LOCK TABLES `user_history` WRITE;
/*!40000 ALTER TABLE `user_history` DISABLE KEYS */;
/*!40000 ALTER TABLE `user_history` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
@ -59,4 +576,4 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2025-08-15 14:30:48
-- Dump completed on 2025-08-18 12:53:40

62
app/Database/user.sql Normal file
View File

@ -0,0 +1,62 @@
-- MySQL dump 10.19 Distrib 10.3.28-MariaDB, for Linux (x86_64)
--
-- Host: localhost Database: dbms
-- ------------------------------------------------------
-- Server version 10.3.28-MariaDB-log
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `user`
--
DROP TABLE IF EXISTS `user`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `user` (
`uid` int(11) NOT NULL AUTO_INCREMENT,
`id` varchar(20) NOT NULL,
`passwd` varchar(255) NOT NULL,
`name` varchar(20) NOT NULL,
`email` varchar(50) NOT NULL,
`mobile` varchar(20) DEFAULT NULL,
`role` varchar(255) DEFAULT NULL,
`status` varchar(20) DEFAULT 'default',
`updated_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
`deleted_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`uid`),
UNIQUE KEY `UQ_id` (`id`),
UNIQUE KEY `UQ_email` (`email`)
) ENGINE=InnoDB AUTO_INCREMENT=46 DEFAULT CHARSET=utf8 COMMENT='관리자정보';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `user`
--
LOCK TABLES `user` WRITE;
/*!40000 ALTER TABLE `user` DISABLE KEYS */;
INSERT INTO `user` VALUES (1,'choi.jh','$2y$10$.vl2FtwJsjMNFCJJm3ISDu7m3vBB85mZ5fRQxcfI0uK/2D1e8Xora','최준흠','choi.jh@prime-idc.jp','0434434327','manager,cloudflare,firewall,security,director,master','default','2025-08-08 01:03:54','2023-03-23 06:50:04',NULL),(2,'cho.jh','$2y$10$ot/aUXR/W1n4Q3dZA2dZCOxQrpVb2Bq31Y7xFQS3G6D1gtImmyBjm','조준희','cho.jh@prime-idc.jp','','manager,cloudflare,security','default','2025-08-08 01:03:41','2023-03-24 02:20:48',NULL),(4,'kimdy','$2y$10$18uyn94xdprzAnt.oYZ5weAvb8rRLhkz/SdQrjEK7yuGhCr9PlUCC','김동윤','kimdy@prime-idc.jp',NULL,'manager,cloudflare,security','default','2025-06-24 01:10:17','2023-03-24 02:21:50',NULL),(5,'kimhy','$2y$10$.yEKVqY.F7HoSOZijl4uyeulUtfAQ4EDRiyR2JpgFYBuKw.mZoZvG','김효영','khy@prime-idc.jp',NULL,'manager,security,director','default','2025-06-24 01:11:41','2023-03-24 02:23:18',NULL),(6,'kim.eh','$2y$10$YmwicI.Br4XNyGamfRADMOu.qlkwKd2fmnNkL7YIkNHGndvqYPnCq','김은혁','kim.eh@prime-idc.jp',NULL,'manager,cloudflare,security','default','2025-06-24 01:09:38','2023-03-24 02:23:52',NULL),(7,'leeph','$2y$10$lR739WzJsW6rDLgchYs7buek4BYeTlKHTQY60RDqRms9Io7RSY3AC','이풍호','leeph@prime-idc.jp',NULL,'manager,cloudflare','default','2023-05-29 16:32:52','2023-03-24 02:24:21',NULL),(8,'jinmingyu','$2y$10$PI8WA6d/z4hDE6hxJoUhbuMH3vTTWH0Ry2Z6fTLUUpwQGaE/9bEZa','김명옥','jinmingyu@idcjp.jp',NULL,'manager,cloudflare,security','default','2025-06-24 01:09:47','2023-03-24 02:25:00',NULL),(9,'kangdh','$2y$10$gu9OS2DDQQ5H.Hh61t3BSOUp87l35q.xsduVSxvCcn8IgA4jrATgG','강동헌','kang.dh@idcjp.jp','','manager,cloudflare,security','default','2025-08-08 01:06:54','2023-03-24 02:25:48',NULL),(10,'yoohs','$2y$10$TGASk98FuZ6Ux6FDquu1aO3rztA01MCle/Vs1.3iaEMQzakAbCzJy','유혜성','yoo.hs@idcjp.jp','','manager,cloudflare,security','default','2025-08-08 01:08:08','2023-03-24 02:26:31',NULL),(11,'kim.yh','$2y$10$8GciQXpKYiR3TDWQfh9JjOQAQ.YWGoOSCL0a0/w4XACO0mUgjjbWy','김영환','kim.yh@idcjp.jp','','manager,cloudflare,firewall,security','default','2025-08-08 01:08:02','2023-03-24 02:27:05',NULL),(12,'yunmuj','$2y$10$zkgwGVj2JSOVIsxLe8fePe1gvWWaCemfZMktzBlrN8oLb3CKydkZC','윤무정','yunmuj@idcjp.jp','','manager,cloudflare','default','2025-08-08 01:07:57','2023-03-24 02:27:59',NULL),(13,'kim.mt','$2y$10$3dfkA0oq4LqiJOmjbBGKe.p0Dhj/MDqjoTdw11BOPF/H2qJqnEuHO','김문태','kim.mt@idcjp.jp','','manager,cloudflare,security','default','2025-08-08 01:07:44','2023-03-24 02:28:31',NULL),(14,'shin.ms','$2y$10$.jaDkGtm/gZK3ZDF.fJUGOwMI7Zif5588X5AxSMvvk238RDI7spQ6','신민수','shin.ms@idcjp.jp',NULL,'manager,cloudflare','default','2023-03-24 02:29:00','2023-03-24 02:29:00',NULL),(15,'park.sm','$2y$10$BwMxw0uvw2tAdQ0EZQ2/hu.Q7zYu7mbuBPPRTaa14bwG3VLf0cXfu','박선미','park.sm@idcjp.jp','','manager,cloudflare,security','default','2025-08-08 01:07:33','2023-03-24 02:29:34',NULL),(24,'kobn','$2y$10$pWM/XFfSNeSng32sypbDX.WaR4UlM4EDkYKCQfFkYIOC7Ppg0nc5G','고병남','ko@prime-idc.jp',NULL,'manager,cloudflare,security','default','2025-06-24 01:10:02','2024-10-29 06:30:19',NULL),(25,'jeong.sg','$2y$10$OzH6140JztiUEs4s/VHbPOxfxubFooqwqVhGpdFG8OJCGAFXNu546','정상구','jeong.sg@prime-idc.jp','','manager,cloudflare,security','default','2025-08-08 01:07:26','2025-01-23 00:29:46',NULL),(43,'test1234','$2y$10$21wlqjmdfDlIr0vAjDzs6ubIchc1DwOG61GGkZUwY7gb9GMTxA96K','test1234','test@gmail.com','0434434327','manager,cloudflare','default','2025-07-02 08:03:20','2025-07-01 06:05:11',NULL),(44,'test233332','$2y$10$9FqxChYQ3qlbGL0dFvHsQuEl3ELiH3R5kDytQqmFa2b2i9RYpjeQy','123423422','test2333@co.kr22','2343422','manager','default','2025-07-11 07:24:04','2025-07-11 07:23:13',NULL),(45,'kim.jh','$2y$10$voCle9yFWWhGhQ0JrH46puLYySJYq6O41/BSrKxx0MHWyO8KDf97u','김준한','kim.jh@prime-idc.jp','','manager,cloudflare,security','default',NULL,'2025-08-08 02:27:49',NULL);
/*!40000 ALTER TABLE `user` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2025-08-14 18:16:36

View File

@ -47,6 +47,10 @@ abstract class CommonEntity extends Entity
{
return $this->attributes['created_at'];
}
public function getPrice(): string
{
return $this->attributes['price'];
}
public function getStatus(): string|null
{
return $this->attributes['status'] ?? null;

View File

@ -1,11 +0,0 @@
<?php
namespace App\Entities\Customer;
use App\Models\Customer\ClientHistoryModel;
class ClientHistoryEntity extends CustomerEntity
{
const PK = ClientHistoryModel::PK;
const TITLE = ClientHistoryModel::TITLE;
}

View File

@ -1,15 +0,0 @@
<?php
namespace App\Entities\Customer;
use App\Models\Customer\ServiceHistoryModel;
class ServiceHistoryEntity extends CustomerEntity
{
const PK = ServiceHistoryModel::PK;
const TITLE = ServiceHistoryModel::TITLE;
public function getServiceUid(): int
{
return intval($this->attributes['serviceinfo_uid']);
}
}

View File

@ -0,0 +1,14 @@
<?php
namespace App\Entities\Equipment;
use App\Models\Equipment\CSModel;
class CSEntity extends EquipmentEntity
{
const PK = CSModel::PK;
const TITLE = CSModel::TITLE;
const STATUS_AVAILABLE = "default";
const STATUS_OCCUPIED = "occupied";
const STATUS_FORBIDDEN = "forbidden";
}

View File

@ -1,18 +0,0 @@
<?php
namespace App\Entities\Equipment;
use App\Models\Equipment\CodeModel;
class CodeEntity extends EquipmentEntity
{
const PK = CodeModel::PK;
const TITLE = CodeModel::TITLE;
const STATUS_AVAILABLE = "default";
const STATUS_OCCUPIED = "occupied";
public function getCode(): string
{
return $this->attributes['code'];
}
}

View File

@ -1,8 +1,8 @@
<?php
namespace App\Entities\Equipment\Part;
namespace App\Entities\Equipment;
use App\Models\Equipment\Part\IpModel;
use App\Models\Equipment\IpModel;
class IpEntity extends PartEntity
{

View File

@ -1,11 +0,0 @@
<?php
namespace App\Entities\Equipment\Part;
use App\Models\Equipment\Part\CpuModel;
class CpuEntity extends PartEntity
{
const PK = CpuModel::PK;
const TITLE = CpuModel::TITLE;
}

View File

@ -1,11 +0,0 @@
<?php
namespace App\Entities\Equipment\Part;
use App\Models\Equipment\Part\DefenceModel;
class DefenceEntity extends PartEntity
{
const PK = DefenceModel::PK;
const TITLE = DefenceModel::TITLE;
}

View File

@ -1,18 +0,0 @@
<?php
namespace App\Entities\Equipment\Part;
use App\Models\Equipment\Part\DomainModel;
class DomainEntity extends PartEntity
{
const PK = DomainModel::PK;
const TITLE = DomainModel::TITLE;
const STATUS_AVAILABLE = "default";
const STATUS_OCCUPIED = "occupied";
const STATUS_FORBIDDEN = "forbidden";
public function getDomain(): string
{
return $this->attributes['domain'];
}
}

View File

@ -1,16 +0,0 @@
<?php
namespace App\Entities\Equipment\Part;
use App\Models\Equipment\Part\LineModel;
class LineEntity extends PartEntity
{
const PK = LineModel::PK;
const TITLE = LineModel::TITLE;
public function getBandwith()
{
return $this->attributes['bandwith'];
}
}

View File

@ -1,14 +0,0 @@
<?php
namespace App\Entities\Equipment\Part;
use App\Entities\Equipment\EquipmentEntity;
abstract class PartEntity extends EquipmentEntity
{
public function __construct(array|null $data = null)
{
parent::__construct($data);
}
}

View File

@ -1,11 +0,0 @@
<?php
namespace App\Entities\Equipment\Part;
use App\Models\Equipment\Part\RamModel;
class RamEntity extends PartEntity
{
const PK = RamModel::PK;
const TITLE = RamModel::TITLE;
}

View File

@ -1,11 +0,0 @@
<?php
namespace App\Entities\Equipment\Part;
use App\Models\Equipment\Part\SoftwareModel;
class SoftwareEntity extends PartEntity
{
const PK = SoftwareModel::PK;
const TITLE = SoftwareModel::TITLE;
}

View File

@ -1,11 +0,0 @@
<?php
namespace App\Entities\Equipment\Part;
use App\Models\Equipment\Part\StorageModel;
class StorageEntity extends PartEntity
{
const PK = StorageModel::PK;
const TITLE = StorageModel::TITLE;
}

View File

@ -0,0 +1,11 @@
<?php
namespace App\Entities\Equipment;
use App\Models\Equipment\PartModel;
class PartEntity extends EquipmentEntity
{
const PK = PartModel::PK;
const TITLE = PartModel::TITLE;
}

View File

@ -8,4 +8,11 @@ class ServerEntity extends EquipmentEntity
{
const PK = ServerModel::PK;
const TITLE = ServerModel::TITLE;
const STATUS_AVAILABLE = "default";
const STATUS_OCCUPIED = "occupied";
public function getCode(): string
{
return $this->attributes['code'];
}
}

View File

@ -0,0 +1,27 @@
<?php
namespace App\Helpers;
use App\Models\UserModel;
class AuthHelper extends CommonHelper
{
public function __construct()
{
parent::__construct();
$this->setTitleField(UserModel::TITLE);
}
public function getFieldForm(string $field, mixed $value, array $viewDatas, array $extras = []): string
{
switch ($field) {
case 'id':
case 'passwd':
$form = form_password($field, "", [...$extras]);
break;
default:
$form = parent::getFieldForm($field, $value, $viewDatas, $extras);
break;
}
return $form;
} //
}

View File

@ -0,0 +1,437 @@
<?php
namespace App\Helpers;
class CommonHelper
{
private $_myAuth = null;
private $_viewDatas = [];
private $_titleField = "";
protected function __construct() {}
final protected function getMyAuth(): mixed
{
if (!$this->_myAuth) {
$this->_myAuth = service('myauth');
}
return $this->_myAuth;
}
final public function setTitleField(string $field): void
{
$this->_titleField = $field;
}
final public function getTitleField(): string
{
if (!$this->_titleField) {
throw new \Exception("titleField가 지정되지 않았습니다.");
}
return $this->_titleField;
}
final public function setViewDatas(array $viewDatas): void
{
$this->_viewDatas = $viewDatas;
}
final public function getViewDatas(string $key)
{
if (!array_key_exists($key, $this->_viewDatas)) {
throw new \Exception("{$key}에 해당하는 ViewData가 존재하지 않습니다.");
}
return $this->_viewDatas[$key];
}
//IP관련련
final public function isDomainName(string $domain): bool
{
$pattern_validation = '/((http|https)\:\/\/)?[a-zA-Z0-9\.\/\?\:@\-_=#]+\.([a-zA-Z0-9\&\.\/\?\:@\-_=#])*/';
return preg_match($pattern_validation, $domain);
}
final public function isIPAddress(string $ip, $type = false): bool
{
switch ($type) {
case 'ipv4':
$result = filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4);
break;
case 'ipv6':
$result = filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6);
break;
case 'all':
$result = filter_var($ip, FILTER_VALIDATE_IP);
break;
default:
$result = filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE);
break;
}
return $result;
}
final function isValidCIDR(string $cidr, $type = "ipv4"): bool
{
// 형식: "IP/Prefix" 형태인지 검사
if (!preg_match('/^([0-9]{1,3}\.){3}[0-9]{1,3}\/\d{1,2}$/', $cidr)) {
return false;
}
list($ip, $prefix) = explode('/', $cidr);
// IP 유효성 검사
if (!$this->isIPAddress($ip, $type)) {
return false;
}
// Prefix는 0~32 사이인지 검사 (IPv4 기준)
$prefix = (int) $prefix;
if ($prefix < 0 || $prefix > 32) {
return false;
}
return true;
}
final public function isHostName(string $host): bool
{
$pattern_validation = '/[a-zA-Z0-9\.\/\?\:@\*\-_=#]/';
return preg_match($pattern_validation, $host);
}
final public function isMobile()
{
// Check the server headers to see if they're mobile friendly
if (isset($_SERVER["HTTP_X_WAP_PROFILE"])) {
return true;
}
// If the http_accept header supports wap then it's a mobile too
if (preg_match("/wap\.|\.wap/i", $_SERVER["HTTP_ACCEPT"])) {
return true;
}
// Still no luck? Let's have a look at the user agent on the browser. If it contains
// any of the following, it's probably a mobile device. Kappow!
if (isset($_SERVER["HTTP_USER_AGENT"])) {
$user_agents = array("midp", "j2me", "avantg", "docomo", "novarra", "palmos", "palmsource", "240x320", "opwv", "chtml", "pda", "windows\ ce", "mmp\/", "blackberry", "mib\/", "symbian", "wireless", "nokia", "hand", "mobi", "phone", "cdm", "up\.b", "audio", "SIE\-", "SEC\-", "samsung", "HTC", "mot\-", "mitsu", "sagem", "sony", "alcatel", "lg", "erics", "vx", "NEC", "philips", "mmm", "xx", "panasonic", "sharp", "wap", "sch", "rover", "pocket", "benq", "java", "pt", "pg", "vox", "amoi", "bird", "compal", "kg", "voda", "sany", "kdd", "dbt", "sendo", "sgh", "gradi", "jb", "\d\d\di", "moto");
foreach ($user_agents as $user_string) {
if (preg_match("/" . $user_string . "/i", $_SERVER["HTTP_USER_AGENT"])) {
return true;
}
}
}
// Let's NOT return "mobile" if it's an iPhone, because the iPhone can render normal pages quite well.
if (preg_match("/iphone/i", $_SERVER["HTTP_USER_AGENT"])) {
return false;
}
// None of the above? Then it's probably not a mobile device.
return false;
}
final public function alert(string $msg, $url = null)
{
$msg = preg_replace("/\r/", "\\r", $msg);
$msg = preg_replace("/\n/", "\\n", $msg);
$msg = preg_replace("/\'/", "\'", $msg);
$msg = preg_replace("/\"/", "\'", $msg);
$msg = "alert(\"{$msg}\");";
switch ($url) {
case 'close':
$msg .= "window.close();";
break;
default:
$msg .= $url ? "location.href=\"{$url}\";" : "";
break;
}
return "<script type=\"text/javascript\">{$msg}</script>";
}
final public function getRandomString($length = 10, $characters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789")
{
return substr(str_shuffle($characters), 0, $length);
}
final public function getPasswordString($length = 8)
{
return $this->getRandomString($length, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_-=+;:,.?");
}
// byte값을 알아보기 쉽게 변환
final public function getSizeForHuman($bytes)
{
$ext = array('B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB');
$unitCount = 0;
for (; $bytes > 1024; $unitCount++) {
$bytes /= 1024;
}
return floor($bytes) . $ext[$unitCount];
}
// Proxy등을 통하여 Client_IP가 알수없는경우 실제사용자의 IP를 가져오기 위한것
final public function getClientIP($clientIP = false)
{
if (isset($_SERVER['HTTP_CLIENT_IP'])) {
$clientIP = $_SERVER['HTTP_CLIENT_IP'];
} else if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$clientIP = $_SERVER['HTTP_X_FORWARDED_FOR'];
} else if (isset($_SERVER['HTTP_X_FORWARDED'])) {
$clientIP = $_SERVER['HTTP_X_FORWARDED'];
} else if (isset($_SERVER['HTTP_FORWARDED_FOR'])) {
$clientIP = $_SERVER['HTTP_FORWARDED_FOR'];
} else if (isset($_SERVER['HTTP_FORWARDED'])) {
$clientIP = $_SERVER['HTTP_FORWARDED'];
} else if (isset($_SERVER['REMOTE_ADDR'])) {
$clientIP = $_SERVER['REMOTE_ADDR'];
}
return $clientIP;
}
// (EX:192.168.1.0 -> 192.168.001.000)
final public function cidrToIpRange(string $cidr): array
{
if (!$this->isValidCIDR($cidr)) {
return []; // 유효하지 않으면 빈 배열 반환
}
list($ip, $prefix) = explode('/', $cidr);
$prefix = (int) $prefix;
$ipLong = ip2long($ip);
$netmask = ~((1 << (32 - $prefix)) - 1);
$network = $ipLong & $netmask;
$broadcast = $network | ~$netmask;
$ips = [];
// 첫 IP부터 마지막 IP까지 반복
for ($i = $network; $i <= $broadcast; $i++) {
$ips[] = long2ip($i);
}
return $ips;
}
public function getFieldLabel(string $field, string $label, array $viewDatas, array $extras = []): string
{
switch ($field) {
default:
// required가 있으면 class 추가
$extras = (strpos($viewDatas['control']['field_rules'][$field], 'required') !== false) ? ["class" => "text-danger", "required" => "", ...$extras] : $extras;
$label = form_label($label, $field, $extras);
break;
}
return $label;
}
// header.php에서 getFieldForm_Helper사용
protected function form_dropdown_disabled(string $field, mixed $value, array $formOptions, array $extras = [], mixed $disabledKey = null): string
{
// $formOptions는 필터 옵션 배열로, key는 필터 엔티티의 PK, value는 필터 엔티티 객체
$extra = "";
foreach ($extras as $option_tag => $option_value) {
$extra = sprintf(" %s=\"%s\"", $option_tag, htmlspecialchars($option_value, ENT_QUOTES, 'UTF-8'));
}
$html = sprintf("<select name=\"%s\" %s>", $field, $extra);
foreach ($formOptions as $key => $filterEntity) {
$isSelected = $key == $value ? ' selected' : '';
// disabledKey가 설정되어 있으면 해당 키를 disabled로 설정
$isDisabled = $disabledKey !== null && $filterEntity->getStatus() === $disabledKey ? ' disabled' : '';
$html .= sprintf("<option value=\"%s\"%s%s>%s</option>", $key, $isSelected, $isDisabled, $filterEntity->getTitle());
}
$html .= '</select>';
return $html;
}
public function getFieldForm(string $field, mixed $value, array $viewDatas, array $extras = []): string
{
switch ($field) {
case 'email':
$form = form_input($field, $value ?? "", ["placeholder" => "예)test@example.com", ...$extras]);
break;
case 'mobile':
case 'phone':
$form = form_input($field, $value ?? "", ["placeholder" => "예)010-0010-0010", ...$extras]);
break;
case 'role':
if (!is_array($viewDatas['control']['filter_optons'][$field])) {
throw new \Exception(__METHOD__ . "에서 {$field}의 field_options가 array형태가 아닙니다.");
}
// create, modify, create_form, modify_form일때 checkbox로 표시
if (in_array($viewDatas['control']['action'], ['create_form', 'modify_form'])) {
$forms = [];
foreach ($viewDatas['control']['filter_optons'][$field] as $key => $filterEntity) {
if ($key !== '') { // 빈값은 제외
$values = is_array($value) ? $value : explode(DEFAULTS["DELIMITER_ROLE"], $value);
//form_check에는 "class" => "form-control" 쓰면 않되거나 form-check를 써야함
$forms[] = form_checkbox("{$field}[]", $key, in_array($key, $values)) . $filterEntity->getTitle();
}
}
$form = implode(" ", $forms);
} else {
$form = $this->form_dropdown_disabled($field, $value, $viewDatas['control']['filter_optons'][$field], $extras);
}
break;
case 'expired_at':
case 'billing_at':
case 'start_at':
case 'updated_at':
case 'created_at':
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' calender' : 'calender';
$form = form_input($field, $value ?? "", $extras);
break;
case 'description':
case 'content':
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' tinymce' : 'tinymce';
$form = form_textarea($field, $value ?? "", ['id' => $field, ...$extras]);
break;
case 'clientinfo_uid':
case 'ownerinfo_uid':
case 'user_uid':
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field';
$form = $this->form_dropdown_disabled($field, $value, $viewDatas['control']['filter_optons'][$field], $extras);
break;
default:
if (in_array($field, $viewDatas['control']['filter_fields'])) {
$form = $this->form_dropdown_disabled($field, $value, $viewDatas['control']['filter_optons'][$field], $extras);
} else {
$form = form_input($field, $value ?? "", $extras);
}
break;
}
return $form;
}
public function getFieldView(string $field, mixed $value, array $viewDatas, array $extras = []): string|null
{
switch ($field) {
case 'user_uid':
$value = array_key_exists($value, $viewDatas['control']['filter_optons'][$field]) && $viewDatas['control']['filter_optons'][$field][$value] ? $viewDatas['control']['filter_optons'][$field][$value]->getTitle() : "";
break;
case 'role':
$roles = [];
foreach (explode(DEFAULTS["DELIMITER_ROLE"], $value) as $key) {
$roles[] = $viewDatas['control']['filter_optons'][$field][$key]->getTitle() ?? "";
}
$value = implode(" , ", $roles);
break;
case 'updated_at':
case 'created_at':
case 'deleted_at':
$value = $value ? date("Y-m-d", strtotime($value)) : "";
break;
case 'price':
case 'amount':
$value = number_format($value) . "";
break;
default:
if (in_array($field, $viewDatas['control']['filter_fields'])) {
//index 액션에서만 filter_options를 변경시 선택된 값을 변경하는 기능
if ($viewDatas['control']['action'] == 'index') {
$extras["onChange"] = sprintf(
"document.location.href='%s/toggle/%s/%s?%s='+this.options[this.selectedIndex].value",
current_url(),
$viewDatas['entity']->getPK(),
$field,
$field
);
$value = $this->getFieldForm($field, $value, $viewDatas, $extras);
} else {
$value = array_key_exists($value, $viewDatas['control']['filter_optons'][$field]) ? $viewDatas['control']['filter_optons'][$field][$value]->getTitle() : "";
}
}
break;
}
if (is_array($value)) {
echo __METHOD__ . "에서 오류: {$field}의 값이 Array형태입니다";
exit;
}
return $value;
}
final public function getListRowColor(mixed $entity, string $field = 'status', string $value = DEFAULTS['STATUS']): string
{
return $entity->isMatched($field, $value) ? "" : 'class="table-danger"';
}
public function getListLabel(string $field, string $label, array $viewDatas, array $extras = []): string
{
switch ($field) {
default:
$label = $this->getFieldLabel($field, $label, $viewDatas, $extras);
if (isset($viewDatas['order_field']) && $viewDatas['order_field'] == $field) {
$label .= $viewDatas['order_value'] == 'ASC' ? ICONS["UP"] : ICONS["DOWN"];
}
$query = $viewDatas['uri']->getQuery(['except' => ['order_field', 'order_value']]);
$query .= empty($query) ? "" : "&";
$query .= "order_field={$field}&order_value=";
$query .= isset($viewDatas['order_value']) && $viewDatas['order_value'] == 'DESC' ? "ASC" : "DESC";
$label = anchor(current_url() . "?" . $query, $label);
break;
}
return $label;
}
public function getListButton(string $action, string $label, array $viewDatas, array $extras = []): string
{
switch ($action) {
case 'create':
// echo current_url() . '/' . $action . '?' . $viewDatas['uri']->getQuery();
$extras = ["class" => "btn btn-outline btn-primary btn-circle", "target" => "_self", ...$extras];
$action = form_label(
$label ? $label : ICONS['ADD'],
$action,
[
"data-src" => current_url() . '/' . $action . '?' . $viewDatas['uri']->getQuery(),
"data-bs-toggle" => "modal",
"data-bs-target" => "#index_action_form",
...$extras
]
);
break;
case 'modify':
$oldBatchJobUids = old("batchjob_uids", null);
$oldBatchJobUids = is_array($oldBatchJobUids) ? $oldBatchJobUids : [$oldBatchJobUids];
$checkbox = form_checkbox([
"id" => "checkbox_uid_{$viewDatas['entity']->getPK()}",
"name" => "batchjob_uids[]",
"value" => $viewDatas['entity']->getPK(),
"class" => "batchjobuids_checkboxs",
"checked" => in_array($viewDatas['entity']->getPK(), $oldBatchJobUids)
]);
$action = $checkbox . form_label(
$label ? $label : $viewDatas['cnt'],
$action,
[
"data-src" => current_url() . '/' . $action . '/' . $viewDatas['entity']->getPK() . '?' . $viewDatas['uri']->getQuery(),
"data-bs-toggle" => "modal",
"data-bs-target" => "#index_action_form",
...$extras
]
);
break;
case 'view':
$extras = ["class" => "btn btn-outline btn-primary btn-circle", "target" => "_self", ...$extras];
$action = form_label(
$label ? $label : ICONS['SEARCH'],
$action,
[
"data-src" => current_url() . '/' . $action . '/' . $viewDatas['entity']->getPK(),
"data-bs-toggle" => "modal",
"data-bs-target" => "#index_action_form",
...$extras
]
);
break;
case 'delete':
$extras = ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self", ...$extras];
$action = anchor(
current_url() . '/' . $action . '/' . $viewDatas['entity']->getPK(),
$label ? $label : ICONS['DELETE'],
$extras
);
break;
case 'batchjob':
$action = form_submit("batchjob_submit", $label ? $label : '일괄처리', [
"formaction" => current_url() . '/batchjob',
"class" => "btn btn-outline btn-warning",
// "onclick" => "return submitBatchJob()"
]);
break;
case 'batchjob_delete':
$action = form_submit("batchjob_submit", $label ? $label : '일괄삭제', [
"formaction" => current_url() . '/batchjob_delete',
"class" => "btn btn-outline btn-danger",
// "onclick" => "return submitBatchJobDelete()"
]);
break;
default:
$action = "";
break;
}
return $action;
}
}

View File

@ -1,14 +0,0 @@
<?php
namespace App\Helpers\Customer;
use App\Models\Customer\ClientHistoryModel;
class ClientHistoryHelper extends CustomerHelper
{
public function __construct()
{
parent::__construct();
$this->setTitleField(field: ClientHistoryModel::TITLE);
}
}

View File

@ -1,14 +0,0 @@
<?php
namespace App\Helpers\Customer;
use App\Models\Customer\ServiceHistoryModel;
class ServiceHistoryHelper extends CustomerHelper
{
public function __construct()
{
parent::__construct();
$this->setTitleField(field: ServiceHistoryModel::TITLE);
}
}

View File

@ -1,14 +0,0 @@
<?php
namespace App\Helpers\Equipment;
use App\Models\Equipment\CodeModel;
class CodeHelper extends EquipmentHelper
{
public function __construct()
{
parent::__construct();
$this->setTitleField(field: CodeModel::TITLE);
}
}

View File

@ -1,10 +1,10 @@
<?php
namespace App\Helpers\Equipment\Part;
namespace App\Helpers\Equipment;
use App\Models\Equipment\Part\DomainModel;
class DomainHelper extends PartHelper
class DomainHelper extends EquipmentHelper
{
public function __construct()
{

View File

@ -1,14 +0,0 @@
<?php
namespace App\Helpers\Equipment\Part;
use App\Models\Equipment\Part\CpuModel;
class CpuHelper extends PartHelper
{
public function __construct()
{
parent::__construct();
$this->setTitleField(field: CpuModel::TITLE);
}
}

View File

@ -1,14 +0,0 @@
<?php
namespace App\Helpers\Equipment\Part;
use App\Models\Equipment\Part\DefenceModel;
class DefenceHelper extends PartHelper
{
public function __construct()
{
parent::__construct();
$this->setTitleField(field: DefenceModel::TITLE);
}
}

View File

@ -1,14 +0,0 @@
<?php
namespace App\Helpers\Equipment\Part;
use App\Models\Equipment\Part\IpModel;
class IpHelper extends PartHelper
{
public function __construct()
{
parent::__construct();
$this->setTitleField(field: IpModel::TITLE);
}
}

View File

@ -1,14 +0,0 @@
<?php
namespace App\Helpers\Equipment\Part;
use App\Models\Equipment\Part\LineModel;
class LineHelper extends PartHelper
{
public function __construct()
{
parent::__construct();
$this->setTitleField(field: LineModel::TITLE);
}
}

View File

@ -1,13 +0,0 @@
<?php
namespace App\Helpers\Equipment\Part;
use App\Helpers\Equipment\EquipmentHelper;
abstract class PartHelper extends EquipmentHelper
{
protected function __construct()
{
parent::__construct();
}
}

View File

@ -1,14 +0,0 @@
<?php
namespace App\Helpers\Equipment\Part;
use App\Models\Equipment\Part\RamModel;
class RamHelper extends PartHelper
{
public function __construct()
{
parent::__construct();
$this->setTitleField(field: RamModel::TITLE);
}
}

View File

@ -1,14 +0,0 @@
<?php
namespace App\Helpers\Equipment\Part;
use App\Models\Equipment\Part\SoftwareModel;
class SoftwareHelper extends PartHelper
{
public function __construct()
{
parent::__construct();
$this->setTitleField(field: SoftwareModel::TITLE);
}
}

View File

@ -1,14 +0,0 @@
<?php
namespace App\Helpers\Equipment\Part;
use App\Models\Equipment\Part\StorageModel;
class StorageHelper extends PartHelper
{
public function __construct()
{
parent::__construct();
$this->setTitleField(field: StorageModel::TITLE);
}
}

View File

@ -0,0 +1,88 @@
<?php
namespace App\Helpers;
use App\Models\Customer\ServicePaymentModel;
class HomeHelper extends CommonHelper
{
public function __construct()
{
parent::__construct();
$this->setTitleField(field: ServicePaymentModel::TITLE);
}
public function getFieldView(string $field, mixed $value, array $viewDatas, array $extras = []): string|null
{
switch ($field) {
case 'item_uid':
$value = $viewDatas['control']['filter_optons'][$viewDatas['entity']->getItemType()][$value]->getTitle();
break;
case 'type':
// echo $value;
// dd($viewDatas['control']['filter_optons'][$field]);
$value = $viewDatas['control']['filter_optons'][$field][$value]->getTitle();
break;
case 'amount':
$value = number_format($value) . "";
break;
case 'status':
$value = parent::getFieldView($field, $value, $viewDatas, $extras);
break;
case "LINE":
case "IP":
case "SERVER":
case "CPU":
case "RAM":
case "STORAGE":
case "SOFTWARE":
case "DEFENCE":
case "DOMAIN":
// if ($field == 'DEFENCE') {
// dd($viewDatas['entity']->getItemEntities($field));
// }
$temps = [];
foreach ($viewDatas['entity']->getItemEntities($field) as $itemEntity) {
$temps[] = $viewDatas['control']['filter_optons'][$field][$itemEntity->getItemUid()]->getTitle();
}
$value = implode("<BR>", $temps);
break;
default:
if (in_array($field, $viewDatas['control']['filter_fields'])) {
if (array_key_exists($value, $viewDatas['control']['filter_optons'][$field])) {
$value = $viewDatas['control']['filter_optons'][$field][$value]->getTitle();
} else {
$value = "";
}
}
break;
}
if (is_array($value)) {
echo __METHOD__ . "에서 오류: {$field}의 값이 Array형태입니다";
exit;
}
return $value;
}
public function getListButton(string $action, string $label, array $viewDatas, array $extras = []): string
{
switch ($action) {
case 'new_service_view':
$extras = ["class" => "btn btn-outline btn-light btn-circle", "target" => "_self", ...$extras];
$action = form_label(
$label ? $label : ICONS['SEARCH'],
$action,
[
"data-src" => '/admin/customer/service/view/' . $viewDatas['entity']->getPK(),
"data-bs-toggle" => "modal",
"data-bs-target" => "#index_action_form",
...$extras
]
);
break;
default:
$action = parent::getListButton($action, $label, $viewDatas, $extras);
break;
}
return $action;
}
}

View File

@ -0,0 +1,54 @@
<?php
namespace App\Helpers;
use App\Models\MyLogModel;
class MyLogHelper extends CommonHelper
{
public function __construct()
{
parent::__construct();
$this->setTitleField(MyLogModel::TITLE);
}
public function getFieldView(string $field, mixed $value, array $viewDatas, array $extras = []): string|null
{
switch ($field) {
case 'content':
$value = nl2br($value);
break;
default:
if (in_array($field, $viewDatas['control']['filter_fields'])) {
if (array_key_exists($value, $viewDatas['control']['filter_optons'][$field])) {
$value = $viewDatas['control']['filter_optons'][$field][$value]->getTitle();
} else {
$value = "";
}
}
break;
}
if (is_array($value)) {
echo __METHOD__ . "에서 오류: {$field}의 값이 Array형태입니다";
exit;
}
return $value;
}
public function getListButton(string $action, string $label, array $viewDatas, array $extras = []): string
{
switch ($action) {
case 'modify':
$action = $viewDatas['cnt'];
break;
case 'create':
case 'delete':
case 'batchjob':
case 'batchjob_delete':
$action = "";
break;
default:
$action = parent::getListButton($action, $label, $viewDatas, $extras);
break;
}
return $action;
}
}

View File

@ -0,0 +1,27 @@
<?php
namespace App\Helpers;
use App\Models\UserModel;
class UserHelper extends CommonHelper
{
public function __construct()
{
parent::__construct();
$this->setTitleField(UserModel::TITLE);
}
public function getFieldForm(string $field, mixed $value, array $viewDatas, array $extras = []): string
{
switch ($field) {
case 'passwd':
case 'confirmpassword':
$form = form_password($field, "", [...$extras]);
break;
default:
$form = parent::getFieldForm($field, $value, $viewDatas, $extras);
break;
}
return $form;
} //
}

View File

@ -1,20 +0,0 @@
<?php
return [
'title' => "고객History정보",
'label' => [
'clientinfo_uid' => "고객명",
'title' => "제목",
'description' => "상세정보",
'status' => "상태",
'updated_at' => "수정일",
'created_at' => "신청일",
'deleted_at' => "삭제일",
],
'DEFAULTS' => [
'status' => 'default'
],
"STATUS" => [
'default' => "사용중",
"pause" => "일시정지",
],
];

View File

@ -1,20 +0,0 @@
<?php
return [
'title' => "서비스History정보",
'label' => [
'serviceinfo_uid' => "서비스명",
'title' => "제목",
'description' => "상세정보",
'status' => "상태",
'updated_at' => "수정일",
'created_at' => "신청일",
'deleted_at' => "삭제일",
],
'DEFAULTS' => [
'status' => 'default'
],
"STATUS" => [
'default' => "사용중",
"pause" => "일시정지",
],
];

View File

@ -1,19 +0,0 @@
<?php
return [
'title' => "서버장비정보",
'label' => [
'code' => "코드",
'status' => "사용여부",
'updated_at' => "수정일",
'created_at' => "작성일",
'deleted_at' => "삭제일",
],
'DEFAULTS' => [
'status' => 'default',
],
"STATUS" => [
'default' => "사용가능",
'occupied' => "서비스중",
"format" => "포맷요청중",
],
];

View File

@ -1,20 +0,0 @@
<?php
return [
'title' => "CPU정보",
'label' => [
'model' => "모델",
'price' => "가격",
'description' => "설명",
'status' => "상태",
'updated_at' => "수정일",
'created_at' => "작성일",
'deleted_at' => "삭제일",
],
'DEFAULTS' => [
'status' => 'default'
],
"STATUS" => [
'default' => "사용가능",
"pause" => "일시정지",
],
];

View File

@ -1,20 +0,0 @@
<?php
return [
'title' => "Domain정보",
'label' => [
'domain' => "도메인",
'expired_at' => "종료일",
'price' => "금액",
'description' => "설명",
'status' => "상태",
'updated_at' => "수정일",
'created_at' => "작성일",
'deleted_at' => "삭제일",
],
"STATUS" => [
'default' => "사용가능",
"pause" => "일시정지",
"occupied" => "사용중",
"forbidden" => "금지됨",
],
];

View File

@ -1,21 +0,0 @@
<?php
return [
'title' => "RAM정보",
'label' => [
'model' => "모델",
'price' => "가격",
'description' => "설명",
'status' => "상태",
'updated_at' => "수정일",
'created_at' => "작성일",
'deleted_at' => "삭제일",
],
'DEFAULTS' => [
'status' => 'default'
],
"STATUS" => [
'default' => "사용가능",
"pause" => "일시정지",
],
];

View File

@ -1,29 +0,0 @@
<?php
return [
'title' => "소프트웨어정보",
'label' => [
'type' => "종류",
'model' => "모델",
'price' => "금액",
'description' => "설명",
'status' => "상태",
'updated_at' => "수정일",
'created_at' => "작성일",
'deleted_at' => "삭제일",
],
'DEFAULTS' => [
'type' => 'Windows',
'status' => 'default'
],
"TYPE" => [
"Windows" => "Windows OS",
"Linux" => "Linux OS",
"Security" => "보안용",
"Virus" => "바이러스용",
"App" => "어플리케이션",
],
"STATUS" => [
'default' => "사용가능",
"pause" => "일시정지",
],
];

View File

@ -1,20 +0,0 @@
<?php
return [
'title' => "DISK정보",
'label' => [
'model' => "모델",
'price' => "가격",
'description' => "설명",
'status' => "상태",
'updated_at' => "수정일",
'created_at' => "작성일",
'deleted_at' => "삭제일",
],
'DEFAULTS' => [
'status' => 'default'
],
"STATUS" => [
'default' => "사용가능",
"pause" => "일시정지",
],
];

View File

@ -10,8 +10,7 @@ abstract class CommonModel extends Model
protected $table = '';
protected $primaryKey = '';
protected $useAutoIncrement = true;
// protected $returnType = 'array';
protected $returnType = 'array';
protected $useSoftDeletes = false;
protected $protectFields = true;
protected $allowedFields = [];

View File

@ -11,7 +11,6 @@ class AccountModel extends CustomerModel
const TITLE = "title";
protected $table = self::TABLE;
protected $primaryKey = self::PK;
protected $returnType = AccountEntity::class;
protected $allowedFields = [
"clientinfo_uid",
"status",
@ -23,6 +22,7 @@ class AccountModel extends CustomerModel
public function __construct()
{
parent::__construct();
$this->returnType = AccountEntity::class;
}
public function getFormFieldRule(string $action, string $field): string
{

View File

@ -1,44 +0,0 @@
<?php
namespace App\Models\Customer;
use App\Entities\Customer\ClientHistoryEntity;
class ClientHistoryModel extends CustomerModel
{
const TABLE = "clientinfo_history";
const PK = "uid";
const TITLE = "title";
protected $table = self::TABLE;
protected $primaryKey = self::PK;
protected $returnType = ClientHistoryEntity::class;
protected $allowedFields = [
"clientinfo_uid",
"title",
"description",
"status",
"updated_at"
];
public function __construct()
{
parent::__construct();
}
public function getFormFieldRule(string $action, string $field): string
{
if (is_array($field)) {
throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true));
}
switch ($field) {
case "clientinfo_uid":
$rule = "required|numeric";
break;
case "title":
$rule = "required|trim|string";
break;
default:
$rule = parent::getFormFieldRule($action, $field);
break;
}
return $rule;
}
}

View File

@ -11,7 +11,6 @@ class ClientModel extends CustomerModel
const TITLE = "name";
protected $table = self::TABLE;
protected $primaryKey = self::PK;
protected $returnType = ClientEntity::class;
protected $allowedFields = [
"code",
"name",
@ -27,6 +26,7 @@ class ClientModel extends CustomerModel
public function __construct()
{
parent::__construct();
$this->returnType = ClientEntity::class;
}
public function getFormFieldRule(string $action, string $field): string
{

View File

@ -11,7 +11,6 @@ class CouponModel extends CustomerModel
const TITLE = "title";
protected $table = self::TABLE;
protected $primaryKey = self::PK;
protected $returnType = CouponEntity::class;
protected $allowedFields = [
"clientinfo_uid",
"status",
@ -22,6 +21,7 @@ class CouponModel extends CustomerModel
public function __construct()
{
parent::__construct();
$this->returnType = CouponEntity::class;
}
public function getFormFieldRule(string $action, string $field): string
{

View File

@ -11,7 +11,6 @@ class PointModel extends CustomerModel
const TITLE = "title";
protected $table = self::TABLE;
protected $primaryKey = self::PK;
protected $returnType = PointEntity::class;
protected $allowedFields = [
"clientinfo_uid",
"status",
@ -22,6 +21,7 @@ class PointModel extends CustomerModel
public function __construct()
{
parent::__construct();
$this->returnType = PointEntity::class;
}
public function getFormFieldRule(string $action, string $field): string
{

View File

@ -1,44 +0,0 @@
<?php
namespace App\Models\Customer;
use App\Entities\Customer\ServiceHistoryEntity;
class ServiceHistoryModel extends CustomerModel
{
const TABLE = "serviceinfo_history";
const PK = "uid";
const TITLE = "title";
protected $table = self::TABLE;
protected $primaryKey = self::PK;
protected $returnType = ServiceHistoryEntity::class;
protected $allowedFields = [
"serviceinfo_uid",
"title",
"description",
"status",
"updated_at"
];
public function __construct()
{
parent::__construct();
}
public function getFormFieldRule(string $action, string $field): string
{
if (is_array($field)) {
throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true));
}
switch ($field) {
case "serviceinfo_uid":
$rule = "required|numeric";
break;
case "title":
$rule = "required|trim|string";
break;
default:
$rule = parent::getFormFieldRule($action, $field);
break;
}
return $rule;
}
}

View File

@ -11,25 +11,22 @@ class ServiceModel extends CustomerModel
const TITLE = "code";
protected $table = self::TABLE;
protected $primaryKey = self::PK;
protected $returnType = ServiceEntity::class;
protected $allowedFields = [
"clientinfo_uid",
"ownerinfo_uid",
"user_uid",
"switchinfo_uid",
"codeinfo_uid",
"code",
"type",
"clientinfo_uid",
"clientinfo_name",
"location",
"raid",
"code",
"billing_at",
"start_at",
"end_at",
"status",
"updated_at"
];
public function __construct()
{
parent::__construct();
$this->returnType = ServiceEntity::class;
}
public function getFormFieldRule(string $action, string $field): string
{
@ -37,17 +34,10 @@ class ServiceModel extends CustomerModel
throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true));
}
switch ($field) {
case "clientinfo_uid":
case "ownerinfo_uid":
case "user_uid":
case "switchinfo_uid":
case "codeinfo_uid":
case "clientinfo_uid":
$rule = "required|numeric";
break;
case "code":
$rule = "if_exist|trim|string";
break;
case "type":
case "location":
case "status":
$rule = "required|trim|string";
@ -56,8 +46,8 @@ class ServiceModel extends CustomerModel
case "start_at":
$rule = "required|valid_date";
break;
case "raid":
$rule = "if_exist|trim|string";
case "end_at":
$rule = "if_exist|valid_date";
break;
default:
$rule = parent::getFormFieldRule($action, $field);

View File

@ -12,7 +12,6 @@ class ServicePaymentModel extends CustomerModel
const TITLE = "item_type";
protected $table = self::TABLE;
protected $primaryKey = self::PK;
protected $returnType = ServicePaymentEntity::class;
protected $allowedFields = [
"serviceinfo_uid",
"ownerinfo_uid",
@ -29,6 +28,7 @@ class ServicePaymentModel extends CustomerModel
public function __construct()
{
parent::__construct();
$this->returnType = ServicePaymentEntity::class;
}
public function getFormFieldRule(string $action, string $field): string
{

View File

@ -1,17 +1,16 @@
<?php
namespace App\Models\Equipment\Part;
namespace App\Models\Equipment;
use App\Entities\Equipment\Part\DefenceEntity;
use App\Entities\Equipment\CSEntity;
class DefenceModel extends PartModel
class CSModel extends EquipmentModel
{
const TABLE = "defenceinfo";
const TABLE = "csinfo";
const PK = "uid";
const TITLE = "ip";
protected $table = self::TABLE;
protected $primaryKey = self::PK;
protected $returnType = DefenceEntity::class;
protected $allowedFields = [
"type",
"ip",
@ -24,6 +23,7 @@ class DefenceModel extends PartModel
public function __construct()
{
parent::__construct();
$this->returnType = CSEntity::class;
}
public function getFormFieldRule(string $action, string $field): string
{

View File

@ -1,43 +0,0 @@
<?php
namespace App\Models\Equipment;
use App\Entities\Equipment\CodeEntity;
class CodeModel extends EquipmentModel
{
const TABLE = "codeinfo";
const PK = "uid";
const TITLE = "code";
protected $table = self::TABLE;
protected $primaryKey = self::PK;
protected $returnType = CodeEntity::class;
protected $allowedFields = [
"code",
"status",
"updated_at"
];
public function __construct()
{
parent::__construct();
}
public function getFormFieldRule(string $action, string $field): string
{
if (is_array($field)) {
throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true));
}
switch ($field) {
case "code":
$rule = "required|trim|min_length[4]|max_length[20]";
$rule .= in_array($action, ["create", "create_form"]) ? "|is_unique[{$this->table}.{$field}]" : "";
break;
case "status":
$rule = "required|trim|string";
break;
default:
$rule = parent::getFormFieldRule($action, $field);
break;
}
return $rule;
}
}

View File

@ -1,43 +0,0 @@
<?php
namespace App\Models\Equipment\Part;
use App\Entities\Equipment\Part\DomainEntity;
class DomainModel extends PartModel
{
const TABLE = "domaininfo";
const PK = "uid";
const TITLE = "domain";
protected $table = self::TABLE;
protected $primaryKey = self::PK;
protected $returnType = DomainEntity::class;
protected $allowedFields = [
"domain",
"status",
"updated_at"
];
public function __construct()
{
parent::__construct();
}
public function getFormFieldRule(string $action, string $field): string
{
if (is_array($field)) {
throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true));
}
switch ($field) {
case "domain":
$rule = "required|trim|valid_domain";
$rule .= in_array($action, ["create", "create_form"]) ? "|is_unique[{$this->table}.{$field}]" : "";
break;
case "price":
$rule = "required|numeric";
break;
default:
$rule = parent::getFormFieldRule($action, $field);
break;
}
return $rule;
}
}

View File

@ -1,13 +0,0 @@
<?php
namespace App\Models\Equipment\Part;
use App\Models\Equipment\EquipmentModel;
abstract class PartModel extends EquipmentModel
{
protected function __construct()
{
parent::__construct();
}
}

View File

@ -1,44 +0,0 @@
<?php
namespace App\Models\Equipment\Part;
use App\Entities\Equipment\Part\RamEntity;
class RamModel extends PartModel
{
const TABLE = "raminfo";
const PK = "uid";
const TITLE = "model";
protected $table = self::TABLE;
protected $primaryKey = self::PK;
protected $returnType = RamEntity::class;
protected $allowedFields = [
"model",
"status",
"updated_at"
];
public function __construct()
{
parent::__construct();
}
final public function getFormFieldRule(string $action, string $field): string
{
if (is_array($field)) {
throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true));
}
switch ($field) {
case "model":
$rule = "required|trim|string";
$rule .= in_array($action, ["create", "create_form"]) ? "|is_unique[{$this->table}.{$field}]" : "";
break;
case "price":
$rule = "required|numeric";
break;
default:
$rule = parent::getFormFieldRule($action, $field);
break;
}
return $rule;
}
}

View File

@ -1,48 +0,0 @@
<?php
namespace App\Models\Equipment\Part;
use App\Entities\Equipment\Part\SoftwareEntity;
class SoftwareModel extends PartModel
{
const TABLE = "softwareinfo";
const PK = "uid";
const TITLE = "model";
protected $table = self::TABLE;
protected $primaryKey = self::PK;
protected $returnType = SoftwareEntity::class;
protected $allowedFields = [
"type",
"model",
"status",
"description",
"updated_at"
];
public function __construct()
{
parent::__construct();
}
public function getFormFieldRule(string $action, string $field): string
{
if (is_array($field)) {
throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true));
}
switch ($field) {
case "model":
$rule = "required|trim|string";
$rule .= in_array($action, ["create", "create_form"]) ? "|is_unique[{$this->table}.{$field}]" : "";
break;
case "type":
$rule = "required|trim|string";
break;
case "price":
$rule = "required|numeric";
break;
default:
$rule = parent::getFormFieldRule($action, $field);
break;
}
return $rule;
}
}

View File

@ -1,43 +0,0 @@
<?php
namespace App\Models\Equipment\Part;
use App\Entities\Equipment\Part\StorageEntity;
class StorageModel extends PartModel
{
const TABLE = "storageinfo";
const PK = "uid";
const TITLE = "model";
protected $table = self::TABLE;
protected $primaryKey = self::PK;
protected $returnType = StorageEntity::class;
protected $allowedFields = [
"model",
"status",
"updated_at"
];
public function __construct()
{
parent::__construct();
}
final public function getFormFieldRule(string $action, string $field): string
{
if (is_array($field)) {
throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true));
}
switch ($field) {
case "model":
$rule = "required|trim|string";
$rule .= in_array($action, ["create", "create_form"]) ? "|is_unique[{$this->table}.{$field}]" : "";
break;
case "price":
$rule = "required|numeric";
break;
default:
$rule = parent::getFormFieldRule($action, $field);
break;
}
return $rule;
}
}

View File

@ -1,25 +1,25 @@
<?php
namespace App\Models\Equipment\Part;
namespace App\Models\Equipment;
use App\Entities\Equipment\Part\CpuEntity;
use App\Entities\Equipment\PartEntity;
class CpuModel extends PartModel
class PartModel extends EquipmentModel
{
const TABLE = "cpuinfo";
const TABLE = "partinfo";
const PK = "uid";
const TITLE = "model";
const TITLE = "title";
protected $table = self::TABLE;
protected $primaryKey = self::PK;
protected $returnType = CpuEntity::class;
protected $allowedFields = [
"model",
"title",
"price",
"status",
"updated_at"
];
public function __construct()
{
parent::__construct();
$this->returnType = PartEntity::class;
}
final public function getFormFieldRule(string $action, string $field): string
{

View File

@ -11,7 +11,6 @@ class UserModel extends CommonModel
const TITLE = "name";
protected $table = self::TABLE;
protected $primaryKey = self::PK;
protected $returnType = UserEntity::class;
protected $allowedFields = [
"id",
"passwd",
@ -25,6 +24,7 @@ class UserModel extends CommonModel
public function __construct()
{
parent::__construct();
$this->returnType = UserEntity::class;
}
public function getFormFieldRule(string $action, string $field): string
{

View File

@ -5,15 +5,16 @@ namespace App\Services\Auth;
use App\Entities\UserEntity;
use App\Services\CommonService;
use CodeIgniter\Session\Session;
use CodeIgniter\Model;
// 참고:https://github.com/SyntaxPhoenix/iloclient
abstract class AuthService extends CommonService
{
private ?Session $_session = null;
private $url_stack_name = "url_stack";
protected function __construct()
protected function __construct(Model $model)
{
parent::__construct();
parent::__construct($model);
$this->addClassName('Auth');
}
abstract public function login(array $formDatas): UserEntity;

View File

@ -7,9 +7,9 @@ use App\Models\UserModel;
class LocalService extends AuthService
{
public function __construct()
public function __construct(UserModel $model)
{
parent::__construct();
parent::__construct($model);
$this->addClassName('Local');
}
final public function getModelClass(): UserModel

View File

@ -4,15 +4,17 @@ namespace App\Services;
use App\Entities\FormOptionEntity;
use App\Libraries\LogCollector;
use CodeIgniter\Model;
abstract class CommonService
{
private $_serviceDatas = [];
private $_model = null;
private $_classNames = [];
protected function __construct() {}
abstract public function getModelClass(): mixed;
abstract public function getEntityClass(): mixed;
private $_serviceDatas = [];
protected function __construct(Model $model)
{
$this->_model = $model;
}
abstract public function getFormFields(): array;
abstract public function getFilterFields(): array;
abstract public function getBatchJobFields(): array;
@ -54,7 +56,7 @@ abstract class CommonService
final protected function getModel(): mixed
{
if (!$this->_model) {
$this->_model = $this->getModelClass();
throw new \Exception("Model이 정의되지 않았습니다. " . __METHOD__);
}
return $this->_model;
}

View File

@ -1,57 +0,0 @@
<?php
namespace App\Services\Customer;
use App\Entities\Customer\ClientHistoryEntity;
use App\Models\Customer\ClientHistoryModel;
class ClientHistoryService extends CustomerService
{
private ?ClientService $_clientService = null;
public function __construct()
{
parent::__construct();
$this->addClassName('ClientHistory');
}
public function getModelClass(): ClientHistoryModel
{
return new ClientHistoryModel();
}
public function getEntityClass(): ClientHistoryEntity
{
return new ClientHistoryEntity();
}
public function getFormFields(): array
{
return [
"clientinfo_uid",
"title",
"description",
];
}
public function getFilterFields(): array
{
return ["clientinfo_uid", 'status'];
}
public function getBatchJobFields(): array
{
return ['status'];
}
public function getIndexFields(): array
{
return ['clientinfo_uid', 'title', 'status', 'created_at'];
}
//FieldForm관련용
public function getFormFieldOption(string $field, array $options = []): array
{
switch ($field) {
case 'clientinfo_uid':
$options = $this->getClientService()->getEntities();
break;
default:
$options = parent::getFormFieldOption($field, $options);
break;
}
return $options;
}
}

View File

@ -16,15 +16,17 @@ use App\Services\Equipment\Part\SoftwareService;
use App\Services\Equipment\Part\StorageService;
use App\Services\Equipment\ServerService;
use App\Services\UserService;
use CodeIgniter\Model;
abstract class CustomerService extends CommonService
{
private ?UserService $_userService = null;
private ?ClientService $_clientService = null;
private ?ServerService $_serverService = null;
private $_equipmentService = [];
protected function __construct()
protected function __construct(Model $model)
{
parent::__construct();
parent::__construct($model);
$this->addClassName('Customer');
}
final public function getClientService(): ClientService
@ -48,6 +50,13 @@ abstract class CustomerService extends CommonService
}
return $this->_serviceService;
}
final public function getServerService(): ServerService
{
if (!$this->_serverService) {
$this->_serverService = new ServerService();
}
return $this->_serverService;
}
//ServiceItemController,ServiceController에서 사용
final public function getServiceItemLinkService(string $key): mixed
{

View File

@ -1,44 +0,0 @@
<?php
namespace App\Services\Customer;
use App\Entities\Customer\ServiceHistoryEntity;
use App\Models\Customer\ServiceHistoryModel;
class ServiceHistoryService extends CustomerService
{
public function __construct()
{
parent::__construct();
$this->addClassName('ServiceHistory');
}
public function getModelClass(): ServiceHistoryModel
{
return new ServiceHistoryModel();
}
public function getEntityClass(): ServiceHistoryEntity
{
return new ServiceHistoryEntity();
}
public function getFormFields(): array
{
return [
"serviceinfo_uid",
"title",
"description",
];
}
public function getFilterFields(): array
{
return ["serviceinfo_uid", 'status'];
}
public function getBatchJobFields(): array
{
return ['status'];
}
public function getIndexFields(): array
{
return ['serviceinfo_uid', 'title', 'status', 'created_at'];
}
//FieldForm관련용
}

View File

@ -3,44 +3,22 @@
namespace App\Services\Customer;
use App\Entities\Customer\ServiceEntity;
use App\Entities\Equipment\CodeEntity;
use App\Entities\Equipment\SwitchEntity;
use App\Models\Customer\ServiceModel;
use App\Services\Customer\ServiceItemService;
use App\Services\Equipment\CodeService;
use App\Services\Equipment\SwitchService;
class ServiceService extends CustomerService
{
private ?CodeService $_codeService = null;
private ?SwitchService $_switchService = null;
private ?ServiceItemService $_serviceItemService = null;
private ?ServicePaymentService $_servicePaymentService = null;
private ?string $_searchIP = null;
public function __construct()
{
parent::__construct();
parent::__construct(new ServiceModel());
$this->addClassName('Service');
}
public function getModelClass(): ServiceModel
{
return new ServiceModel();
}
public function getEntityClass(): ServiceEntity
{
return new ServiceEntity();
}
public function getFormFields(): array
{
return [
"clientinfo_uid",
"ownerinfo_uid",
"type",
"location",
"switchinfo_uid",
"codeinfo_uid",
"raid",
"billing_at",
"start_at",
"status"
@ -48,7 +26,7 @@ class ServiceService extends CustomerService
}
public function getFilterFields(): array
{
return ["clientinfo_uid", 'ownerinfo_uid', 'user_uid', 'type', 'location', 'switchinfo_uid', 'codeinfo_uid', 'raid', 'status'];
return ["user_uid", "clientinfo_uid", 'status'];
}
public function getBatchJobFields(): array
{
@ -56,28 +34,7 @@ class ServiceService extends CustomerService
}
public function getIndexFields(): array
{
return ['clientinfo_uid', 'ownerinfo_uid', 'type', 'location', 'switchinfo_uid', 'codeinfo_uid', 'raid', 'billing_at', 'start_at', 'updated_at', 'status', 'user_uid'];
}
public function getCodeService(): CodeService
{
if (!$this->_codeService) {
$this->_codeService = new CodeService();
}
return $this->_codeService;
}
public function getSwitchService(): SwitchService
{
if (!$this->_switchService) {
$this->_switchService = new SwitchService();
}
return $this->_switchService;
}
public function getServiceItemService(): ServiceItemService
{
if (!$this->_serviceItemService) {
$this->_serviceItemService = new ServiceItemService();
}
return $this->_serviceItemService;
return ['clientinfo_uid', 'location', 'billing_at', 'start_at', 'updated_at', 'status', 'user_uid'];
}
public function getServicePaymentService(): ServicePaymentService
{
@ -115,11 +72,8 @@ class ServiceService extends CustomerService
case 'user_uid':
$options = $this->getUserService()->getEntities();
break;
case 'codeinfo_uid':
$options = $this->getCodeService()->getEntities();
break;
case 'switchinfo_uid':
$options = $this->getSwitchService()->getEntities();
case 'clientinfo_uid':
$options = $this->getClientService()->getEntities();
break;
default:
$options = parent::getFormFieldOption($field, $options);
@ -127,26 +81,10 @@ class ServiceService extends CustomerService
}
return $options;
}
//Service마다 ItemEntities 설정용
public function setItemEntitiesByService(ServiceEntity $entity): ServiceEntity
{
foreach (SERVICE_ITEM_TYPES as $item_type => $label) {
$itemEntities = $this->getServiceItemService()->getEntities([
'serviceinfo_uid' => $entity->getPK(),
'item_type' => $item_type
]);
$entity->setItemEntities($item_type, $itemEntities);
}
return $entity;
}
//interval을 기준으로 최근 신규 서비스정보 가져오기
final public function getEntitiesByNewService(int $interval, string $status = DEFAULTS['STATUS']): array
{
$entities = [];
foreach ($this->getEntities(sprintf("start_at >= NOW()-INTERVAL {$interval} DAY AND status = '%s'", $status)) as $entity) {
$entities[$entity->getPK()] = $this->setItemEntitiesByService($entity);
};
return $entities;
return $this->getEntities(sprintf("start_at >= NOW()-INTERVAL {$interval} DAY AND status = '%s'", $status));
}
//서비스 방식에 따른 서비스별 Count
final public function getTotalCountsByType(): array
@ -182,10 +120,9 @@ class ServiceService extends CustomerService
}
public function create(array $formDatas): ServiceEntity
{
//code의 경우 서비스중으로 설정작업
$this->getCodeService()->setStatus($formDatas['codeinfo_uid'], CodeEntity::STATUS_OCCUPIED);
//switch의 경우 서비스중으로 설정작업
$this->getSwitchService()->setStatus($formDatas['switchinfo_uid'], SwitchEntity::STATUS_OCCUPIED);
$entity = parent::create($formDatas);
//서버경우 서비스중으로 설정작업
// $this->getServerService()->setService($entity)ServerEntity::STATUS_OCCUPIED);
return parent::create($formDatas);
}
public function modify(mixed $entity, array $formDatas): ServiceEntity

View File

@ -1,60 +0,0 @@
<?php
namespace App\Services\Equipment;
use App\Entities\Equipment\CodeEntity;
use App\Models\Equipment\CodeModel;
use App\Services\Equipment\EquipmentService;
class CodeService extends EquipmentService
{
public function __construct()
{
parent::__construct();
$this->addClassName('Code');
}
public function getModelClass(): CodeModel
{
return new CodeModel();
}
public function getEntityClass(): CodeEntity
{
return new CodeEntity();
}
public function getFormFields(): array
{
return [
"code",
"status",
];
}
public function getFilterFields(): array
{
return ['status'];
}
public function getBatchJobFields(): array
{
return ['status'];
}
public function getIndexFields(): array
{
return ['code', 'status'];
}
//상태변경
public function setStatus(string $code, string $status): CodeEntity
{
//code의 경우 사용가능/사용중으로 설정작업
$entity = $this->getEntity($code);
if (!$entity) {
throw new \Exception("{$code}에 대한 서버코드정보를 찾을수 없습니다.");
}
return $this->getModel()->modify($entity, ['status' => $status]);
}
//List 검색용
//OrderBy 처리
public function setOrderBy(mixed $field = null, mixed $value = null): void
{
$this->getModel()->orderBy('code', 'ASC');
parent::setOrderBy($field, $value);
}
}

View File

@ -1,49 +0,0 @@
<?php
namespace App\Services\Equipment\Part;
use App\Entities\Equipment\Part\CpuEntity;
use App\Models\Equipment\Part\CpuModel;
class CpuService extends PartService
{
public function __construct()
{
parent::__construct();
$this->addClassName('Cpu');
}
public function getModelClass(): CpuModel
{
return new CpuModel();
}
public function getEntityClass(): CpuEntity
{
return new CpuEntity();
}
final public function getFormFields(): array
{
return [
"model",
"status",
];
}
final public function getFilterFields(): array
{
return ['status'];
}
final public function getBatchJobFields(): array
{
return ['status'];
}
public function getIndexFields(): array
{
return ['model', 'status'];
}
//List 검색용
//OrderBy 처리
public function setOrderBy(mixed $field = null, mixed $value = null): void
{
$this->getModel()->orderBy('model', 'ASC');
parent::setOrderBy($field, $value);
}
}

View File

@ -1,49 +0,0 @@
<?php
namespace App\Services\Equipment\Part;
use App\Entities\Equipment\Part\RamEntity;
use App\Models\Equipment\Part\RamModel;
class RamService extends PartService
{
public function __construct()
{
parent::__construct();
$this->addClassName('Ram');
}
public function getModelClass(): RamModel
{
return new RamModel();
}
public function getEntityClass(): RamEntity
{
return new RamEntity();
}
final public function getFormFields(): array
{
return [
"model",
"status",
];
}
final public function getFilterFields(): array
{
return ['status'];
}
final public function getBatchJobFields(): array
{
return ['status'];
}
public function getIndexFields(): array
{
return ['model', 'status'];
}
//List 검색용
//OrderBy 처리
public function setOrderBy(mixed $field = null, mixed $value = null): void
{
$this->getModel()->orderBy('model', 'ASC');
parent::setOrderBy($field, $value);
}
}

View File

@ -1,51 +0,0 @@
<?php
namespace App\Services\Equipment\Part;
use App\Entities\Equipment\Part\SoftwareEntity;
use App\Models\Equipment\Part\SoftwareModel;
class SoftwareService extends PartService
{
public function __construct()
{
parent::__construct();
$this->addClassName('Software');
}
public function getModelClass(): SoftwareModel
{
return new SoftwareModel();
}
public function getEntityClass(): SoftwareEntity
{
return new SoftwareEntity();
}
public function getFormFields(): array
{
return [
"type",
"model",
"status",
"description",
];
}
public function getFilterFields(): array
{
return ['type', 'status'];
}
public function getBatchJobFields(): array
{
return ['type', 'status'];
}
public function getIndexFields(): array
{
return ['type', 'model', 'status'];
}
//List 검색용
//OrderBy 처리
public function setOrderBy(mixed $field = null, mixed $value = null): void
{
$this->getModel()->orderBy('model', 'ASC');
parent::setOrderBy($field, $value);
}
}

View File

@ -1,49 +0,0 @@
<?php
namespace App\Services\Equipment\Part;
use App\Entities\Equipment\Part\StorageEntity;
use App\Models\Equipment\Part\StorageModel;
class StorageService extends PartService
{
public function __construct()
{
parent::__construct();
$this->addClassName('Storage');
}
public function getModelClass(): StorageModel
{
return new StorageModel();
}
public function getEntityClass(): StorageEntity
{
return new StorageEntity();
}
final public function getFormFields(): array
{
return [
"model",
"status",
];
}
final public function getFilterFields(): array
{
return ['status'];
}
final public function getBatchJobFields(): array
{
return ['status'];
}
public function getIndexFields(): array
{
return ['model', 'status'];
}
//List 검색용
//OrderBy 처리
public function setOrderBy(mixed $field = null, mixed $value = null): void
{
$this->getModel()->orderBy('model', 'ASC');
parent::setOrderBy($field, $value);
}
}

View File

@ -9,18 +9,9 @@ class UserService extends CommonService
{
public function __construct()
{
parent::__construct();
parent::__construct(new UserModel());
$this->addClassName('User');
}
public function getModelClass(): UserModel
{
return new UserModel();
}
public function getEntityClass(): UserEntity
{
return new UserEntity();
}
public function getFormFields(): array
{
return ['id', 'passwd', 'confirmpassword', 'name', 'email', 'mobile', 'role'];