dbms_init...1

This commit is contained in:
최준흠 2025-05-22 16:14:07 +09:00
parent 3023eb21ea
commit 977d07a1ba
63 changed files with 664 additions and 364 deletions

View File

@ -106,20 +106,6 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au
$routes->post('batchjob_delete', 'ServiceController::batchjob_delete');
$routes->get('download/(:alpha)', 'ServiceController::download/$1');
});
$routes->group('servicepart', ['namespace' => 'App\Controllers\Admin\Customer'], function ($routes) {
$routes->get('/', 'ServicePartController::index', []);
$routes->get('create', 'ServicePartController::create_form');
$routes->post('create', 'ServicePartController::create');
$routes->get('modify/(:num)', 'ServicePartController::modify_form/$1');
$routes->post('modify/(:num)', 'ServicePartController::modify/$1');
$routes->get('view/(:num)', 'ServicePartController::view/$1');
$routes->get('delete/(:num)', 'ServicePartController::delete/$1');
$routes->get('toggle/(:num)/(:any)', 'ServicePartController::toggle/$1/$2');
$routes->post('batchjob', 'ServicePartController::batchjob');
$routes->post('batchjob_delete', 'ServicePartController::batchjob_delete');
$routes->get('download/(:alpha)', 'ServicePartController::download/$1');
});
});
$routes->group('equipment', ['namespace' => 'App\Controllers\Admin\Equipment'], function ($routes) {
$routes->group('line', ['namespace' => 'App\Controllers\Admin\Equipment'], function ($routes) {
@ -148,19 +134,6 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au
$routes->post('batchjob_delete', 'IpController::batchjob_delete');
$routes->get('download/(:alpha)', 'IpController::download/$1');
});
$routes->group('server', ['namespace' => 'App\Controllers\Admin\Equipment'], function ($routes) {
$routes->get('/', 'ServerController::index', []);
$routes->get('create', 'ServerController::create_form');
$routes->post('create', 'ServerController::create');
$routes->get('modify/(:num)', 'ServerController::modify_form/$1');
$routes->post('modify/(:num)', 'ServerController::modify/$1');
$routes->get('view/(:num)', 'ServerController::view/$1');
$routes->get('delete/(:num)', 'ServerController::delete/$1');
$routes->get('toggle/(:num)/(:any)', 'ServerController::toggle/$1/$2');
$routes->post('batchjob', 'ServerController::batchjob');
$routes->post('batchjob_delete', 'ServerController::batchjob_delete');
$routes->get('download/(:alpha)', 'ServerController::download/$1');
});
$routes->group('defence', ['namespace' => 'App\Controllers\Admin\Equipment'], function ($routes) {
$routes->get('/', 'DefenceController::index', []);
$routes->get('create', 'DefenceController::create_form');
@ -187,18 +160,18 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au
$routes->post('batchjob_delete', 'SoftwareController::batchjob_delete');
$routes->get('download/(:alpha)', 'SoftwareController::download/$1');
});
$routes->group('serverpart', ['namespace' => 'App\Controllers\Admin\Equipment'], function ($routes) {
$routes->get('/', 'ServerPartController::index', []);
$routes->get('create', 'ServerPartController::create_form');
$routes->post('create', 'ServerPartController::create');
$routes->get('modify/(:num)', 'ServerPartController::modify_form/$1');
$routes->post('modify/(:num)', 'ServerPartController::modify/$1');
$routes->get('view/(:num)', 'ServerPartController::view/$1');
$routes->get('delete/(:num)', 'ServerPartController::delete/$1');
$routes->get('toggle/(:num)/(:any)', 'ServerPartController::toggle/$1/$2');
$routes->post('batchjob', 'ServerPartController::batchjob');
$routes->post('batchjob_delete', 'ServerPartController::batchjob_delete');
$routes->get('download/(:alpha)', 'ServerPartController::download/$1');
$routes->group('server', ['namespace' => 'App\Controllers\Admin\Equipment'], function ($routes) {
$routes->get('/', 'ServerController::index', []);
$routes->get('create', 'ServerController::create_form');
$routes->post('create', 'ServerController::create');
$routes->get('modify/(:num)', 'ServerController::modify_form/$1');
$routes->post('modify/(:num)', 'ServerController::modify/$1');
$routes->get('view/(:num)', 'ServerController::view/$1');
$routes->get('delete/(:num)', 'ServerController::delete/$1');
$routes->get('toggle/(:num)/(:any)', 'ServerController::toggle/$1/$2');
$routes->post('batchjob', 'ServerController::batchjob');
$routes->post('batchjob_delete', 'ServerController::batchjob_delete');
$routes->get('download/(:alpha)', 'ServerController::download/$1');
});
$routes->group('part', ['namespace' => 'App\Controllers\Admin\Equipment\Part'], function ($routes) {
$routes->group('cpu', ['namespace' => 'App\Controllers\Admin\Equipment\Part'], function ($routes) {
@ -232,5 +205,37 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au
$routes->get('toggle/(:num)/(:any)', 'DiskController::toggle/$1/$2');
});
});
$routes->group('link', ['namespace' => 'App\Controllers\Admin\Equipment\Link'], function ($routes) {
$routes->group('cpu', ['namespace' => 'App\Controllers\Admin\Equipment\Link'], function ($routes) {
$routes->get('/', 'CpuController::index', []);
$routes->get('create', 'CpuController::create_form');
$routes->post('create', 'CpuController::create');
$routes->get('modify/(:num)', 'CpuController::modify_form/$1');
$routes->post('modify/(:num)', 'CpuController::modify/$1');
$routes->get('view/(:num)', 'CpuController::view/$1');
$routes->get('delete/(:num)', 'CpuController::delete/$1');
$routes->get('toggle/(:num)/(:any)', 'CpuController::toggle/$1/$2');
});
$routes->group('ram', ['namespace' => 'App\Controllers\Admin\Equipment\Link'], function ($routes) {
$routes->get('/', 'RamController::index', []);
$routes->get('create', 'RamController::create_form');
$routes->post('create', 'RamController::create');
$routes->get('modify/(:num)', 'RamController::modify_form/$1');
$routes->post('modify/(:num)', 'RamController::modify/$1');
$routes->get('view/(:num)', 'RamController::view/$1');
$routes->get('delete/(:num)', 'RamController::delete/$1');
$routes->get('toggle/(:num)/(:any)', 'RamController::toggle/$1/$2');
});
$routes->group('disk', ['namespace' => 'App\Controllers\Admin\Equipment\Link'], function ($routes) {
$routes->get('/', 'DiskController::index', []);
$routes->get('create', 'DiskController::create_form');
$routes->post('create', 'DiskController::create');
$routes->get('modify/(:num)', 'DiskController::modify_form/$1');
$routes->post('modify/(:num)', 'DiskController::modify/$1');
$routes->get('view/(:num)', 'DiskController::view/$1');
$routes->get('delete/(:num)', 'DiskController::delete/$1');
$routes->get('toggle/(:num)/(:any)', 'DiskController::toggle/$1/$2');
});
});
});
});

View File

@ -2,7 +2,7 @@
namespace App\Controllers\Admin\Customer;
use CodeIgniter\HTTP\RedirectResponse;
use App\Entities\Customer\AccountEntity;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
@ -35,4 +35,24 @@ class AccountController extends CustomerController
return $this->_helper;
}
//Index,FieldForm관련.
protected function create_process(): AccountEntity
{
//account_balance 체크
$clientEntity = $this->getClientService()->getEntity($this->formDatas['clientinfo_uid']);
//입금
$amount = intval($this->formDatas['amount']);
if ($this->formDatas['status'] === DEFAULTS['STATUS']) {
if ($amount < 0) {
throw new \Exception("입금액이 0보다 작습니다.");
}
$this->getClientService()->modify($clientEntity, ['account_balance' => $clientEntity->getAccountBalance() + $amount]);
} else { // 출금
if ($clientEntity->getAccountBalance() < $amount) {
throw new \Exception("예치금:{$clientEntity->getAccountBalance()} < 출금액:{$amount} 출금이 불가합니다.");
}
$this->getClientService()->modify($clientEntity, ['account_balance' => $clientEntity->getAccountBalance() - $amount]);
}
return parent::create_process();
}
}

View File

@ -2,13 +2,14 @@
namespace App\Controllers\Admin\Customer;
use App\Entities\Customer\CouponEntity;
use App\Helpers\Customer\CouponHelper;
use App\Services\Customer\CouponService;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
use App\Helpers\Customer\CouponHelper;
use App\Services\Customer\CouponService;
class CouponController extends CustomerController
{
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
@ -34,6 +35,23 @@ class CouponController extends CustomerController
return $this->_helper;
}
//Index,FieldForm관련.
protected function create_process(): CouponEntity
{
//coupon_balance 체크
$clientEntity = $this->getClientService()->getEntity($this->formDatas['clientinfo_uid']);
//입금
$amount = intval($this->formDatas['amount']);
if ($this->formDatas['status'] === DEFAULTS['STATUS']) {
if ($amount < 0) {
throw new \Exception("쿠폰이 0보다 작습니다.");
}
$this->getClientService()->modify($clientEntity, ['coupon_balance' => $clientEntity->getCouponBalance() + $amount]);
} else { // 출금
if ($clientEntity->getCouponBalance() < $amount) {
throw new \Exception("쿠폰수:{$clientEntity->getCouponBalance()} < 사용수:{$amount} 쿠폰사용이 불가합니다.");
}
$this->getClientService()->modify($clientEntity, ['coupon_balance' => $clientEntity->getCouponBalance() - $amount]);
}
return parent::create_process();
}
}

View File

@ -66,8 +66,11 @@ abstract class CustomerController extends AdminController
{
switch ($field) {
case 'clientinfo_uid':
$options = $this->getClientService()->getFormFieldOption($field);
// echo $this->getUserModel()->getLastQuery();
$temps = [];
foreach ($this->getClientService()->getEntities() as $entity) {
$temps[$entity->getPK()] = $entity->getTitle();
}
$options[$field] = $temps;
// dd($options);
break;
default:

View File

@ -2,14 +2,15 @@
namespace App\Controllers\Admin\Customer;
use App\Entities\Customer\PointEntity;
use App\Helpers\Customer\PointHelper;
use App\Services\Customer\PointService;
use CodeIgniter\HTTP\RedirectResponse;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
use App\Helpers\Customer\PointHelper;
use App\Services\Customer\PointService;
class PointController extends CustomerController
{
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
@ -35,4 +36,24 @@ class PointController extends CustomerController
return $this->_helper;
}
//Index,FieldForm관련.
protected function create_process(): PointEntity
{
//point_balance 체크
$clientEntity = $this->getClientService()->getEntity($this->formDatas['clientinfo_uid']);
//입금
$amount = intval($this->formDatas['amount']);
if ($this->formDatas['status'] === DEFAULTS['STATUS']) {
if ($amount < 0) {
throw new \Exception("포인트금액이 0보다 작습니다.");
}
$this->getClientService()->modify($clientEntity, ['point_balance' => $clientEntity->getPointBalance() + $amount]);
} else { // 출금
if ($clientEntity->getPointBalance() < $amount) {
throw new \Exception("포인트금액:{$clientEntity->getPointBalance()} < 사용금액:{$amount} 포인트사용이 불가합니다.");
}
$this->getClientService()->modify($clientEntity, ['point_balance' => $clientEntity->getPointBalance() - $amount]);
}
return parent::create_process();
}
}

View File

@ -6,16 +6,11 @@ use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
use App\Entities\Customer\ServiceEntity;
use App\Helpers\Customer\ServiceHelper;
use App\Services\Customer\ServiceService;
use App\Services\Equipment\LineService;
use App\Services\Equipment\ServerService;
use App\Entities\Customer\ServiceServerEntity;
use App\Services\Customer\ServiceServerService;
use App\Services\Equipment\PartService;
use App\Services\Customer\ServicePartService;
use App\Services\Equipment\IpService;
@ -23,9 +18,6 @@ class ServiceController extends CustomerController
{
private ?LineService $_lineService = null;
private ?ServerService $_serverService = null;
private ?ServiceServerService $_serviceServerService = null;
private ?PartService $_partService = null;
private ?ServicePartService $_servicePartService = null;
private ?IpService $_ipService = null;
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
@ -66,27 +58,6 @@ class ServiceController extends CustomerController
}
return $this->_serverService;
}
final public function getServiceServerService(): ServiceServerService
{
if (!$this->_serviceServerService) {
$this->_serviceServerService = new ServiceServerService($this->request);
}
return $this->_serviceServerService;
}
final public function getPartService(): PartService
{
if (!$this->_partService) {
$this->_partService = new PartService($this->request);
}
return $this->_partService;
}
final public function getServicePartService(): ServicePartService
{
if (!$this->_servicePartService) {
$this->_servicePartService = new ServicePartService($this->request);
}
return $this->_servicePartService;
}
final public function getIpService(): IpService
{
if (!$this->_ipService) {
@ -98,10 +69,20 @@ class ServiceController extends CustomerController
{
switch ($field) {
case 'lineinfo_uid':
$options = $this->getLineService()->getFormFieldOption($field);
$temps = [];
foreach ($this->getLineService()->getEntities() as $entity) {
$temps[$entity->getPK()] = $entity->getTitle();
}
$options[$field] = $temps;
// dd($options);
break;
case 'serverinfo_uid':
$options = $this->getServerService()->getFormFieldOption($field);
$temps = [];
foreach ($this->getServerService()->getEntities() as $entity) {
$temps[$entity->getPK()] = $entity->getTitle();
}
$options[$field] = $temps;
// dd($options);
break;
default:
$options = parent::getFormFieldOption($field, $options);
@ -112,17 +93,6 @@ class ServiceController extends CustomerController
}
//Index,FieldForm관련
private function setPartEntity(ServiceEntity $entity): ServiceEntity
{
foreach ($this->getServicePartService()->getEntities(['serviceinfo_uid' => $entity->getPK()]) as $servicePartEntity) {
$partEntity = $this->getPartService()->getEntity($servicePartEntity->getPartInfo());
if ($partEntity) {
$entity->addPartEntity($partEntity->getType(), $partEntity);
}
}
return $entity;
}
protected function create_process(): mixed
{
$entity = parent::create_process();
@ -137,10 +107,6 @@ class ServiceController extends CustomerController
];
$this->init('index', $fields);
$this->modal_type = 'modal_iframe';
$entities = [];
foreach (parent::index_process() as $entity) {
$entities[] = $this->setPartEntity($entity);
}
return $entities;
return parent::index_process();
}
}

View File

@ -48,10 +48,19 @@ abstract class EquipmentController extends AdminController
{
switch ($field) {
case 'clientinfo_uid':
$options = $this->getClientService()->getFormFieldOption($field);
// echo $this->getUserModel()->getLastQuery();
$temps = [];
foreach ($this->getClientService()->getEntities() as $entity) {
$temps[$entity->getPK()] = $entity->getTitle();
}
$options[$field] = $temps;
// dd($options);
case 'lineinfo_uid':
$temps = [];
foreach ($this->getLineService()->getEntities() as $entity) {
$temps[$entity->getPK()] = $entity->getTitle();
}
$options[$field] = $temps;
// dd($options);
break;
default:
$options = parent::getFormFieldOption($field, $options);
break;

View File

@ -4,7 +4,6 @@ namespace App\Controllers\Admin\Equipment;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use CodeIgniter\Validation\Validation;
use Psr\Log\LoggerInterface;
use App\Helpers\Equipment\IpHelper;
@ -34,20 +33,6 @@ class IpController extends EquipmentController
}
return $this->_helper;
}
protected function getFormFieldOption(string $field, array $options = []): array
{
switch ($field) {
case 'lineinfo_uid':
$options = $this->getLineService()->getFormFieldOption($field);
// echo $this->getUserModel()->getLastQuery();
// dd($options);
break;
default:
$options = parent::getFormFieldOption($field, $options);
break;
}
return $options;
}
//Index,FieldForm관련
protected function setOrderByForList()
{

View File

@ -1,15 +1,15 @@
<?php
namespace App\Controllers\Admin\Equipment;
namespace App\Controllers\Admin\Equipment\Link;
use App\Helpers\Equipment\PartHelper;
use App\Services\Equipment\PartService;
use App\Helpers\Equipment\Link\CpuHelper;
use App\Services\Equipment\Link\CpuService;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
class PartController extends EquipmentController
class CpuController extends LinkController
{
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
@ -19,32 +19,26 @@ class PartController extends EquipmentController
$this->title = lang("{$this->getService()->getClassPath()}.title");
$this->helper = $this->getHelper();
}
public function getService(): PartService
public function getService(): CpuService
{
if (!$this->_service) {
$this->_service = new PartService($this->request);
$this->_service = new CpuService($this->request);
}
return $this->_service;
}
public function getHelper(): mixed
{
if (!$this->_helper) {
$this->_helper = new PartHelper($this->request);
$this->_helper = new CpuHelper($this->request);
}
return $this->_helper;
}
//Index,FieldForm관련
protected function setOrderByForList()
{
//OrderBy 처리
$this->getService()->getModel()->orderBy('type', 'ASC', false);
parent::setOrderByForList();
}
protected function index_process(): array
{
$fields = [
'fields' => ['type', 'model', 'status'],
'fields' => ['billing_type', 'serviceinfo_uid', 'serverinfo_uid', 'cpuinfo_uid', 'amount'],
];
$this->init('index', $fields);
$this->modal_type = 'modal_iframe';

View File

@ -0,0 +1,46 @@
<?php
namespace App\Controllers\Admin\Equipment\Link;
use App\Helpers\Equipment\Link\DiskHelper;
use App\Services\Equipment\Link\DiskService;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
class DiskController extends LinkController
{
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
$this->uri_path .= strtolower($this->getService()->getClassName()) . '/';
$this->class_path = $this->getService()->getClassPath();
$this->title = lang("{$this->getService()->getClassPath()}.title");
$this->helper = $this->getHelper();
}
public function getService(): DiskService
{
if (!$this->_service) {
$this->_service = new DiskService($this->request);
}
return $this->_service;
}
public function getHelper(): mixed
{
if (!$this->_helper) {
$this->_helper = new DiskHelper($this->request);
}
return $this->_helper;
}
//Index,FieldForm관련
protected function index_process(): array
{
$fields = [
'fields' => ['billing_type', 'serviceinfo_uid', 'serverinfo_uid', 'diskinfo_uid', 'amount'],
];
$this->init('index', $fields);
$this->modal_type = 'modal_iframe';
return parent::index_process();
}
}

View File

@ -0,0 +1,26 @@
<?php
namespace App\Controllers\Admin\Equipment\Link;
use App\Controllers\Admin\Equipment\EquipmentController;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
abstract class LinkController extends EquipmentController
{
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
$this->uri_path .= 'part/';
// $this->view_path .= "part" . DIRECTORY_SEPARATOR;
}
protected function setOrderByForList()
{
//OrderBy 처리
$this->getService()->getModel()->orderBy('serviceinfo_uid', 'ASC', false);
parent::setOrderByForList();
}
}

View File

@ -0,0 +1,46 @@
<?php
namespace App\Controllers\Admin\Equipment\Link;
use App\Helpers\Equipment\Link\RamHelper;
use App\Services\Equipment\Link\RamService;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
class RamController extends LinkController
{
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
$this->uri_path .= strtolower($this->getService()->getClassName()) . '/';
$this->class_path = $this->getService()->getClassPath();
$this->title = lang("{$this->getService()->getClassPath()}.title");
$this->helper = $this->getHelper();
}
public function getService(): RamService
{
if (!$this->_service) {
$this->_service = new RamService($this->request);
}
return $this->_service;
}
public function getHelper(): mixed
{
if (!$this->_helper) {
$this->_helper = new RamHelper($this->request);
}
return $this->_helper;
}
//Index,FieldForm관련
protected function index_process(): array
{
$fields = [
'fields' => ['billing_type', 'serviceinfo_uid', 'serverinfo_uid', 'raminfo_uid', 'amount'],
];
$this->init('index', $fields);
$this->modal_type = 'modal_iframe';
return parent::index_process();
}
}

View File

@ -2,7 +2,6 @@
namespace App\Controllers\Admin\Equipment;
use App\Entities\Equipment\ServerEntity;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;

View File

@ -49,8 +49,11 @@ class MyLogController extends AdminController
{
switch ($field) {
case 'user_uid':
$options = $this->getUserService()->getFormFieldOption($field);
// echo $this->getUserModel()->getLastQuery();
$temps = [];
foreach ($this->getUserService()->getEntities() as $entity) {
$temps[$entity->getPK()] = $entity->getTitle();
}
$options[$field] = $temps;
// dd($options);
break;
default:

View File

@ -213,7 +213,9 @@ abstract class CommonController extends BaseController
$this->getMyLogService()->save($this->getService(), __FUNCTION__, $this->getMyAuth(), MESSAGES["SUCCESS"]);
return $this->getResultPageByActon($this->action);
} catch (\Exception $e) {
// dd($e->getMessage());
$this->getService()->getModel()->transRollback();
LogCollector::debug($e->getMessage());
$this->getMyLogService()->save($this->getService(), __FUNCTION__, $this->getMyAuth(), MESSAGES["FAILED"]);
return redirect()->back()->withInput()->with('error', $e->getMessage());
}
@ -256,6 +258,7 @@ abstract class CommonController extends BaseController
return $this->getResultPageByActon($this->action);
} catch (\Exception $e) {
$this->getService()->getModel()->transRollback();
LogCollector::debug($e->getMessage());
$this->getMyLogService()->save($this->getService(), __FUNCTION__, $this->getMyAuth(), MESSAGES["FAILED"]);
return redirect()->back()->withInput()->with('error', $e->getMessage());
}
@ -282,6 +285,7 @@ abstract class CommonController extends BaseController
return $this->getResultPageByActon($this->action);
} catch (\Exception $e) {
$this->getService()->getModel()->transRollback();
LogCollector::debug($e->getMessage());
$this->getMyLogService()->save($this->getService(), __FUNCTION__, $this->getMyAuth(), MESSAGES["FAILED"]);
return redirect()->back()->withInput()->with('error', $e->getMessage());
}
@ -330,6 +334,7 @@ abstract class CommonController extends BaseController
return $this->getResultPageByActon($this->action);
} catch (\Exception $e) {
$this->getService()->getModel()->transRollback();
LogCollector::debug($e->getMessage());
$this->getMyLogService()->save($this->getService(), __FUNCTION__, $this->getMyAuth(), MESSAGES["FAILED"]);
return redirect()->back()->withInput()->with('error', $e->getMessage());
}
@ -357,6 +362,7 @@ abstract class CommonController extends BaseController
return $this->getResultPageByActon($this->action);
} catch (\Exception $e) {
$this->getService()->getModel()->transRollback();
LogCollector::debug($e->getMessage());
$this->getMyLogService()->save($this->getService(), __FUNCTION__, $this->getMyAuth(), MESSAGES["FAILED"]);
return redirect()->back()->withInput()->with('error', $e->getMessage());
}
@ -401,6 +407,7 @@ abstract class CommonController extends BaseController
return $this->getResultPageByActon($this->action);
} catch (\Exception $e) {
$this->getService()->getModel()->transRollback();
LogCollector::debug($e->getMessage());
$this->getMyLogService()->save($this->getService(), __FUNCTION__, $this->getMyAuth(), MESSAGES["FAILED"]);
return redirect()->back()->withInput()->with('error', $e->getMessage());
}

File diff suppressed because one or more lines are too long

View File

@ -30,8 +30,8 @@ CREATE TABLE `user` (
`name` varchar(20) NOT NULL,
`email` varchar(50) NOT NULL,
`mobile` varchar(20) DEFAULT NULL,
`role` varchar(255) NOT NULL DEFAULT 'use',
`status` varchar(10) NOT NULL DEFAULT 'use',
`role` varchar(255) NOT NULL DEFAULT 'manager',
`status` varchar(10) NOT NULL DEFAULT 'default',
`updated_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
PRIMARY KEY (`uid`),
@ -46,7 +46,7 @@ CREATE TABLE `user` (
LOCK TABLES `user` WRITE;
/*!40000 ALTER TABLE `user` DISABLE KEYS */;
INSERT INTO `user` VALUES (1,'choi.jh','$2y$10$9kUte0xrvEkxtI9CzVaeKeCAxzOR4pKPpsCaQHR1YW7dXsCrTLWeC','최준흠','choi.jh@prime-idc.jp','','manager,cloudflare,firewall,director,master','default','2023-05-31 14:55:51','2023-03-23 06:50:04'),(2,'cho.jh','$2y$10$ot/aUXR/W1n4Q3dZA2dZCOxQrpVb2Bq31Y7xFQS3G6D1gtImmyBjm','조준희','cho.jh@prime-idc.jp',NULL,'manager,cloudflare','default','2023-05-30 14:35:55','2023-03-24 02:20:48'),(4,'kimdy','$2y$10$18uyn94xdprzAnt.oYZ5weAvb8rRLhkz/SdQrjEK7yuGhCr9PlUCC','김동윤','kimdy@prime-idc.jp',NULL,'manager,cloudflare','default','2023-03-24 02:21:50','2023-03-24 02:21:50'),(5,'kimhy','$2y$10$.yEKVqY.F7HoSOZijl4uyeulUtfAQ4EDRiyR2JpgFYBuKw.mZoZvG','김효영','khy@prime-idc.jp',NULL,'manager,cloudflare,director','default','2023-03-24 02:23:18','2023-03-24 02:23:18'),(6,'kim.eh','$2y$10$YmwicI.Br4XNyGamfRADMOu.qlkwKd2fmnNkL7YIkNHGndvqYPnCq','김은혁','kim.eh@prime-idc.jp',NULL,'manager,cloudflare','default','2023-03-24 02:23:52','2023-03-24 02:23:52'),(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'),(8,'jinmingyu','$2y$10$PI8WA6d/z4hDE6hxJoUhbuMH3vTTWH0Ry2Z6fTLUUpwQGaE/9bEZa','김명옥','jinmingyu@idcjp.jp',NULL,'manager,cloudflare','default','2023-07-21 06:48:39','2023-03-24 02:25:00'),(9,'kangdh','$2y$10$gu9OS2DDQQ5H.Hh61t3BSOUp87l35q.xsduVSxvCcn8IgA4jrATgG','강동헌','kang.dh@idcjp.jp',NULL,'manager,cloudflare','default','2023-06-22 23:59:07','2023-03-24 02:25:48'),(10,'yoohs','$2y$10$TGASk98FuZ6Ux6FDquu1aO3rztA01MCle/Vs1.3iaEMQzakAbCzJy','유혜성','yoo.hs@idcjp.jp',NULL,'manager,cloudflare','default','2023-06-02 02:07:19','2023-03-24 02:26:31'),(11,'kim.yh','$2y$10$8GciQXpKYiR3TDWQfh9JjOQAQ.YWGoOSCL0a0/w4XACO0mUgjjbWy','김영환','kim.yh@idcjp.jp',NULL,'manager,cloudflare,firewall','default','2023-10-16 23:08:51','2023-03-24 02:27:05'),(12,'yunmuj','$2y$10$zkgwGVj2JSOVIsxLe8fePe1gvWWaCemfZMktzBlrN8oLb3CKydkZC','윤무정','yunmuj@idcjp.jp',NULL,'manager,cloudflare','default','2024-06-12 00:21:07','2023-03-24 02:27:59'),(13,'kim.mt','$2y$10$3dfkA0oq4LqiJOmjbBGKe.p0Dhj/MDqjoTdw11BOPF/H2qJqnEuHO','김문태','kim.mt@idcjp.jp',NULL,'manager,cloudflare','default','2023-05-31 14:22:43','2023-03-24 02:28:31'),(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'),(15,'park.sm','$2y$10$BwMxw0uvw2tAdQ0EZQ2/hu.Q7zYu7mbuBPPRTaa14bwG3VLf0cXfu','박선미','park.sm@idcjp.jp',NULL,'manager,cloudflare','default','2024-03-12 02:14:09','2023-03-24 02:29:34'),(19,'park.hg','$2y$10$x7QQOkOEJHVKOnghbHBqYuI12Vsa9KLV8W4wgebCWy1pZiM93/W.e','박혁규','park.hg@prime-idc.jp',NULL,'manager','unuse','2023-09-04 10:27:32','2023-09-04 09:48:02'),(21,'masakuni','$2y$10$di6Y7CqJGbbf72kDyCrOCOafJgk3vqJCYg6N3EtBUc3J6r24/7SFe','김창국','masakuni@prime-idc.jp',NULL,'cloudflare','unuse','2023-12-18 08:56:29','2023-12-18 08:56:29'),(22,'bjh','$2y$10$LnEQ6kz4igRPZeDYwe7UluRiSaMVGN9Jj1fW3QqUUp6zPeLJW9goS','배장훈','bjh@prime-idc.jp',NULL,'cloudflare','unuse','2024-06-06 23:51:19','2024-02-26 01:26:20'),(23,'cho.sh','$2y$10$jmmNrEsFmb2.Zj3OkBXDHuktrIj.NCP/tO2k9kquFBTBssa/lNG6y','조성호','cho.sh@prime-idc.jp','','manager','unuse','2024-10-02 00:45:19','2024-10-02 00:32:30'),(24,'kobn','$2y$10$pWM/XFfSNeSng32sypbDX.WaR4UlM4EDkYKCQfFkYIOC7Ppg0nc5G','고병남','ko@prime-idc.jp',NULL,'manager,cloudflare','default',NULL,'2024-10-29 06:30:19'),(25,'jeong.sg','$2y$10$OzH6140JztiUEs4s/VHbPOxfxubFooqwqVhGpdFG8OJCGAFXNu546','정상구','jeong.sg@prime-idc.jp',NULL,'manager,cloudflare','default','2025-01-23 00:30:13','2025-01-23 00:29:46'),(38,'choi.jh234222222','$2y$10$zCgVXnCClLbftgeGxH0rk.v3o1zHkoO8Ywq2UDmGkdjIhK5mLJhvu','adfasdfas2222','postfixadmin@idcjp.jp2222222','043443432722222','cloudflare','pause',NULL,'2025-05-02 04:49:19'),(40,'choi.jh2342222224','$2y$10$hP/z5Nojh4eNKnTxZe3Cm.0NtvqHW2U2U0vvVDSzelKRaXSxlVj2y','adfasdfas22222221234','postfixadmin@idcjp.jp3234343','04344343271234','manager,cloudflare','pause',NULL,'2025-05-02 06:34:43');
INSERT INTO `user` VALUES (1,'choi.jh','$2y$10$9kUte0xrvEkxtI9CzVaeKeCAxzOR4pKPpsCaQHR1YW7dXsCrTLWeC','최준흠','choi.jh@prime-idc.jp','','manager,cloudflare,firewall,director,master','default','2023-05-31 14:55:51','2023-03-23 06:50:04'),(2,'cho.jh','$2y$10$ot/aUXR/W1n4Q3dZA2dZCOxQrpVb2Bq31Y7xFQS3G6D1gtImmyBjm','조준희','cho.jh@prime-idc.jp',NULL,'manager,cloudflare','default','2023-05-30 14:35:55','2023-03-24 02:20:48'),(4,'kimdy','$2y$10$18uyn94xdprzAnt.oYZ5weAvb8rRLhkz/SdQrjEK7yuGhCr9PlUCC','김동윤','kimdy@prime-idc.jp',NULL,'manager,cloudflare','default','2023-03-24 02:21:50','2023-03-24 02:21:50'),(5,'kimhy','$2y$10$.yEKVqY.F7HoSOZijl4uyeulUtfAQ4EDRiyR2JpgFYBuKw.mZoZvG','김효영','khy@prime-idc.jp',NULL,'manager,cloudflare,director','default','2023-03-24 02:23:18','2023-03-24 02:23:18'),(6,'kim.eh','$2y$10$YmwicI.Br4XNyGamfRADMOu.qlkwKd2fmnNkL7YIkNHGndvqYPnCq','김은혁','kim.eh@prime-idc.jp',NULL,'manager,cloudflare','default','2023-03-24 02:23:52','2023-03-24 02:23:52'),(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'),(8,'jinmingyu','$2y$10$PI8WA6d/z4hDE6hxJoUhbuMH3vTTWH0Ry2Z6fTLUUpwQGaE/9bEZa','김명옥','jinmingyu@idcjp.jp',NULL,'manager,cloudflare','default','2023-07-21 06:48:39','2023-03-24 02:25:00'),(9,'kangdh','$2y$10$gu9OS2DDQQ5H.Hh61t3BSOUp87l35q.xsduVSxvCcn8IgA4jrATgG','강동헌','kang.dh@idcjp.jp',NULL,'manager,cloudflare','default','2023-06-22 23:59:07','2023-03-24 02:25:48'),(10,'yoohs','$2y$10$TGASk98FuZ6Ux6FDquu1aO3rztA01MCle/Vs1.3iaEMQzakAbCzJy','유혜성','yoo.hs@idcjp.jp',NULL,'manager,cloudflare','default','2023-06-02 02:07:19','2023-03-24 02:26:31'),(11,'kim.yh','$2y$10$8GciQXpKYiR3TDWQfh9JjOQAQ.YWGoOSCL0a0/w4XACO0mUgjjbWy','김영환','kim.yh@idcjp.jp',NULL,'manager,cloudflare,firewall','default','2023-10-16 23:08:51','2023-03-24 02:27:05'),(12,'yunmuj','$2y$10$zkgwGVj2JSOVIsxLe8fePe1gvWWaCemfZMktzBlrN8oLb3CKydkZC','윤무정','yunmuj@idcjp.jp',NULL,'manager,cloudflare','default','2024-06-12 00:21:07','2023-03-24 02:27:59'),(13,'kim.mt','$2y$10$3dfkA0oq4LqiJOmjbBGKe.p0Dhj/MDqjoTdw11BOPF/H2qJqnEuHO','김문태','kim.mt@idcjp.jp',NULL,'manager,cloudflare','default','2023-05-31 14:22:43','2023-03-24 02:28:31'),(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'),(15,'park.sm','$2y$10$BwMxw0uvw2tAdQ0EZQ2/hu.Q7zYu7mbuBPPRTaa14bwG3VLf0cXfu','박선미','park.sm@idcjp.jp',NULL,'manager,cloudflare','default','2024-03-12 02:14:09','2023-03-24 02:29:34'),(19,'park.hg','$2y$10$x7QQOkOEJHVKOnghbHBqYuI12Vsa9KLV8W4wgebCWy1pZiM93/W.e','박혁규','park.hg@prime-idc.jp',NULL,'manager','pause','2023-09-04 10:27:32','2023-09-04 09:48:02'),(21,'masakuni','$2y$10$di6Y7CqJGbbf72kDyCrOCOafJgk3vqJCYg6N3EtBUc3J6r24/7SFe','김창국','masakuni@prime-idc.jp',NULL,'cloudflare','pause','2023-12-18 08:56:29','2023-12-18 08:56:29'),(22,'bjh','$2y$10$LnEQ6kz4igRPZeDYwe7UluRiSaMVGN9Jj1fW3QqUUp6zPeLJW9goS','배장훈','bjh@prime-idc.jp',NULL,'cloudflare','pause','2024-06-06 23:51:19','2024-02-26 01:26:20'),(23,'cho.sh','$2y$10$jmmNrEsFmb2.Zj3OkBXDHuktrIj.NCP/tO2k9kquFBTBssa/lNG6y','조성호','cho.sh@prime-idc.jp','','manager','pause','2024-10-02 00:45:19','2024-10-02 00:32:30'),(24,'kobn','$2y$10$pWM/XFfSNeSng32sypbDX.WaR4UlM4EDkYKCQfFkYIOC7Ppg0nc5G','고병남','ko@prime-idc.jp',NULL,'manager,cloudflare','default',NULL,'2024-10-29 06:30:19'),(25,'jeong.sg','$2y$10$OzH6140JztiUEs4s/VHbPOxfxubFooqwqVhGpdFG8OJCGAFXNu546','정상구','jeong.sg@prime-idc.jp',NULL,'manager,cloudflare','default','2025-01-23 00:30:13','2025-01-23 00:29:46'),(38,'choi.jh234222222','$2y$10$zCgVXnCClLbftgeGxH0rk.v3o1zHkoO8Ywq2UDmGkdjIhK5mLJhvu','adfasdfas2222','postfixadmin@idcjp.jp2222222','043443432722222','cloudflare','pause',NULL,'2025-05-02 04:49:19'),(40,'choi.jh2342222224','$2y$10$hP/z5Nojh4eNKnTxZe3Cm.0NtvqHW2U2U0vvVDSzelKRaXSxlVj2y','adfasdfas22222221234','postfixadmin@idcjp.jp3234343','04344343271234','manager,cloudflare','pause',NULL,'2025-05-02 06:34:43');
/*!40000 ALTER TABLE `user` ENABLE KEYS */;
UNLOCK TABLES;
@ -64,7 +64,7 @@ CREATE TABLE `logger` (
`method_name` varchar(255) DEFAULT NULL,
`title` varchar(255) NOT NULL,
`content` text NOT NULL,
`status` varchar(20) DEFAULT 'use',
`status` varchar(20) DEFAULT 'default',
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
PRIMARY KEY (`uid`)
) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci COMMENT='작업 기록 로그';

View File

@ -4,13 +4,13 @@
"settings": {
"width": 4000,
"height": 4000,
"scrollTop": -1917.7631,
"scrollLeft": -986.5658,
"scrollTop": -705.0313,
"scrollLeft": -1854.3014,
"zoomLevel": 0.82,
"show": 511,
"database": 4,
"databaseName": "",
"canvasType": "@dineug/erd-editor/builtin-schema-sql",
"canvasType": "ERD",
"language": 1,
"tableNameCase": 4,
"columnNameCase": 2,
@ -144,6 +144,7 @@
"n61V7aSxLmcIeQqsYgAEE",
"5hP5ZiQGWDGf4HJrOiFb6",
"XPpipgVUsGKsXCW5YNg1X",
"zFbEbi2-nyWp4zEvOHsUG",
"02r_3OPPiD_vAgD7rmZK4",
"Vb_CyMe0qvi7oxda4dUVW",
"6JNus18UqajPfwOjkPali",
@ -158,6 +159,7 @@
"XPpipgVUsGKsXCW5YNg1X",
"fMx3gLKi1fsfp7g26-QA9",
"xEoc72X0ErdGKU7rMzenm",
"zFbEbi2-nyWp4zEvOHsUG",
"02r_3OPPiD_vAgD7rmZK4",
"Vb_CyMe0qvi7oxda4dUVW",
"Ksp65Qh_aOFmAb1ksx64Q",
@ -169,14 +171,14 @@
],
"ui": {
"x": 1170.0947,
"y": 848.1356,
"y": 777.4039,
"zIndex": 2,
"widthName": 60,
"widthComment": 60,
"color": ""
},
"meta": {
"updateAt": 1747297809127,
"updateAt": 1747888111107,
"createAt": 1745819764137
}
},
@ -8141,6 +8143,26 @@
"updateAt": 1747877006519,
"createAt": 1747877006518
}
},
"zFbEbi2-nyWp4zEvOHsUG": {
"id": "zFbEbi2-nyWp4zEvOHsUG",
"tableId": "6ajvOCaGuXU9pzV0Y9jEi",
"name": "account_balance",
"comment": "예치금",
"dataType": "INT",
"default": "0",
"options": 8,
"ui": {
"keys": 0,
"widthName": 90,
"widthComment": 60,
"widthDataType": 60,
"widthDefault": 60
},
"meta": {
"updateAt": 1747888103295,
"createAt": 1747888079555
}
}
},
"relationshipEntities": {
@ -8155,7 +8177,7 @@
"_AcWUYKzNJd-V0fRHq8Cx"
],
"x": 1170.0947,
"y": 922.1356,
"y": 857.4039,
"direction": 1
},
"end": {
@ -8183,7 +8205,7 @@
"_AcWUYKzNJd-V0fRHq8Cx"
],
"x": 1170.0947,
"y": 1070.1356,
"y": 1017.4039,
"direction": 1
},
"end": {
@ -8376,8 +8398,8 @@
"columnIds": [
"_AcWUYKzNJd-V0fRHq8Cx"
],
"x": 1699.0947,
"y": 922.1356,
"x": 1701.0947,
"y": 857.4039,
"direction": 2
},
"end": {
@ -8404,8 +8426,8 @@
"columnIds": [
"_AcWUYKzNJd-V0fRHq8Cx"
],
"x": 1434.5947,
"y": 848.1356,
"x": 1435.5947,
"y": 777.4039,
"direction": 4
},
"end": {
@ -8516,8 +8538,8 @@
"columnIds": [
"_AcWUYKzNJd-V0fRHq8Cx"
],
"x": 1699.0947,
"y": 1070.1356,
"x": 1701.0947,
"y": 1017.4039,
"direction": 2
},
"end": {

View File

@ -27,19 +27,22 @@ abstract class CommonEntity extends Entity
$field = constant("static::TITLE");
return $this->attributes[$field];
}
final public function isMatched(string $field, string $value): bool
{
return $this->attributes[$field] == $value;
}
final public function getUpdatedAt(): string|null
{
return $this->attributes['updated_at'];
}
final public function setUpdatedAt(string $value): void
{
$this->attributes['updated_at'] = $value;
}
final public function getCreatedAt(): string
{
return $this->attributes['created_at'];
}
//공통부분
final public function isMatched(string $field, string $value): bool
{
return $this->attributes[$field] == $value;
}
public function getStatus(): string|null
{
return $this->attributes['status'] ?? null;

View File

@ -12,16 +12,16 @@ class ClientEntity extends CustomerEntity
{
return $this->attributes['role'];
}
public function getAccount(): int
public function getAccountBalance(): int
{
return $this->attributes['account_balance'];
return intval($this->attributes['account_balance']);
}
public function getCoupon(): int
public function getCouponBalance(): int
{
return $this->attributes['coupon_balance'];
return intval($this->attributes['coupon_balance']);
}
public function getPoint(): int
public function getPointBalance(): int
{
return $this->attributes['point_balance'];
return intval($this->attributes['point_balance']);
}
}

View File

@ -11,7 +11,7 @@ abstract class CustomerEntity extends CommonEntity
parent::__construct($data);
}
final public function getClient()
final public function getClientInfoUID()
{
return $this->attributes['clientinfo_uid'];
}

View File

@ -11,7 +11,7 @@ abstract class EquipmentEntity extends CommonEntity
parent::__construct($data);
}
public function getServer()
public function getServerInfoUID()
{
return $this->attributes['serverinfo_uid'];
}

View File

@ -8,4 +8,8 @@ class CpuEntity extends LinkEntity
{
const PK = CpuModel::PK;
const TITLE = CpuModel::TITLE;
public function getLinkInfoUID(): string
{
return $this->attributes['cpuinfo_uid'];
}
}

View File

@ -8,4 +8,8 @@ class DiskEntity extends LinkEntity
{
const PK = DiskModel::PK;
const TITLE = DiskModel::TITLE;
public function getLinkInfoUID(): string
{
return $this->attributes['diskinfo_uid'];
}
}

View File

@ -11,12 +11,21 @@ abstract class LinkEntity extends EquipmentEntity
{
parent::__construct($data);
}
public function getServerInfoUID(): string
abstract public function getLinkInfoUID(): string;
final public function getServiceInfoUID(): string
{
return $this->attributes['serverinfo_uid'];
}
public function getPartInfoUID(): string
final public function getServerInfoUID(): string
{
return $this->attributes['cpuinfo_uid'];
return $this->attributes['serverinfo_uid'];
}
final public function getBillingType(): string
{
return $this->attributes['billing_type'];
}
final public function getAmount(): string
{
return $this->attributes['amount'];
}
}

View File

@ -8,4 +8,8 @@ class RamEntity extends LinkEntity
{
const PK = RamModel::PK;
const TITLE = RamModel::TITLE;
public function getLinkInfoUID(): string
{
return $this->attributes['raminfo_uid'];
}
}

View File

@ -0,0 +1,16 @@
<?php
namespace App\Helpers\Equipment\Link;
use App\Models\Equipment\Link\CpuModel;
use CodeIgniter\HTTP\IncomingRequest;
class CpuHelper extends LinkHelper
{
protected ?IncomingRequest $request = null;
public function __construct(?IncomingRequest $request = null)
{
parent::__construct($request);
$this->setTitleField(field: CpuModel::TITLE);
}
}

View File

@ -0,0 +1,16 @@
<?php
namespace App\Helpers\Equipment\Link;
use App\Models\Equipment\Link\DiskModel;
use CodeIgniter\HTTP\IncomingRequest;
class DiskHelper extends LinkHelper
{
protected ?IncomingRequest $request = null;
public function __construct(?IncomingRequest $request = null)
{
parent::__construct($request);
$this->setTitleField(field: DiskModel::TITLE);
}
}

View File

@ -0,0 +1,14 @@
<?php
namespace App\Helpers\Equipment\Link;
use App\Helpers\Equipment\EquipmentHelper;
use CodeIgniter\HTTP\IncomingRequest;
abstract class LinkHelper extends EquipmentHelper
{
protected function __construct(?IncomingRequest $request = null)
{
parent::__construct($request);
}
}

View File

@ -0,0 +1,16 @@
<?php
namespace App\Helpers\Equipment\Link;
use App\Models\Equipment\Link\RamModel;
use CodeIgniter\HTTP\IncomingRequest;
class RamHelper extends LinkHelper
{
protected ?IncomingRequest $request = null;
public function __construct(?IncomingRequest $request = null)
{
parent::__construct($request);
$this->setTitleField(field: RamModel::TITLE);
}
}

View File

@ -30,7 +30,7 @@ class ServerHelper extends EquipmentHelper
'변경',
$field,
[
"data-src" => "/admin/equipment/serverpart?type={$field}&serverinfo_uid={$viewDatas['entity']->getPK()}",
"data-src" => "/admin/equipment/link/" . strtolower($field) . "?&serverinfo_uid={$viewDatas['entity']->getPK()}",
"data-bs-toggle" => "modal",
"data-bs-target" => "#index_action_form",
...$extras

View File

@ -0,0 +1,13 @@
<?php
return [
'title' => "CPU연결정보",
'label' => [
'billing_type' => "청구유형",
'serviceinfo_uid' => "서비스",
'serverinfo_uid' => "서버",
'cpuinfo_uid' => "CPU",
'amount' => "금액",
'updated_at' => "수정일",
'created_at' => "작성일",
],
];

View File

@ -0,0 +1,13 @@
<?php
return [
'title' => "Disk연결정보",
'label' => [
'billing_type' => "청구유형",
'serviceinfo_uid' => "서비스",
'serverinfo_uid' => "서버",
'diskinfo_uid' => "Disk",
'amount' => "금액",
'updated_at' => "수정일",
'created_at' => "작성일",
],
];

View File

@ -0,0 +1,13 @@
<?php
return [
'title' => "Ram연결정보",
'label' => [
'billing_type' => "청구유형",
'serviceinfo_uid' => "서비스",
'serverinfo_uid' => "서버",
'raminfo_uid' => "RAM",
'amount' => "금액",
'updated_at' => "수정일",
'created_at' => "작성일",
],
];

View File

@ -71,8 +71,8 @@ abstract class GoogleSocket extends MySocket
}
}
//상태가 use(승인완료)가 아니라면
if ($entity->getStatus() !== 'use') {
throw new PageNotFoundException("{$entity->getSite()}{$entity->getEmail()}:{$entity->getTitle()}님은 {$entity->status}입니다 ");
if ($entity->getStatus() !== DEFAULTS['STATUS']) {
throw new PageNotFoundException(message: "{$entity->getSite()}{$entity->getEmail()}:{$entity->getTitle()}님은 {$entity->status}입니다 ");
}
return $entity;
}

View File

@ -123,14 +123,14 @@ abstract class CommonModel extends Model
return $rule;
}
// create, modify 직전 작업용 작업
protected function convertEntityData(string $field, array $formDatas): mixed
protected function convertEntityData(string $field, array $formDatas, mixed $entity): mixed
{
switch ($field) {
case $this->getPKField():
// $formDatas에 전달된 값이 없는 경우
if (!array_key_exists($field, $formDatas)) {
$randomBytes = bin2hex(random_bytes(32));
$value = sprintf(
$entity->$field = sprintf(
'%08s-%04s-%04x-%04x-%12s',
substr($randomBytes, 0, 8),
substr($randomBytes, 8, 4),
@ -139,17 +139,19 @@ abstract class CommonModel extends Model
substr($randomBytes, 20, 12)
);
} else {
$value = $formDatas[$field];
$entity->$field = $formDatas[$field];
}
break;
case "editor": // content 등 textarea를 사용한 Field
$value = htmlentities($formDatas[$field], ENT_QUOTES);
case "content": // content 등 textarea를 사용한 Field
case "discription": // content 등 textarea를 사용한 Field
$entity->$field = htmlentities($formDatas[$field], ENT_QUOTES);
break;
default:
$value = $formDatas[$field];
$entity->$field = $formDatas[$field];
break;
}
return $value;
return $entity;
}
private function save_process(mixed $entity): mixed
@ -176,9 +178,10 @@ abstract class CommonModel extends Model
{
// Field에 맞는 Validation Rule 재정의
$this->setValidationRules($this->getFieldRules(__FUNCTION__, $this->allowedFields));
LogCollector::debug("입력내용");
LogCollector::debug(var_export($formDatas, true));
foreach (array_keys($formDatas) as $field) {
$value = $this->convertEntityData($field, $formDatas);
$entity->$field = $value;
$entity = $this->convertEntityData($field, $formDatas, $entity);
}
// primaryKey가 자동입력이 아니면
if (!$this->useAutoIncrement) {
@ -191,7 +194,7 @@ abstract class CommonModel extends Model
$pkField = $this->getPKField();
$entity->$pkField = $this->getInsertID();
}
LogCollector::debug("[{$entity->getTitle()}] 입력내용");
LogCollector::debug("[{$entity->getPK()}/{$entity->getTitle()}] 입력내용");
LogCollector::debug(var_export($entity->toArray(), true));
return $entity;
}
@ -201,12 +204,13 @@ abstract class CommonModel extends Model
$this->setValidationRules($this->getFieldRules(__FUNCTION__, $this->allowedFields));
// 저장하기 전에 데이터 값 변경이 필요한 Field
LogCollector::debug("[{$entity->getPK()}/{$entity->getTitle()}] 변경 전 내용");
LogCollector::debug(var_export($formDatas, true));
LogCollector::debug(var_export($entity->toArray(), true));
foreach (array_keys($formDatas) as $field) {
$entity->$field = $this->convertEntityData($field, $formDatas);
$entity = $this->convertEntityData($field, $formDatas, $entity);
}
//수정일추가
$entity->updated_at = date("Y-m-d H:i:s");
$entity->setUpdatedAt(date("Y-m-d H:i:s"));
LogCollector::debug("[{$entity->getPK()}/{$entity->getTitle()}] 변경 후 내용");
LogCollector::debug(var_export($entity->toArray(), true));
return $this->save_process($entity);

View File

@ -36,10 +36,8 @@ class AccountModel extends CustomerModel
break;
case "title":
case "alias":
$rule = "required|trim|string";
break;
case "status":
$rule = "required|in_list[in,out]";
$rule = "required|trim|string";
break;
default:
$rule = parent::getFieldRule($action, $field);

View File

@ -44,7 +44,7 @@ class ClientModel extends CustomerModel
case "account_balance":
case "coupon_balance":
case "point_balance":
$rule = "if_exist|trim|numeric";
$rule = "if_exist|numeric";
break;
default:
$rule = parent::getFieldRule($action, $field);

View File

@ -34,10 +34,8 @@ class CouponModel extends CustomerModel
$rule = "required|numeric";
break;
case "title":
$rule = "required|trim|string";
break;
case "status":
$rule = "required|in_list[in,out]";
$rule = "required|trim|string";
break;
default:
$rule = parent::getFieldRule($action, $field);

View File

@ -34,10 +34,8 @@ class PointModel extends CustomerModel
$rule = "required|numeric";
break;
case "title":
$rule = "required|trim|string";
break;
case "status":
$rule = "required|in_list[in,out]";
$rule = "required|trim|string";
break;
default:
$rule = parent::getFieldRule($action, $field);

View File

@ -45,4 +45,18 @@ class LineModel extends EquipmentModel
}
return $rule;
}
protected function convertEntityData(string $field, array $formDatas, mixed $entity): mixed
{
switch ($field) {
case 'clientinfo_uid':
if (array_key_exists($field, $formDatas) && $formDatas[$field] !== '') {
$entity->$field = $formDatas[$field];
}
break;
default:
$entity = parent::convertEntityData($field, $formDatas, $entity);
break;
}
return $entity;
}
}

View File

@ -2,14 +2,24 @@
namespace App\Models\Equipment\Link;
use App\Entities\Equipment\Link\CpuEntity;
class CpuModel extends LinkModel
{
const TABLE = "serverinfos_cpuinfos";
const TABLE = "cpuinfo_link";
const PK = "uid";
const TITLE = "uid";
protected $table = self::TABLE;
protected $primaryKey = self::PK;
protected $returnType = CpuEntity::class;
protected $allowedFields = [
"serviceinfo_uid",
"serverinfo_uid",
"cpuinfo_uid",
"billing_type",
"amount",
"updated_at",
];
public function __construct()
{
parent::__construct();

View File

@ -2,14 +2,24 @@
namespace App\Models\Equipment\Link;
use App\Entities\Equipment\Link\DiskEntity;
class DiskModel extends LinkModel
{
const TABLE = "serverinfos_diskinfos";
const TABLE = "diskinfo_link";
const PK = "uid";
const TITLE = "uid";
protected $table = self::TABLE;
protected $primaryKey = self::PK;
protected $returnType = DiskEntity::class;
protected $allowedFields = [
"serviceinfo_uid",
"serverinfo_uid",
"diskinfo_uid",
"billing_type",
"amount",
"updated_at",
];
public function __construct()
{
parent::__construct();

View File

@ -6,25 +6,26 @@ use App\Models\Equipment\EquipmentModel;
abstract class LinkModel extends EquipmentModel
{
// protected $returnType = CpuEntity::class;
protected $allowedFields = [
"serverinfo_uid",
"cpuinfo_uid",
];
protected function __construct()
{
parent::__construct();
}
public function getFieldRule(string $action, string $field): string
final public function getFieldRule(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":
case "serverinfo_uid":
case "cpuinfo_uid":
case "raminfo_uid":
case "diskinfo_uid":
$rule = "required|trim|string";
break;
case "amount":
$rule = "required|numeric";
break;
default:
$rule = parent::getFieldRule($action, $field);
break;

View File

@ -2,14 +2,24 @@
namespace App\Models\Equipment\Link;
use App\Entities\Equipment\Link\RamEntity;
class RamModel extends LinkModel
{
const TABLE = "serverinfos_raminfos";
const TABLE = "raminfo_link";
const PK = "uid";
const TITLE = "uid";
protected $table = self::TABLE;
protected $primaryKey = self::PK;
protected $returnType = RamEntity::class;
protected $allowedFields = [
"serviceinfo_uid",
"serverinfo_uid",
"raminfo_uid",
"billing_type",
"amount",
"updated_at",
];
public function __construct()
{
parent::__construct();

View File

@ -12,28 +12,8 @@ class CpuModel extends PartModel
protected $table = self::TABLE;
protected $primaryKey = self::PK;
protected $returnType = CpuEntity::class;
protected $allowedFields = [
"model",
"status",
"updated_at"
];
public function __construct()
{
parent::__construct();
}
public function getFieldRule(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";
break;
default:
$rule = parent::getFieldRule($action, $field);
break;
}
return $rule;
}
}

View File

@ -12,28 +12,8 @@ class DiskModel extends PartModel
protected $table = self::TABLE;
protected $primaryKey = self::PK;
protected $returnType = DiskEntity::class;
protected $allowedFields = [
"model",
"status",
"updated_at"
];
public function __construct()
{
parent::__construct();
}
public function getFieldRule(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";
break;
default:
$rule = parent::getFieldRule($action, $field);
break;
}
return $rule;
}
}

View File

@ -6,8 +6,28 @@ use App\Models\Equipment\EquipmentModel;
abstract class PartModel extends EquipmentModel
{
protected $allowedFields = [
"model",
"status",
"updated_at"
];
protected function __construct()
{
parent::__construct();
}
final public function getFieldRule(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";
break;
default:
$rule = parent::getFieldRule($action, $field);
break;
}
return $rule;
}
}

View File

@ -12,28 +12,9 @@ class RamModel extends PartModel
protected $table = self::TABLE;
protected $primaryKey = self::PK;
protected $returnType = RamEntity::class;
protected $allowedFields = [
"model",
"status",
"updated_at"
];
public function __construct()
{
parent::__construct();
}
public function getFieldRule(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";
break;
default:
$rule = parent::getFieldRule($action, $field);
break;
}
return $rule;
}
}

View File

@ -3,7 +3,6 @@
namespace App\Models;
use App\Entities\MyLogEntity;
use App\Models\CommonModel;
class MyLogModel extends CommonModel
{

View File

@ -3,7 +3,6 @@
namespace App\Models;
use App\Entities\UserEntity;
use App\Models\CommonModel;
class UserModel extends CommonModel
{
@ -50,29 +49,26 @@ class UserModel extends CommonModel
case "role":
$rule = "required|trim|string";
break;
case "status":
$rule = "if_exist|in_list[use,pause]";
break;
default:
$rule = parent::getFieldRule($action, $field);
break;
}
return $rule;
}
protected function convertEntityData(string $field, array $formDatas): mixed
protected function convertEntityData(string $field, array $formDatas, mixed $entity): mixed
{
switch ($field) {
case "passwd":
$value = password_hash($formDatas[$field], PASSWORD_DEFAULT);
$entity->$field = password_hash($formDatas[$field], PASSWORD_DEFAULT);
break;
case "confirmpassword":
$value = password_hash($formDatas[$field], PASSWORD_DEFAULT);
$entity->$field = password_hash($formDatas[$field], PASSWORD_DEFAULT);
break;
default:
$value = parent::convertEntityData($field, $formDatas);
$entity = parent::convertEntityData($field, $formDatas, $entity);
break;
}
return $value;
return $entity;
}
//List 검색용
public function setList_WordFilter(string $word): void

View File

@ -3,7 +3,6 @@
namespace App\Models;
use App\Entities\UserSNSEntity;
use App\Models\CommonModel;
class UserSNSModel extends CommonModel
{
@ -61,17 +60,17 @@ class UserSNSModel extends CommonModel
}
return $rule;
}
protected function convertEntityData(string $field, array $formDatas): mixed
protected function convertEntityData(string $field, array $formDatas, mixed $entity): mixed
{
switch ($field) {
case "detail": //content등 textarea를 사용한 Field
$value = htmlentities($formDatas[$field], ENT_QUOTES);
$entity->$field = htmlentities($formDatas[$field], ENT_QUOTES);
break;
default:
$value = parent::convertEntityData($field, $formDatas);
$entity = parent::convertEntityData($field, $formDatas, $entity);
break;
}
return $value;
return $entity;
}
//List 검색용
public function setList_WordFilter(string $word): void

View File

@ -41,7 +41,7 @@ class LocalService extends AuthService
public function checkUser(array $formDatas): UserEntity
{
$entity = $this->getEntity(['id' => $formDatas['id'], 'status' => 'use']);
$entity = $this->getEntity(['id' => $formDatas['id'], 'status' => DEFAULTS['STATUS']]);
if (is_null($entity)) {
throw new \Exception("사용자ID: {$formDatas['id']}가 존재하지 않습니다.");
}

View File

@ -92,20 +92,6 @@ abstract class CommonService
}
return $rule;
}
final public function getFormFieldOption(string $field, mixed $where = null): array
{
$options = [];
switch ($field) {
default:
foreach ($this->getEntities($where) as $entity) {
$options[$entity->getPK()] = $entity->getTitle();
}
break;
}
// dd($options);
return $options;
}
public function create(array $formDatas, mixed $entity = null): mixed
{
$entity = $this->getModel()->create($formDatas, $entity ?? $this->getEntityClass());

View File

@ -1,46 +0,0 @@
<?php
namespace App\Services\Customer;
use CodeIgniter\HTTP\IncomingRequest;
use App\Entities\Customer\ServicePartEntity;
use App\Models\Customer\ServicePartModel;
class ServicePartService extends CustomerService
{
protected ?IncomingRequest $request = null;
public function __construct(?IncomingRequest $request = null)
{
parent::__construct($request);
}
public function getClassName(): string
{
return parent::getClassName() . DIRECTORY_SEPARATOR . "ServicePart";
}
public function getModelClass(): ServicePartModel
{
return new ServicePartModel();
}
public function getEntityClass(): ServicePartEntity
{
return new ServicePartEntity();
}
public function getFields(): array
{
return [
"serviceinfo_uid",
"partinfo_uid",
"billing_type",
"amount",
];
}
public function getFilterFields(): array
{
return ["serviceinfo_uid", "billing_type", "partinfo_uid"];
}
public function getBatchJobFields(): array
{
return ["billing_type", "partinfo_uid"];
}
}

View File

@ -25,4 +25,15 @@ class CpuService extends LinkService
{
return new CpuEntity();
}
public function getFields(): array
{
return [
"billing_type",
"serviceinfo_uid",
"serverinfo_uid",
"cpuinfo_uid",
"amount",
];
}
}

View File

@ -25,4 +25,15 @@ class DiskService extends LinkService
{
return new DiskEntity();
}
public function getFields(): array
{
return [
"billing_type",
"serviceinfo_uid",
"serverinfo_uid",
"diskinfo_uid",
"amount",
];
}
}

View File

@ -17,13 +17,6 @@ abstract class LinkService extends EquipmentService
return parent::getClassName() . DIRECTORY_SEPARATOR . "Link";
}
public function getFields(): array
{
return [
"serverinfo_uid",
"cpuinfo_uid",
];
}
public function getFilterFields(): array
{
return [];

View File

@ -25,4 +25,15 @@ class RamService extends LinkService
{
return new RamEntity();
}
public function getFields(): array
{
return [
"billing_type",
"serviceinfo_uid",
"serverinfo_uid",
"raminfo_uid",
"amount",
];
}
}

View File

@ -1,6 +1,6 @@
<?= $this->extend(LAYOUTS[$viewDatas['layout']]['path']) ?>
<?= $this->section('content') ?>
<?php if ($error = session('error')): ?><?= $viewDatas['helper']->alert($error) ?><?php endif ?>
<?php if ($error = session('error')): ?><div style="border:1px solid red;"><?= $error ?></div><?php endif ?>
<div id="container" class="content">
<link href="/css/<?= $viewDatas['layout'] ?>/form.css" media="screen" rel="stylesheet" type="text/css" />
<script src="/js/<?= $viewDatas['layout'] ?>/form.js" referrerpolicy="origin"></script>

View File

@ -1,6 +1,6 @@
<?= $this->extend(LAYOUTS[$viewDatas['layout']]['path']) ?>
<?= $this->section('content') ?>
<?php if ($error = session('error')): ?><?= $viewDatas['helper']->alert($error) ?><?php endif ?>
<?php if ($error = session('error')): ?><div style="border:1px solid red;"><?= $error ?></div><?php endif ?>
<div class="layout_top"><?= $this->include(LAYOUTS[$viewDatas['layout']]['path'] . '/top'); ?></div>
<!-- Layout Middle Start -->
<table class="layout_middle">

View File

@ -1,6 +1,6 @@
<?= $this->extend(LAYOUTS[$viewDatas['layout']]['path']) ?>
<?= $this->section('content') ?>
<?php if ($error = session('error')): ?><?= $viewDatas['helper']->alert($error) ?><?php endif ?>
<?php if ($error = session('error')): ?><div style="border:1px solid red;"><?= $error ?></div><?php endif ?>
<div id="container" class="content">
<link href="/css/<?= $viewDatas['layout'] ?>/form.css" media="screen" rel="stylesheet" type="text/css" />
<script src="/js/<?= $viewDatas['layout'] ?>/form.js" referrerpolicy="origin"></script>

View File

@ -1,6 +1,6 @@
<?= $this->extend(LAYOUTS[$viewDatas['layout']]['path']) ?>
<?= $this->section('content') ?>
<?php if ($error = session('error')): ?><?= $viewDatas['helper']->alert($error) ?><?php endif ?>
<?php if ($error = session('error')): ?><div style="border:1px solid red;"><?= $error ?></div><?php endif ?>
<div id="container" class="content">
<link href="/css/<?= $viewDatas['layout'] ?>/form.css" media="screen" rel="stylesheet" type="text/css" />
<div class="action_form">