dbmsv2 init...1
This commit is contained in:
parent
4328f6db03
commit
2eb13fdd35
@ -29,6 +29,7 @@ $routes->group('', ['namespace' => 'App\Controllers'], function ($routes) {
|
||||
$routes->get('logout', 'LocalController::logout');
|
||||
});
|
||||
});
|
||||
//Admin 관련
|
||||
$routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'authFilter:manager'], function ($routes) {
|
||||
$routes->get('/', 'Home::index');
|
||||
$routes->group('user', ['namespace' => 'App\Controllers\Admin'], function ($routes) {
|
||||
@ -53,6 +54,7 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au
|
||||
$routes->group('search', ['namespace' => 'App\Controllers\Admin'], function ($routes) {
|
||||
$routes->get('/', 'SearchController::index');
|
||||
});
|
||||
//Customer 관련
|
||||
$routes->group('customer', ['namespace' => 'App\Controllers\Admin\Customer'], function ($routes) {
|
||||
$routes->group('client', ['namespace' => 'App\Controllers\Admin\Customer'], function ($routes) {
|
||||
$routes->get('/', 'ClientController::index');
|
||||
@ -133,20 +135,22 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au
|
||||
$routes->get('download/(:alpha)', 'ServiceItemController::download/$1');
|
||||
});
|
||||
$routes->group('payment', ['namespace' => 'App\Controllers\Admin\Customer'], function ($routes) {
|
||||
$routes->get('/', 'ServicePaymentController::index');
|
||||
$routes->get('create', 'ServicePaymentController::create_form');
|
||||
$routes->post('create', 'ServicePaymentController::create');
|
||||
$routes->get('modify/(:num)', 'ServicePaymentController::modify_form/$1');
|
||||
$routes->post('modify/(:num)', 'ServicePaymentController::modify/$1');
|
||||
$routes->get('view/(:num)', 'ServicePaymentController::view/$1');
|
||||
$routes->get('delete/(:num)', 'ServicePaymentController::delete/$1');
|
||||
$routes->get('toggle/(:num)/(:any)', 'ServicePaymentController::toggle/$1/$2');
|
||||
$routes->post('batchjob', 'ServicePaymentController::batchjob');
|
||||
$routes->post('batchjob_delete', 'ServicePaymentController::batchjob_delete');
|
||||
$routes->get('download/(:alpha)', 'ServicePaymentController::download/$1');
|
||||
$routes->post('invoice', 'ServicePaymentController::invoice', []);
|
||||
$routes->get('/', 'PaymentController::index');
|
||||
$routes->get('create', 'PaymentController::create_form');
|
||||
$routes->post('create', 'PaymentController::create');
|
||||
$routes->get('modify/(:num)', 'PaymentController::modify_form/$1');
|
||||
$routes->post('modify/(:num)', 'PaymentController::modify/$1');
|
||||
$routes->get('view/(:num)', 'PaymentController::view/$1');
|
||||
$routes->get('delete/(:num)', 'PaymentController::delete/$1');
|
||||
$routes->get('toggle/(:num)/(:any)', 'PaymentController::toggle/$1/$2');
|
||||
$routes->post('batchjob', 'PaymentController::batchjob');
|
||||
$routes->post('batchjob_delete', 'PaymentController::batchjob_delete');
|
||||
$routes->get('download/(:alpha)', 'PaymentController::download/$1');
|
||||
$routes->post('invoice', 'PaymentController::invoice', []);
|
||||
});
|
||||
});
|
||||
//Customer 관련
|
||||
//Equipment 관련
|
||||
$routes->group('equipment', ['namespace' => 'App\Controllers\Admin\Equipment'], function ($routes) {
|
||||
$routes->group('switch', ['namespace' => 'App\Controllers\Admin\Equipment'], function ($routes) {
|
||||
$routes->get('/', 'SwitchController::index');
|
||||
@ -174,103 +178,71 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au
|
||||
$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('line', ['namespace' => 'App\Controllers\Admin\Equipment\Part'], function ($routes) {
|
||||
$routes->get('/', 'LineController::index');
|
||||
$routes->get('create', 'LineController::create_form');
|
||||
$routes->post('create', 'LineController::create');
|
||||
$routes->get('modify/(:num)', 'LineController::modify_form/$1');
|
||||
$routes->post('modify/(:num)', 'LineController::modify/$1');
|
||||
$routes->get('view/(:num)', 'LineController::view/$1');
|
||||
$routes->get('delete/(:num)', 'LineController::delete/$1');
|
||||
$routes->get('toggle/(:num)/(:any)', 'LineController::toggle/$1/$2');
|
||||
$routes->post('batchjob', 'LineController::batchjob');
|
||||
$routes->post('batchjob_delete', 'LineController::batchjob_delete');
|
||||
$routes->get('download/(:alpha)', 'LineController::download/$1');
|
||||
});
|
||||
$routes->group('ip', ['namespace' => 'App\Controllers\Admin\Equipment\Part'], function ($routes) {
|
||||
$routes->get('/', 'IpController::index');
|
||||
$routes->get('create', 'IpController::create_form');
|
||||
$routes->post('create', 'IpController::create');
|
||||
$routes->get('modify/(:num)', 'IpController::modify_form/$1');
|
||||
$routes->post('modify/(:num)', 'IpController::modify/$1');
|
||||
$routes->get('view/(:num)', 'IpController::view/$1');
|
||||
$routes->get('delete/(:num)', 'IpController::delete/$1');
|
||||
$routes->get('toggle/(:num)/(:any)', 'IpController::toggle/$1/$2');
|
||||
$routes->post('batchjob', 'IpController::batchjob');
|
||||
$routes->post('batchjob_delete', 'IpController::batchjob_delete');
|
||||
$routes->get('download/(:alpha)', 'IpController::download/$1');
|
||||
});
|
||||
$routes->group('defence', ['namespace' => 'App\Controllers\Admin\Equipment\Part'], function ($routes) {
|
||||
$routes->get('/', 'DefenceController::index');
|
||||
$routes->get('create', 'DefenceController::create_form');
|
||||
$routes->post('create', 'DefenceController::create');
|
||||
$routes->get('modify/(:num)', 'DefenceController::modify_form/$1');
|
||||
$routes->post('modify/(:num)', 'DefenceController::modify/$1');
|
||||
$routes->get('view/(:num)', 'DefenceController::view/$1');
|
||||
$routes->get('delete/(:num)', 'DefenceController::delete/$1');
|
||||
$routes->get('toggle/(:num)/(:any)', 'DefenceController::toggle/$1/$2');
|
||||
$routes->post('batchjob', 'DefenceController::batchjob');
|
||||
$routes->post('batchjob_delete', 'DefenceController::batchjob_delete');
|
||||
$routes->get('download/(:alpha)', 'DefenceController::download/$1');
|
||||
});
|
||||
$routes->group('software', ['namespace' => 'App\Controllers\Admin\Equipment\Part'], function ($routes) {
|
||||
$routes->get('/', 'SoftwareController::index');
|
||||
$routes->get('create', 'SoftwareController::create_form');
|
||||
$routes->post('create', 'SoftwareController::create');
|
||||
$routes->get('modify/(:num)', 'SoftwareController::modify_form/$1');
|
||||
$routes->post('modify/(:num)', 'SoftwareController::modify/$1');
|
||||
$routes->get('view/(:num)', 'SoftwareController::view/$1');
|
||||
$routes->get('delete/(:num)', 'SoftwareController::delete/$1');
|
||||
$routes->get('toggle/(:num)/(:any)', 'SoftwareController::toggle/$1/$2');
|
||||
$routes->post('batchjob', 'SoftwareController::batchjob');
|
||||
$routes->post('batchjob_delete', 'SoftwareController::batchjob_delete');
|
||||
$routes->get('download/(:alpha)', 'SoftwareController::download/$1');
|
||||
});
|
||||
$routes->group('cpu', ['namespace' => 'App\Controllers\Admin\Equipment\Part'], 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\Part'], 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('storage', ['namespace' => 'App\Controllers\Admin\Equipment\Part'], function ($routes) {
|
||||
$routes->get('/', 'StorageController::index');
|
||||
$routes->get('create', 'StorageController::create_form');
|
||||
$routes->post('create', 'StorageController::create');
|
||||
$routes->get('modify/(:num)', 'StorageController::modify_form/$1');
|
||||
$routes->post('modify/(:num)', 'StorageController::modify/$1');
|
||||
$routes->get('view/(:num)', 'StorageController::view/$1');
|
||||
$routes->get('delete/(:num)', 'StorageController::delete/$1');
|
||||
$routes->get('toggle/(:num)/(:any)', 'StorageController::toggle/$1/$2');
|
||||
});
|
||||
$routes->group('domain', ['namespace' => 'App\Controllers\Admin\Equipment\Part'], function ($routes) {
|
||||
$routes->get('/', 'DomainController::index');
|
||||
$routes->get('create', 'DomainController::create_form');
|
||||
$routes->post('create', 'DomainController::create');
|
||||
$routes->get('modify/(:num)', 'DomainController::modify_form/$1');
|
||||
$routes->post('modify/(:num)', 'DomainController::modify/$1');
|
||||
$routes->get('view/(:num)', 'DomainController::view/$1');
|
||||
$routes->get('delete/(:num)', 'DomainController::delete/$1');
|
||||
$routes->get('toggle/(:num)/(:any)', 'DomainController::toggle/$1/$2');
|
||||
$routes->post('batchjob', 'DomainController::batchjob');
|
||||
$routes->post('batchjob_delete', 'DomainController::batchjob_delete');
|
||||
$routes->get('download/(:alpha)', 'DomainController::download/$1');
|
||||
$routes->post('confirm', 'DomainController::confirm');
|
||||
});
|
||||
$routes->group('line', ['namespace' => 'App\Controllers\Admin\Equipment'], function ($routes) {
|
||||
$routes->get('/', 'LineController::index');
|
||||
$routes->get('create', 'LineController::create_form');
|
||||
$routes->post('create', 'LineController::create');
|
||||
$routes->get('modify/(:num)', 'LineController::modify_form/$1');
|
||||
$routes->post('modify/(:num)', 'LineController::modify/$1');
|
||||
$routes->get('view/(:num)', 'LineController::view/$1');
|
||||
$routes->get('delete/(:num)', 'LineController::delete/$1');
|
||||
$routes->get('toggle/(:num)/(:any)', 'LineController::toggle/$1/$2');
|
||||
$routes->post('batchjob', 'LineController::batchjob');
|
||||
$routes->post('batchjob_delete', 'LineController::batchjob_delete');
|
||||
$routes->get('download/(:alpha)', 'LineController::download/$1');
|
||||
});
|
||||
$routes->group('ip', ['namespace' => 'App\Controllers\Admin\Equipment'], function ($routes) {
|
||||
$routes->get('/', 'IpController::index');
|
||||
$routes->get('create', 'IpController::create_form');
|
||||
$routes->post('create', 'IpController::create');
|
||||
$routes->get('modify/(:num)', 'IpController::modify_form/$1');
|
||||
$routes->post('modify/(:num)', 'IpController::modify/$1');
|
||||
$routes->get('view/(:num)', 'IpController::view/$1');
|
||||
$routes->get('delete/(:num)', 'IpController::delete/$1');
|
||||
$routes->get('toggle/(:num)/(:any)', 'IpController::toggle/$1/$2');
|
||||
$routes->post('batchjob', 'IpController::batchjob');
|
||||
$routes->post('batchjob_delete', 'IpController::batchjob_delete');
|
||||
$routes->get('download/(:alpha)', 'IpController::download/$1');
|
||||
});
|
||||
$routes->group('cs', ['namespace' => 'App\Controllers\Admin\Equipment'], function ($routes) {
|
||||
$routes->get('/', 'CSController::index');
|
||||
$routes->get('create', 'CSController::create_form');
|
||||
$routes->post('create', 'CSController::create');
|
||||
$routes->get('modify/(:num)', 'CSController::modify_form/$1');
|
||||
$routes->post('modify/(:num)', 'CSController::modify/$1');
|
||||
$routes->get('view/(:num)', 'CSController::view/$1');
|
||||
$routes->get('delete/(:num)', 'CSController::delete/$1');
|
||||
$routes->get('toggle/(:num)/(:any)', 'CSController::toggle/$1/$2');
|
||||
$routes->post('batchjob', 'CSController::batchjob');
|
||||
$routes->post('batchjob_delete', 'CSController::batchjob_delete');
|
||||
$routes->get('download/(:alpha)', 'CSController::download/$1');
|
||||
});
|
||||
$routes->group('part', ['namespace' => 'App\Controllers\Admin\Equipment'], function ($routes) {
|
||||
$routes->get('/', 'PartController::index');
|
||||
$routes->get('create', 'PartController::create_form');
|
||||
$routes->post('create', 'PartController::create');
|
||||
$routes->get('modify/(:num)', 'PartController::modify_form/$1');
|
||||
$routes->post('modify/(:num)', 'PartController::modify/$1');
|
||||
$routes->get('view/(:num)', 'PartController::view/$1');
|
||||
$routes->get('delete/(:num)', 'PartController::delete/$1');
|
||||
$routes->get('toggle/(:num)/(:any)', 'PartController::toggle/$1/$2');
|
||||
$routes->post('batchjob', 'PartController::batchjob');
|
||||
$routes->post('batchjob_delete', 'PartController::batchjob_delete');
|
||||
$routes->get('download/(:alpha)', 'PartController::download/$1');
|
||||
});
|
||||
$routes->group('cs', ['namespace' => 'App\Controllers\Admin\Equipment'], function ($routes) {
|
||||
$routes->get('/', 'OnetimeController::index');
|
||||
$routes->get('create', 'OnetimeController::create_form');
|
||||
$routes->post('create', 'OnetimeController::create');
|
||||
$routes->get('modify/(:num)', 'OnetimeController::modify_form/$1');
|
||||
$routes->post('modify/(:num)', 'OnetimeController::modify/$1');
|
||||
$routes->get('view/(:num)', 'OnetimeController::view/$1');
|
||||
$routes->get('delete/(:num)', 'OnetimeController::delete/$1');
|
||||
$routes->get('toggle/(:num)/(:any)', 'OnetimeController::toggle/$1/$2');
|
||||
$routes->post('batchjob', 'OnetimeController::batchjob');
|
||||
$routes->post('batchjob_delete', 'OnetimeController::batchjob_delete');
|
||||
$routes->get('download/(:alpha)', 'OnetimeController::download/$1');
|
||||
});
|
||||
});
|
||||
//Equipment 관련
|
||||
});
|
||||
|
||||
@ -4,11 +4,10 @@ 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\Helpers\Customer\PaymentHelper;
|
||||
use App\Libraries\LogCollector;
|
||||
|
||||
use App\Services\Customer\ServicePaymentService;
|
||||
use App\Services\Customer\PaymentService;
|
||||
use App\Services\Customer\ClientService;
|
||||
|
||||
use CodeIgniter\HTTP\RedirectResponse;
|
||||
@ -16,7 +15,7 @@ use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class ServicePaymentController extends CustomerController
|
||||
class PaymentController extends CustomerController
|
||||
{
|
||||
private ?ClientService $_clientService = null;
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
@ -27,17 +26,17 @@ class ServicePaymentController extends CustomerController
|
||||
$this->uri_path .= strtolower($this->getService()->getClassName('/')) . '/';
|
||||
// $this->view_path .= strtolower($this->getService()->getClassName()) . DIRECTORY_SEPARATOR;
|
||||
}
|
||||
public function getService(): ServicePaymentService
|
||||
public function getService(): PaymentService
|
||||
{
|
||||
if (!$this->_service) {
|
||||
$this->_service = new ServicePaymentService();
|
||||
$this->_service = new PaymentService();
|
||||
}
|
||||
return $this->_service;
|
||||
}
|
||||
public function getHelper(): ServicePaymentHelper
|
||||
public function getHelper(): PaymentHelper
|
||||
{
|
||||
if (!$this->_helper) {
|
||||
$this->_helper = new ServicePaymentHelper();
|
||||
$this->_helper = new PaymentHelper();
|
||||
}
|
||||
return $this->_helper;
|
||||
}
|
||||
@ -83,52 +82,16 @@ class ServicePaymentController extends CustomerController
|
||||
$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
|
||||
private function getOwnersForInvoice(ClientEntity $clientEntity): array
|
||||
{
|
||||
$temps = [
|
||||
'name' => $ownerEntity->getName(),
|
||||
'name' => $clientEntity->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
|
||||
@ -136,7 +99,6 @@ class ServicePaymentController extends CustomerController
|
||||
if (!is_array($uids) || !count($uids)) {
|
||||
throw new \Exception("청구서에 적용될 리스트를 선택하셔야합니다.");
|
||||
}
|
||||
$owner_pk = false;
|
||||
$entities = [];
|
||||
foreach ($uids as $uid) {
|
||||
//기존 Entity 가져오기
|
||||
@ -144,31 +106,28 @@ class ServicePaymentController extends CustomerController
|
||||
if (!$entity) {
|
||||
LogCollector::debug(__METHOD__ . "에서 {$uid}에 대한 결제정보를 찾을수 없습니다.");
|
||||
}
|
||||
//entities에 관리자 설정
|
||||
$ownerEntity = $this->getClientService()->getEntity($entity->getOwnerUID());
|
||||
if (!$ownerEntity) {
|
||||
LogCollector::debug(__METHOD__ . "에서 {$entity->getOwnerUID()}에 대한 관라자정보를 찾을수 없습니다.");
|
||||
//entities에 고객 설정
|
||||
$clientEntity = $this->getClientService()->getEntity($entity->getClientCode());
|
||||
if (!$clientEntity) {
|
||||
LogCollector::debug(__METHOD__ . "에서 {$entity->getClientCode()}에 대한 고객정보를 찾을수 없습니다.");
|
||||
}
|
||||
if ($ownerEntity->getPK() !== $owner_pk) {
|
||||
if (!array_key_exists($ownerEntity->getPK(), $entities)) {
|
||||
$entities[$ownerEntity->getPK()] = $this->getOwnersForInvoice($ownerEntity);
|
||||
}
|
||||
$owner_pk = $ownerEntity->getPK();
|
||||
if (!array_key_exists($clientEntity->getPK(), $entities)) {
|
||||
$entities[$clientEntity->getPK()] = $this->getOwnersForInvoice($clientEntity);
|
||||
}
|
||||
//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);
|
||||
if (!array_key_exists($serviceEntity->getPK(), $entities[$clientEntity->getPK()]['services'])) {
|
||||
$entities[$clientEntity->getPK()]['services'][$serviceEntity->getPK()] = [
|
||||
'code' => $serviceEntity->getTitle(),
|
||||
'billing_at' => $serviceEntity->getBillingAt(),
|
||||
'items' => []
|
||||
];
|
||||
}
|
||||
//entities에 총 결제금액 설정
|
||||
$entities[$ownerEntity->getPK()]['total_amount'] += $entity->getAmount();
|
||||
$entities[$clientEntity->getPK()]['total_amount'] += $entity->getAmount();
|
||||
}
|
||||
// dd($entities);
|
||||
$this->entities = $entities;
|
||||
@ -177,10 +136,6 @@ class ServicePaymentController extends CustomerController
|
||||
{
|
||||
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) {
|
||||
@ -3,19 +3,16 @@
|
||||
namespace App\Controllers\Admin\Customer;
|
||||
|
||||
use App\Helpers\Customer\ServiceHelper;
|
||||
use App\Services\Customer\ServicePaymentService;
|
||||
use App\Services\Customer\PaymentService;
|
||||
|
||||
use App\Services\Customer\ServiceService;
|
||||
use App\Services\Equipment\CodeService;
|
||||
use CodeIgniter\HTTP\RedirectResponse;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class ServiceController extends CustomerController
|
||||
{
|
||||
private ?CodeService $_codeService = null;
|
||||
private ?ServicePaymentService $_servicePaymentService = null;
|
||||
private ?PaymentService $_paymentService = null;
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
@ -39,32 +36,12 @@ class ServiceController extends CustomerController
|
||||
}
|
||||
return $this->_helper;
|
||||
}
|
||||
public function getCodeService(): CodeService
|
||||
public function getPaymentService(): PaymentService
|
||||
{
|
||||
if (!$this->_codeService) {
|
||||
$this->_codeService = new CodeService();
|
||||
if (!$this->_paymentService) {
|
||||
$this->_paymentService = new PaymentService();
|
||||
}
|
||||
return $this->_codeService;
|
||||
}
|
||||
public function getServicePaymentService(): ServicePaymentService
|
||||
{
|
||||
if (!$this->_servicePaymentService) {
|
||||
$this->_servicePaymentService = new ServicePaymentService();
|
||||
}
|
||||
return $this->_servicePaymentService;
|
||||
}
|
||||
protected function getResultSuccess(string $message = MESSAGES["SUCCESS"], ?string $actionTemplate = null): RedirectResponse|string
|
||||
{
|
||||
switch ($this->getAction()) {
|
||||
case 'index':
|
||||
case 'view':
|
||||
$result = parent::getResultSuccess($message, $this->request->getVar('ActionTemplate') ?? $actionTemplate ?? 'service');
|
||||
break;
|
||||
default:
|
||||
$result = parent::getResultSuccess($message, $actionTemplate);
|
||||
break;
|
||||
}
|
||||
return $result;
|
||||
return $this->_paymentService;
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
//생성관련
|
||||
@ -81,39 +58,14 @@ class ServiceController extends CustomerController
|
||||
$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();
|
||||
//각각의 Item항목 정의
|
||||
$this->getService()->setItemEntitiesByService($entity);
|
||||
//부모처리
|
||||
parent::view_process($entity);
|
||||
}
|
||||
//Delete 관련
|
||||
protected function delete_process(mixed $entity): void
|
||||
{
|
||||
//각각의 Item항목 정의
|
||||
$entity = $this->getService()->setItemEntitiesByService($entity);
|
||||
//부모처리
|
||||
parent::delete_process($entity);
|
||||
}
|
||||
//List 관련
|
||||
protected function index_process(): void
|
||||
{
|
||||
//서비스별 미납 Count
|
||||
$this->unPaids = $this->getServicePaymentService()->getUnPaidCountByService();
|
||||
$this->unPaids = $this->getPaymentService()->getUnPaidCount();
|
||||
//LINE,IP,SERVER등 추가 FilterOption 셋팅용
|
||||
$this->setFilterOptionsByItemType();
|
||||
//부모함수처리
|
||||
parent::index_process();
|
||||
//추가처리
|
||||
$entities = [];
|
||||
foreach ($this->entities as $entity) {
|
||||
//각각의 Item항목 정의
|
||||
$entities[$entity->getPK()] = $this->getService()->setItemEntitiesByService($entity);
|
||||
}
|
||||
$this->entities = $entities;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,102 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin\Customer;
|
||||
|
||||
use App\Entities\Customer\ServicePaymentEntity;
|
||||
use App\Helpers\Customer\ServiceItemHelper;
|
||||
|
||||
use App\Services\Customer\ServiceItemService;
|
||||
use App\Services\Customer\ServicePaymentService;
|
||||
use CodeIgniter\HTTP\RedirectResponse;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class ServiceItemController extends CustomerController
|
||||
{
|
||||
private ?ServicePaymentService $_servicePaymentService = 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;
|
||||
|
||||
}
|
||||
protected function initAction(string $action, $fields = []): void
|
||||
{
|
||||
parent::initAction($action, $fields);
|
||||
//LINE,IP,SERVER등 추가 FilterOption 셋팅용
|
||||
$this->setFilterOptionsByItemType();
|
||||
}
|
||||
public function getService(): ServiceItemService
|
||||
{
|
||||
if (!$this->_service) {
|
||||
$this->_service = new ServiceItemService();
|
||||
}
|
||||
return $this->_service;
|
||||
}
|
||||
public function getHelper(): ServiceItemHelper
|
||||
{
|
||||
if (!$this->_helper) {
|
||||
$this->_helper = new ServiceItemHelper();
|
||||
}
|
||||
return $this->_helper;
|
||||
}
|
||||
public function getServicePaymentService(): ServicePaymentService
|
||||
{
|
||||
if (!$this->_servicePaymentService) {
|
||||
$this->_servicePaymentService = new ServicePaymentService();
|
||||
}
|
||||
return $this->_servicePaymentService;
|
||||
}
|
||||
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;
|
||||
}
|
||||
public function getFormFieldOption(string $field, array $options = []): array
|
||||
{
|
||||
switch ($field) {
|
||||
case 'item_uid':
|
||||
$item_type = $this->request->getVar('item_type');
|
||||
if (!$item_type) {
|
||||
throw new \Exception(__FUNCTION__ . "에서 item_type이 지정되지 않았습니다.");
|
||||
}
|
||||
$options = $this->getFilterFieldOption('item_type');
|
||||
break;
|
||||
default:
|
||||
$options = parent::getFormFieldOption($field, $options);
|
||||
break;
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
|
||||
protected function create_process(array $formDatas): void
|
||||
{
|
||||
$serviceEntity = $this->getServiceService()->getEntity($formDatas['serviceinfo_uid']);
|
||||
if (!$serviceEntity) {
|
||||
throw new \Exception("{$formDatas['serviceinfo_uid']}에 대한 서비스정보를 찾을수 없습니다.");
|
||||
}
|
||||
parent::create_process($formDatas);
|
||||
//결제 처리
|
||||
$paymentFormDatas = [];
|
||||
//금액(amount)가 0원일경우는 바로 결제완료 처리함.
|
||||
if ($this->entity->getAmount() === 0) {
|
||||
// 관리자 UID는 현재 인증된 사용자로 설정
|
||||
$paymentFormDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
|
||||
$paymentFormDatas['status'] = ServicePaymentEntity::STATUS_PAID;
|
||||
}
|
||||
// dd($paymentFormDatas);
|
||||
$this->getServicePaymentService()->createByServiceItemService($paymentFormDatas, $this->entity);
|
||||
}
|
||||
}
|
||||
@ -1,15 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin\Equipment\Part;
|
||||
namespace App\Controllers\Admin\Equipment;
|
||||
|
||||
use App\Helpers\Equipment\Part\RamHelper;
|
||||
use App\Services\Equipment\Part\RamService;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class RamController extends PartController
|
||||
use App\Helpers\Equipment\CSHelper;
|
||||
use App\Services\Equipment\CSService;
|
||||
|
||||
class CSController extends EquipmentController
|
||||
{
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
@ -20,17 +20,17 @@ class RamController extends PartController
|
||||
// $this->view_path .= strtolower($this->getService()->getClassName()) . DIRECTORY_SEPARATOR;
|
||||
|
||||
}
|
||||
public function getService(): RamService
|
||||
public function getService(): CSService
|
||||
{
|
||||
if (!$this->_service) {
|
||||
$this->_service = new RamService();
|
||||
$this->_service = new CSService();
|
||||
}
|
||||
return $this->_service;
|
||||
}
|
||||
public function getHelper(): RamHelper
|
||||
public function getHelper(): CSHelper
|
||||
{
|
||||
if (!$this->_helper) {
|
||||
$this->_helper = new RamHelper();
|
||||
$this->_helper = new CSHelper();
|
||||
}
|
||||
return $this->_helper;
|
||||
}
|
||||
@ -1,17 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin\Equipment\Part;
|
||||
namespace App\Controllers\Admin\Equipment;
|
||||
|
||||
use App\Helpers\Equipment\Part\IpHelper;
|
||||
use App\Services\Equipment\Part\IpService;
|
||||
use App\Helpers\Equipment\IpHelper;
|
||||
use App\Services\Equipment\IpService;
|
||||
|
||||
use App\Services\Equipment\Part\LineService;
|
||||
use App\Services\Equipment\LineService;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class IpController extends PartController
|
||||
class IpController extends EquipmentController
|
||||
{
|
||||
private ?LineService $_lineService = null;
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
@ -1,18 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin\Equipment\Part;
|
||||
namespace App\Controllers\Admin\Equipment;
|
||||
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
use App\Entities\Equipment\Part\LineEntity;
|
||||
use App\Helpers\Equipment\Part\LineHelper;
|
||||
use App\Services\Equipment\Part\LineService;
|
||||
use App\Services\Equipment\Part\IpService;
|
||||
use App\Entities\Equipment\Part\IpEntity;
|
||||
use App\Helpers\Equipment\LineHelper;
|
||||
use App\Services\Equipment\LineService;
|
||||
use App\Services\Equipment\IpService;
|
||||
|
||||
class LineController extends PartController
|
||||
class LineController extends EquipmentController
|
||||
{
|
||||
private ?IpService $_ipService = null;
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
@ -1,38 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin\Equipment\Part;
|
||||
|
||||
use App\Helpers\Equipment\Part\CpuHelper;
|
||||
use App\Services\Equipment\Part\CpuService;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class CpuController extends PartController
|
||||
{
|
||||
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(): CpuService
|
||||
{
|
||||
if (!$this->_service) {
|
||||
$this->_service = new CpuService();
|
||||
}
|
||||
return $this->_service;
|
||||
}
|
||||
public function getHelper(): CpuHelper
|
||||
{
|
||||
if (!$this->_helper) {
|
||||
$this->_helper = new CpuHelper();
|
||||
}
|
||||
return $this->_helper;
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
}
|
||||
@ -1,38 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin\Equipment\Part;
|
||||
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
use App\Helpers\Equipment\Part\DefenceHelper;
|
||||
use App\Services\Equipment\Part\DefenceService;
|
||||
|
||||
class DefenceController extends PartController
|
||||
{
|
||||
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(): DefenceService
|
||||
{
|
||||
if (!$this->_service) {
|
||||
$this->_service = new DefenceService();
|
||||
}
|
||||
return $this->_service;
|
||||
}
|
||||
public function getHelper(): DefenceHelper
|
||||
{
|
||||
if (!$this->_helper) {
|
||||
$this->_helper = new DefenceHelper();
|
||||
}
|
||||
return $this->_helper;
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
}
|
||||
@ -1,93 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin\Equipment\Part;
|
||||
|
||||
use App\Helpers\Equipment\Part\DomainHelper;
|
||||
use App\Services\Equipment\Part\DomainService;
|
||||
|
||||
use CodeIgniter\HTTP\RedirectResponse;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class DomainController extends PartController
|
||||
{
|
||||
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(): DomainService
|
||||
{
|
||||
if (!$this->_service) {
|
||||
$this->_service = new DomainService();
|
||||
}
|
||||
return $this->_service;
|
||||
}
|
||||
public function getHelper(): DomainHelper
|
||||
{
|
||||
if (!$this->_helper) {
|
||||
$this->_helper = new DomainHelper();
|
||||
}
|
||||
return $this->_helper;
|
||||
}
|
||||
protected function getResultSuccess(string $message = MESSAGES["SUCCESS"], ?string $actionTemplate = null): RedirectResponse|string
|
||||
{
|
||||
helper(['form']);
|
||||
switch ($this->getAction()) {
|
||||
case 'create':
|
||||
$this->control = $this->getControlDatas();
|
||||
$this->getHelper()->setViewDatas($this->getViewDatas());
|
||||
$view_file = $this->view_path . 'domain' . DIRECTORY_SEPARATOR . 'view';
|
||||
$result = view($view_file, ['viewDatas' => $this->getViewDatas()]);
|
||||
break;
|
||||
case 'create_form':
|
||||
$result = parent::getResultSuccess($message, $this->request->getVar('ActionTemplate') ?? $actionTemplate ?? 'domain');
|
||||
break;
|
||||
default:
|
||||
$result = parent::getResultSuccess($message, $actionTemplate);
|
||||
break;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
protected function create_process(array $formDatas): void
|
||||
{
|
||||
$entities = [];
|
||||
//formDatas는 Json 값으로 넘어온다.
|
||||
foreach (json_decode($formDatas['domain'], true) as $domain) {
|
||||
//데이터 검증
|
||||
$validDatas = $this->doValidate(
|
||||
$this->getFieldRules(),
|
||||
['domain' => $domain['value'], 'status' => $formDatas['status']]
|
||||
);
|
||||
$entities[] = $this->getService()->create($validDatas);
|
||||
}
|
||||
$this->entities = $entities;
|
||||
}
|
||||
//도메인 존재여부 검증용
|
||||
final public function confirm(string $field = "domain"): ResponseInterface
|
||||
{
|
||||
try {
|
||||
//각 Field 초기화:조건항목 Field는 한개만 존재하므로 Field와 Rule을 정의
|
||||
$this->setAction(__FUNCTION__);
|
||||
$this->setFormFields([$field]);
|
||||
$this->setFieldRule($field, $this->getFormFieldRule($this->getAction(), $field));
|
||||
//입력값정의
|
||||
$domain = $this->request->getVar($field);
|
||||
//기존 존재하는 Domain인지 확인용 Entity 가져오기
|
||||
$entity = $this->getService()->getEntity([$field => $domain], "");
|
||||
return $this->response
|
||||
->setContentType('application/json')
|
||||
->setBody(json_encode(['exists' => true, 'message' => "[{$entity->getTitle()}] 이미 존재하는 도메인입니다."]));
|
||||
} catch (\Exception $e) {
|
||||
return $this->response
|
||||
->setContentType('application/json')
|
||||
->setBody(json_encode(['exists' => false, 'message' => $e->getMessage()]));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,39 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin\Equipment\Part;
|
||||
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
use App\Helpers\Equipment\Part\SoftwareHelper;
|
||||
use App\Services\Equipment\Part\SoftwareService;
|
||||
|
||||
class SoftwareController extends PartController
|
||||
{
|
||||
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(): SoftwareService
|
||||
{
|
||||
if (!$this->_service) {
|
||||
$this->_service = new SoftwareService();
|
||||
}
|
||||
return $this->_service;
|
||||
}
|
||||
public function getHelper(): SoftwareHelper
|
||||
{
|
||||
if (!$this->_helper) {
|
||||
$this->_helper = new SoftwareHelper();
|
||||
}
|
||||
return $this->_helper;
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
}
|
||||
@ -1,38 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin\Equipment\Part;
|
||||
|
||||
use App\Helpers\Equipment\Part\StorageHelper;
|
||||
use App\Services\Equipment\Part\StorageService;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class StorageController extends PartController
|
||||
{
|
||||
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(): StorageService
|
||||
{
|
||||
if (!$this->_service) {
|
||||
$this->_service = new StorageService();
|
||||
}
|
||||
return $this->_service;
|
||||
}
|
||||
public function getHelper(): StorageHelper
|
||||
{
|
||||
if (!$this->_helper) {
|
||||
$this->_helper = new StorageHelper();
|
||||
}
|
||||
return $this->_helper;
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
}
|
||||
@ -2,13 +2,14 @@
|
||||
|
||||
namespace App\Controllers\Admin\Equipment;
|
||||
|
||||
use App\Helpers\Equipment\ServerHelper;
|
||||
use App\Services\Equipment\ServerService;
|
||||
use CodeIgniter\HTTP\RedirectResponse;
|
||||
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
use App\Helpers\Equipment\ServerHelper;
|
||||
use App\Services\Equipment\ServerService;
|
||||
|
||||
class ServerController extends EquipmentController
|
||||
{
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
@ -35,13 +36,26 @@ class ServerController extends EquipmentController
|
||||
return $this->_helper;
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
protected function getResultSuccess(string $message = MESSAGES["SUCCESS"], ?string $actionTemplate = null): RedirectResponse|string
|
||||
{
|
||||
switch ($this->getAction()) {
|
||||
case 'index':
|
||||
case 'view':
|
||||
$result = parent::getResultSuccess($message, $this->request->getVar('ActionTemplate') ?? $actionTemplate ?? 'server');
|
||||
break;
|
||||
default:
|
||||
$result = parent::getResultSuccess($message, $actionTemplate);
|
||||
break;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
//View부분
|
||||
protected function view_process(mixed $entity): void
|
||||
{
|
||||
foreach (SERVICE_ITEM_TYPES as $item_type => $label) {
|
||||
$entity->setItemEntities(
|
||||
$item_type,
|
||||
$this->getService()->getEntities(['serviceinfo_uid' => $entity->getPK(), 'item_type' => $item_type])
|
||||
$this->getService()->getEntities(['serviceinfo_code' => $entity->getPK(), 'item_type' => $item_type])
|
||||
);
|
||||
}
|
||||
//부모처리
|
||||
|
||||
@ -1,190 +0,0 @@
|
||||
<?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());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -66,19 +66,4 @@ class SearchController extends AdminController
|
||||
return $result;
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
//List 관련
|
||||
protected function index_process(): void
|
||||
{
|
||||
//LINE,IP,SERVER등 추가 FilterOption 셋팅용
|
||||
$this->setFilterOptionsByItemType();
|
||||
//부모함수처리
|
||||
parent::index_process();
|
||||
//추가처리
|
||||
$entities = [];
|
||||
foreach ($this->entities as $entity) {
|
||||
//각각의 Item항목 정의
|
||||
$entities[$entity->getPK()] = $this->getService()->setItemEntitiesByService($entity);
|
||||
}
|
||||
$this->entities = $entities;
|
||||
}
|
||||
}
|
||||
|
||||
@ -58,21 +58,37 @@ abstract class DBMigration extends BaseController
|
||||
|
||||
final public function client(): void
|
||||
{
|
||||
$this->migration(new ClientProcess($this->getTargetDB()), $this->getClient(), __FUNCTION__);
|
||||
$this->migration(
|
||||
new ClientProcess($this->getTargetDB()),
|
||||
$this->getClient(),
|
||||
__FUNCTION__
|
||||
);
|
||||
}
|
||||
|
||||
final public function line(): void
|
||||
{
|
||||
$this->migration(new LineProcess($this->getTargetDB()), $this->getLine(), __FUNCTION__);
|
||||
$this->migration(
|
||||
new LineProcess($this->getTargetDB()),
|
||||
$this->getLine(),
|
||||
__FUNCTION__
|
||||
);
|
||||
}
|
||||
|
||||
final public function servercode(): void
|
||||
{
|
||||
$this->migration(new ServerCodeProcess($this->getTargetDB()), $this->getServerCode(), __FUNCTION__);
|
||||
$this->migration(
|
||||
new ServerCodeProcess($this->getTargetDB()),
|
||||
$this->getServerCode(),
|
||||
__FUNCTION__
|
||||
);
|
||||
}
|
||||
|
||||
final public function switchcode(): void
|
||||
{
|
||||
$this->migration(new SwitchCodeProcess($this->getTargetDB()), $this->getSwitchCode(), __FUNCTION__);
|
||||
$this->migration(
|
||||
new SwitchCodeProcess($this->getTargetDB()),
|
||||
$this->getSwitchCode(),
|
||||
__FUNCTION__
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -53,7 +53,7 @@ class Payment extends BaseController
|
||||
//결제일이 오늘보다 크고, 상태가 사용중인 서비스정보를 이용해서 결제정보에 신규 추가하기
|
||||
foreach ($this->getServiceService()->getEntities(['billing_at' => date("Y-m-d"), 'status' => DEFAULTS['STATUS']]) as $serviceEntity) {
|
||||
// echo $serviceEntity->getPK() . ":" . $serviceEntity->getBillingAt() . "\n";
|
||||
foreach ($this->getServiceItemService()->getEntities(['serviceinfo_uid' => $serviceEntity->getPK()]) as $itemEntity) {
|
||||
foreach ($this->getServiceItemService()->getEntities(['serviceinfo_code' => $serviceEntity->getPK()]) as $itemEntity) {
|
||||
//결제정보 ServicePaymentService에 월별 결제만 신규등록
|
||||
if ($itemEntity->getBillingCycle() == "month") {
|
||||
//결제정보 ServicePaymentService에 등록
|
||||
|
||||
@ -198,6 +198,7 @@ abstract class CommonController extends BaseController
|
||||
$this->setViewFields(array_key_exists('viewFields', $fields) ? $fields['viewFields'] : $this->getService()->getViewFields());
|
||||
$this->setFilterFields(array_key_exists('filterFields', $fields) ? $fields['filterFields'] : $this->getService()->getFilterFields());
|
||||
foreach ($this->getFilterFields() as $field) {
|
||||
echo "Filter FIELD: {$field}<BR>";
|
||||
$this->setFilterFieldOption($field, $this->getFormFieldOption($field));
|
||||
}
|
||||
$this->setBatchJobFields(array_key_exists('batchjobFields', $fields) ? $fields['batchjobFields'] : $this->getService()->getBatchJobFields());
|
||||
@ -643,11 +644,11 @@ abstract class CommonController extends BaseController
|
||||
public function index(): RedirectResponse|string
|
||||
{
|
||||
try {
|
||||
//FieldRule정의
|
||||
//각 Field 초기화
|
||||
$this->initAction(__FUNCTION__);
|
||||
//Return Url정의
|
||||
$this->getMyAuth()->pushCurrentUrl($this->request->getUri()->getPath() . ($this->request->getUri()->getQuery() ? "?" . $this->request->getUri()->getQuery() : ""));
|
||||
//FieldRule정의
|
||||
foreach ($this->getIndexFields() as $field) {
|
||||
$this->setFieldRule($field, $this->getFormFieldRule($this->getAction(), $field));
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@ -2,55 +2,50 @@
|
||||
|
||||
namespace App\Entities\Customer;
|
||||
|
||||
use App\Models\Customer\ServicePaymentModel;
|
||||
use App\Models\Customer\PaymentModel;
|
||||
use DateTime;
|
||||
|
||||
class ServicePaymentEntity extends CustomerEntity
|
||||
class PaymentEntity extends CustomerEntity
|
||||
{
|
||||
const PK = ServicePaymentModel::PK;
|
||||
const TITLE = ServicePaymentModel::TITLE;
|
||||
const PK = PaymentModel::PK;
|
||||
const TITLE = PaymentModel::TITLE;
|
||||
const STATUS_UNPAID = "default";
|
||||
const STATUS_PAID = "paid";
|
||||
//관리자정보객체
|
||||
final public function getServiceUid(): int
|
||||
{
|
||||
return intval($this->attributes['serviceinfo_uid']);
|
||||
}
|
||||
final public function getOwnerUID(): int
|
||||
{
|
||||
return intval($this->attributes['ownerinfo_uid']);
|
||||
}
|
||||
final public function getUserUID(): int
|
||||
{
|
||||
return intval($this->attributes['user_uid']);
|
||||
}
|
||||
final public function getService(): ServiceEntity|null
|
||||
final public function getClientCode(): int
|
||||
{
|
||||
return $this->_serviceEntity;
|
||||
return intval($this->attributes['clientinfo_code']);
|
||||
}
|
||||
final public function setService(ServiceEntity $serviceEntity): void
|
||||
final public function getServiceCode(): int
|
||||
{
|
||||
$this->_serviceEntity = $serviceEntity;
|
||||
return intval($this->attributes['serviceinfo_code']);
|
||||
}
|
||||
//타 객체정의 부분
|
||||
public function getItemType(): string
|
||||
{
|
||||
return $this->attributes['item_type'];
|
||||
}
|
||||
public function getItemUid(): int
|
||||
public function getIsOnetime(): int
|
||||
{
|
||||
return intval($this->attributes['item_uid']);
|
||||
return intval($this->attributes['isOnetime']);
|
||||
}
|
||||
public function getAmount(): int
|
||||
{
|
||||
return intval($this->attributes['amount']);
|
||||
}
|
||||
|
||||
public function getBillingAt(): string
|
||||
{
|
||||
return $this->attributes['billing_at'];
|
||||
}
|
||||
public function getView_CounDueAt(): string
|
||||
public function getPayMethod(): string
|
||||
{
|
||||
return $this->attributes['pay_method'];
|
||||
}
|
||||
public function getCountDueAt(): string
|
||||
{
|
||||
$result = "";
|
||||
if ($this->getStatus() === DEFAULTS['STATUS']) {
|
||||
@ -1,57 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entities\Customer;
|
||||
|
||||
use App\Models\Customer\ServiceItemModel;
|
||||
|
||||
class ServiceItemEntity extends CustomerEntity
|
||||
{
|
||||
const PK = ServiceItemModel::PK;
|
||||
const TITLE = ServiceItemModel::TITLE;
|
||||
//서비스정보객체
|
||||
final public function getServiceUid(): int
|
||||
{
|
||||
return intval($this->attributes['serviceinfo_uid']);
|
||||
}
|
||||
public function getItemType(): string
|
||||
{
|
||||
return $this->attributes['item_type'];
|
||||
}
|
||||
public function getItemUid(): int
|
||||
{
|
||||
return intval($this->attributes['item_uid']);
|
||||
}
|
||||
public function getBillingCycle(): string
|
||||
{
|
||||
return $this->attributes['billing_cycle'];
|
||||
}
|
||||
public function getPrice(): int
|
||||
{
|
||||
return intval($this->attributes['price']);
|
||||
}
|
||||
public function getAmount(): int
|
||||
{
|
||||
return intval($this->attributes['amount']);
|
||||
}
|
||||
public function getView_Price(): string
|
||||
{
|
||||
return sprintf("원가:%s원 , 제공가:%s원", number_format($this->getPrice()), number_format($this->getAmount()));
|
||||
}
|
||||
public function getView_Sale(): string
|
||||
{
|
||||
$result = "";
|
||||
//할인시
|
||||
if ($this->getPrice() > $this->getAmount()) {
|
||||
$result = ICONS['SALE_DOWN'];
|
||||
}
|
||||
//부가가치시
|
||||
if ($this->getPrice() < $this->getAmount()) {
|
||||
$result = ICONS['SALE_UP'];
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
public function getView_BillingCycle(): string
|
||||
{
|
||||
return $this->getBillingCycle() == "month" ? "" : ICONS['ONETIME'];;
|
||||
}
|
||||
}
|
||||
@ -2,30 +2,29 @@
|
||||
|
||||
namespace App\Helpers\Customer;
|
||||
|
||||
use App\Models\Customer\ServicePaymentModel;
|
||||
use App\Models\Customer\PaymentModel;
|
||||
|
||||
class ServicePaymentHelper extends CustomerHelper
|
||||
class PaymentHelper extends CustomerHelper
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->setTitleField(field: ServicePaymentModel::TITLE);
|
||||
$this->setTitleField(field: PaymentModel::TITLE);
|
||||
}
|
||||
|
||||
public function getFieldView(string $field, mixed $value, array $viewDatas, array $extras = []): string|null
|
||||
{
|
||||
switch ($field) {
|
||||
case "countdown": //결제일Countdown
|
||||
$value = $viewDatas['entity']->getView_CounDueAt();
|
||||
$value = $viewDatas['entity']->getCountDueAt();
|
||||
break;
|
||||
case 'item_uid':
|
||||
//ItemType에 따라 필터옵션에서 Title을 가져옴
|
||||
$value = $viewDatas['control']['filter_optons'][$viewDatas['entity']->getItemType()][$value]->getTitle();
|
||||
break;
|
||||
case 'serviceinfo_uid':
|
||||
case 'ownerinfo_uid':
|
||||
case 'item_type':
|
||||
case 'billing_cycle':
|
||||
case 'serviceinfo_code':
|
||||
case 'clientinfo_code':
|
||||
case 'billing_method':
|
||||
$value = array_key_exists($value, $viewDatas['control']['filter_optons'][$field]) && $viewDatas['control']['filter_optons'][$field][$value] ? $viewDatas['control']['filter_optons'][$field][$value]->getTitle() : "";
|
||||
break;
|
||||
default:
|
||||
@ -30,7 +30,7 @@ class ServiceHelper extends CustomerHelper
|
||||
ICONS['SETUP'],
|
||||
$field,
|
||||
[
|
||||
"data-src" => "/admin/customer/serviceitem?serviceinfo_uid={$viewDatas['entity']->getPK()}&item_type={$field}",
|
||||
"data-src" => "/admin/customer/serviceitem?serviceinfo_code={$viewDatas['entity']->getPK()}&item_type={$field}",
|
||||
"data-bs-toggle" => "modal",
|
||||
"data-bs-target" => "#index_action_form",
|
||||
...$extras
|
||||
@ -104,7 +104,7 @@ class ServiceHelper extends CustomerHelper
|
||||
case 'billing_at':
|
||||
if (array_key_exists('unPaids', $viewDatas)) {
|
||||
if (array_key_exists($viewDatas['entity']->getPK(), $viewDatas['unPaids'])) {
|
||||
$value .= "<div><a href=\"/admin/customer/payment?serviceinfo_uid={$viewDatas['entity']->getPK()}\">미지급: <span style=\"color:red;\">" . $viewDatas['unPaids'][$viewDatas['entity']->getPK()] . "</span>개</a></div>";
|
||||
$value .= "<div><a href=\"/admin/customer/payment?={$viewDatas['entity']->getPK()}\">미지급: <span style=\"color:red;\">" . $viewDatas['unPaids'][$viewDatas['entity']->getPK()] . "</span>개</a></div>";
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -131,7 +131,7 @@ class ServiceHelper extends CustomerHelper
|
||||
$label ? $label : ICONS['HISTORY'],
|
||||
$action,
|
||||
[
|
||||
"data-src" => "/admin/customer/servicehistory?serviceinfo_uid={$viewDatas['entity']->getPK()}",
|
||||
"data-src" => "/admin/customer/servicehistory?serviceinfo_code={$viewDatas['entity']->getPK()}",
|
||||
"data-bs-toggle" => "modal",
|
||||
"data-bs-target" => "#index_action_form",
|
||||
...$extras
|
||||
|
||||
@ -1,66 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Helpers\Customer;
|
||||
|
||||
use App\Models\Customer\ServiceItemModel;
|
||||
use App\Entities\Equipment\Part\DomainEntity;
|
||||
use App\Entities\Equipment\Part\IpEntity;
|
||||
|
||||
class ServiceItemHelper extends CustomerHelper
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->setTitleField(field: ServiceItemModel::TITLE);
|
||||
}
|
||||
|
||||
//ItemType에 따른 조건부 추가 Index Page
|
||||
final function getFieldFormByByItemType(string $field, mixed $value, array $viewDatas, array $extras = []): string
|
||||
{
|
||||
// dd($viewDatas['control']);
|
||||
$item_type = $viewDatas['control']['filter_values']['item_type'];
|
||||
//Field는 item_uid이지만 , item_tpe에 따라 filter_options가 달라진다.
|
||||
switch ($item_type) {
|
||||
case "IP":
|
||||
// $options = ["" => lang($viewDatas['class_path'] . '.label.' . $field) . ' 선택'];
|
||||
// // index_content_top_filter가 있으면 disabled를 설정하지 않음
|
||||
// // action이 modify_form이면 disabled로 설정하지 않음
|
||||
// if (array_key_exists('index_content_top_filter', $extras) || ($viewDatas['control']['action'] == "modify_form" && $value == $filterEntity->getPK())) {
|
||||
// $disabledKeys = [];
|
||||
// }
|
||||
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field';
|
||||
$form = $this->form_dropdown_disabled($field, $value, $viewDatas['control']['filter_optons'][$item_type], $extras, IpEntity::STATUS_OCCUPIED);
|
||||
break;
|
||||
case 'DOMAIN':
|
||||
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field';
|
||||
$form = $this->form_dropdown_disabled($field, $value, $viewDatas['control']['filter_optons'][$item_type], $extras, DomainEntity::STATUS_OCCUPIED);
|
||||
break;
|
||||
case "LINE":
|
||||
case "SERVER":
|
||||
case "CPU":
|
||||
case "RAM":
|
||||
case "STORAGE":
|
||||
case "SOFTWARE":
|
||||
case "DEFENCE":
|
||||
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field';
|
||||
$form = $this->form_dropdown_disabled($field, $value, $viewDatas['control']['filter_optons'][$item_type], $extras);
|
||||
break;
|
||||
default:
|
||||
$form = parent::getFieldForm($field, $value, $viewDatas, $extras);
|
||||
break;
|
||||
}
|
||||
return $form;
|
||||
}
|
||||
public function getFieldForm(string $field, mixed $value, array $viewDatas, array $extras = []): string
|
||||
{
|
||||
switch ($field) {
|
||||
case 'item_uid':
|
||||
$form = $this->getFieldFormByByItemType($field, $value, $viewDatas, $extras);
|
||||
break;
|
||||
default:
|
||||
$form = parent::getFieldForm($field, $value, $viewDatas, $extras);
|
||||
break;
|
||||
}
|
||||
return $form;
|
||||
}
|
||||
}
|
||||
14
app/Helpers/Equipment/CSHelper.php
Normal file
14
app/Helpers/Equipment/CSHelper.php
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace App\Helpers\Equipment;
|
||||
|
||||
use App\Models\Equipment\CSModel;
|
||||
|
||||
class CSHelper extends EquipmentHelper
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->setTitleField(field: CSModel::TITLE);
|
||||
}
|
||||
}
|
||||
@ -1,28 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Helpers\Equipment;
|
||||
|
||||
use App\Models\Equipment\Part\DomainModel;
|
||||
|
||||
class DomainHelper extends EquipmentHelper
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->setTitleField(field: DomainModel::TITLE);
|
||||
}
|
||||
|
||||
public function getFieldForm(string $field, mixed $value, array $viewDatas, array $extras = []): string
|
||||
{
|
||||
switch ($field) {
|
||||
case 'domain':
|
||||
$form = form_input($field, $value ?? "", ['id' => $field, "placeholder" => "예)domain.co.kr", ...$extras]);
|
||||
$form .= "<div id=\"domain-errors\" style=\"color:red; margin-top:5px;\"></div>";
|
||||
break;
|
||||
default:
|
||||
$form = parent::getFieldForm($field, $value, $viewDatas, $extras);
|
||||
break;
|
||||
}
|
||||
return $form;
|
||||
} //
|
||||
}
|
||||
14
app/Helpers/Equipment/IpHelper.php
Normal file
14
app/Helpers/Equipment/IpHelper.php
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace App\Helpers\Equipment;
|
||||
|
||||
use App\Models\Equipment\IpModel;
|
||||
|
||||
class IpHelper extends EquipmentHelper
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->setTitleField(field: IpModel::TITLE);
|
||||
}
|
||||
}
|
||||
14
app/Helpers/Equipment/LineHelper.php
Normal file
14
app/Helpers/Equipment/LineHelper.php
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace App\Helpers\Equipment;
|
||||
|
||||
use App\Models\Equipment\LineModel;
|
||||
|
||||
class LineHelper extends EquipmentHelper
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->setTitleField(field: LineModel::TITLE);
|
||||
}
|
||||
}
|
||||
36
app/Language/en/Customer/Payment.php
Normal file
36
app/Language/en/Customer/Payment.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
return [
|
||||
'title' => "서비스결제정보",
|
||||
'label' => [
|
||||
'user_uid' => "관리자",
|
||||
'clientinfo_code' => "고객",
|
||||
'serviceinfo_code' => "서비스",
|
||||
'amount' => "청구금액",
|
||||
'billing_method' => "청구방법",
|
||||
'billing_at' => "지급기한일",
|
||||
'pay_method' => "지급방법",
|
||||
'status' => "상태",
|
||||
'updated_at' => "지불처리일",
|
||||
'created_at' => "청구일",
|
||||
'deleted_at' => "삭제일",
|
||||
'count_down' => "납부기한",
|
||||
],
|
||||
'DEFAULTS' => [
|
||||
'item_type' => "server",
|
||||
'billing_method' => "month",
|
||||
'pay_method' => "account",
|
||||
'status' => 'default'
|
||||
],
|
||||
"BILLING_METHOD" => [
|
||||
"month" => "매월",
|
||||
"onetime" => "일회성",
|
||||
],
|
||||
"PAY_METHOD" => [
|
||||
"account" => "예치금",
|
||||
"coupon" => "쿠폰",
|
||||
],
|
||||
"STATUS" => [
|
||||
'default' => "미지급",
|
||||
"paid" => "지급완료",
|
||||
],
|
||||
];
|
||||
@ -1,43 +0,0 @@
|
||||
<?php
|
||||
return [
|
||||
'title' => "서비스항목정보",
|
||||
'label' => [
|
||||
'serviceinfo_uid' => "서비스명",
|
||||
'item_type' => "항목형식",
|
||||
'item_uid' => "항목",
|
||||
'billing_cycle' => "납부방식",
|
||||
'price' => "소비자금액",
|
||||
'amount' => "서비스금액",
|
||||
'start_at' => "개통일",
|
||||
'status' => "상태",
|
||||
'updated_at' => "수정일",
|
||||
'created_at' => "신청일",
|
||||
'deleted_at' => "삭제일",
|
||||
'SERVER' => "서버",
|
||||
'LINE' => "회선",
|
||||
'IP' => "IP",
|
||||
'CPU' => "CPU",
|
||||
'RAM' => "메모리",
|
||||
'STORAGE' => "저장장치",
|
||||
'SOFTWARE' => "SOFTWARE",
|
||||
'DEFENCE' => "방어(CS)",
|
||||
'DOMAIN' => "도메인",
|
||||
],
|
||||
'DEFAULTS' => [
|
||||
'item_type' => "server",
|
||||
'billing_cycle' => "month",
|
||||
'type' => "default",
|
||||
'status' => 'default'
|
||||
],
|
||||
"ITEM_TYPE" => SERVICE_ITEM_TYPES,
|
||||
"BILLING_CYCLE" => [
|
||||
"month" => "매월",
|
||||
"onetime" => "일회성",
|
||||
],
|
||||
"STATUS" => [
|
||||
'default' => "사용중",
|
||||
"pause" => "일시정지",
|
||||
'reservation' => "설치예약",
|
||||
"terminated" => "해지",
|
||||
],
|
||||
];
|
||||
@ -1,53 +0,0 @@
|
||||
<?php
|
||||
return [
|
||||
'title' => "서비스결제정보",
|
||||
'label' => [
|
||||
'serviceinfo_uid' => "서비스",
|
||||
'ownerinfo_uid' => "관리자",
|
||||
'user_uid' => "작업자",
|
||||
'item_type' => "항목종류",
|
||||
'item_uid' => "항목",
|
||||
'billing_cycle' => "납부방식",
|
||||
'amount' => "결제금액",
|
||||
'billing_at' => "결제일",
|
||||
'issue_at' => "발행일",
|
||||
'status' => "상태",
|
||||
'updated_at' => "수정일",
|
||||
'created_at' => "신청일",
|
||||
'deleted_at' => "삭제일",
|
||||
'countdown' => "납부기한",
|
||||
"LINE" => "라인",
|
||||
"IP" => "IP주소",
|
||||
"SERVER" => "서버",
|
||||
"CPU" => "CPU",
|
||||
"RAM" => "메모리",
|
||||
"STORAGE" => "저장장치",
|
||||
"SOFTWARE" => "소프트웨어",
|
||||
"DEFENCE" => "방어(CS)",
|
||||
"DOMAIN" => "도메인",
|
||||
],
|
||||
'DEFAULTS' => [
|
||||
'item_type' => "server",
|
||||
'billing_cycle' => "month",
|
||||
'status' => 'default'
|
||||
],
|
||||
"ITEM_TYPE" => [
|
||||
"LINE" => "라인",
|
||||
"IP" => "IP주소",
|
||||
"SERVER" => "서버",
|
||||
"CPU" => "CPU",
|
||||
"RAM" => "메모리",
|
||||
"STORAGE" => "저장장치",
|
||||
"SOFTWARE" => "소프트웨어",
|
||||
"DEFENCE" => "방어(CS)",
|
||||
"DOMAIN" => "도메인",
|
||||
],
|
||||
"BILLING_CYCLE" => [
|
||||
"month" => "매월",
|
||||
"onetime" => "일회성",
|
||||
],
|
||||
"STATUS" => [
|
||||
'default' => "미지급",
|
||||
"paid" => "지급완료",
|
||||
],
|
||||
];
|
||||
@ -1,13 +1,13 @@
|
||||
<?php
|
||||
return [
|
||||
'title' => "방어장비정보",
|
||||
'title' => "CS(VPN)정보",
|
||||
'label' => [
|
||||
'type' => "종류",
|
||||
'ip' => "IP",
|
||||
'accountid' => "계정ID",
|
||||
'domain' => "도메인",
|
||||
'price' => "금액",
|
||||
'description' => "설명",
|
||||
'price' => "소비자금액",
|
||||
'amount' => "서비스금액",
|
||||
'status' => "상태",
|
||||
'updated_at' => "수정일",
|
||||
'created_at' => "작성일",
|
||||
|
||||
@ -3,8 +3,12 @@ return [
|
||||
'title' => "IP정보",
|
||||
'label' => [
|
||||
'lineinfo_uid' => '회선정보',
|
||||
'clientinfo_code' => '(이전)고객정보',
|
||||
'serverinfo_code' => '서버정보',
|
||||
'ip' => "IP",
|
||||
'price' => "금액",
|
||||
'price' => "소비자금액",
|
||||
'amount' => "서비스금액",
|
||||
'history' => "사용내역",
|
||||
'status' => "상태",
|
||||
'updated_at' => "수정일",
|
||||
'created_at' => "작성일",
|
||||
@ -15,8 +19,7 @@ return [
|
||||
],
|
||||
"STATUS" => [
|
||||
'default' => "사용가능",
|
||||
"pause" => "일시정지",
|
||||
"forbidden" => "사용금지",
|
||||
"occupied" => "서비스중",
|
||||
"forbidden" => "금지됨",
|
||||
],
|
||||
];
|
||||
|
||||
@ -2,25 +2,24 @@
|
||||
return [
|
||||
'title' => "회선정보",
|
||||
'label' => [
|
||||
'clientinfo_uid' => "소유자명",
|
||||
'title' => "제목",
|
||||
'type' => "종류",
|
||||
'bandwith' => "CIDR대역",
|
||||
'price' => "금액",
|
||||
'status' => "상태",
|
||||
'start_at' => "개통일",
|
||||
'end_at' => "종료일",
|
||||
'updated_at' => "수정일",
|
||||
'created_at' => "작성일",
|
||||
'deleted_at' => "삭제일",
|
||||
],
|
||||
'DEFAULTS' => [
|
||||
'type' => 'default',
|
||||
'type' => 'normal',
|
||||
'status' => 'default'
|
||||
],
|
||||
"TYPE" => [
|
||||
"default" => "일반",
|
||||
"normal" => "일반",
|
||||
"dedicated" => "전용",
|
||||
"defence" => "방어",
|
||||
],
|
||||
"STATUS" => [
|
||||
'default' => "사용가능",
|
||||
|
||||
@ -2,19 +2,29 @@
|
||||
return [
|
||||
'title' => "서버장비정보",
|
||||
'label' => [
|
||||
'clientinfo_code' => "고객번호",
|
||||
'serviceinfo_code' => "서비스번호",
|
||||
'code' => "장비번호",
|
||||
'title' => "모델",
|
||||
'type' => "장비종류",
|
||||
'title' => "장비명",
|
||||
'price' => "기본금액",
|
||||
'amount' => "서비스금액",
|
||||
'manufactur_at' => "입고일",
|
||||
'format_at' => "포맷보유",
|
||||
'status' => "상태",
|
||||
'updated_at' => "수정일",
|
||||
'created_at' => "작성일",
|
||||
'deleted_at' => "삭제일",
|
||||
],
|
||||
'DEFAULTS' => [
|
||||
'type' => 'hp',
|
||||
'status' => 'default',
|
||||
],
|
||||
"TYPE" => [
|
||||
'hp' => "HP",
|
||||
"del" => "DELL",
|
||||
"etc" => "조립",
|
||||
],
|
||||
"STATUS" => [
|
||||
'default' => "사용가능",
|
||||
"pause" => "일시정지",
|
||||
|
||||
@ -15,6 +15,7 @@ class ClientProcess implements MigrationProcessInterface
|
||||
{
|
||||
$temps = [];
|
||||
$temps['code'] = $row['Client_Code'];
|
||||
$temps['user_uid'] = 1;
|
||||
$temps['role'] = $row['Client_Reseller'] == 30 ? "reseller" : "user";
|
||||
$temps['name'] = $row['Client_Name'];
|
||||
$temps['phone'] = empty($row['Client_Phone1']) ? "" : $row['Client_Phone1'];
|
||||
|
||||
@ -14,6 +14,23 @@ class LineProcess implements MigrationProcessInterface
|
||||
public function process(array $row, int $cnt): void
|
||||
{
|
||||
$temps = [];
|
||||
$temps['code'] = $row['Line_Code'];
|
||||
$temps['type'] = $row['Line_case'];
|
||||
$temps['role'] = $row['Client_Reseller'] == 30 ? "reseller" : "user";
|
||||
$temps['name'] = $row['Client_Name'];
|
||||
$temps['phone'] = empty($row['Client_Phone1']) ? "" : $row['Client_Phone1'];
|
||||
if (empty($temps['phone'])) {
|
||||
$temps['phone'] = empty($row['Client_Phone2']) ? "" : $row['Client_Phone2'];
|
||||
}
|
||||
$temps['email'] = empty($row['Client_EMail1']) ? "" : $row['Client_EMail1'];
|
||||
if (empty($temps['email'])) {
|
||||
$temps['email'] = empty($row['Client_EMail2']) ? "" : $row['Client_EMail2'];
|
||||
}
|
||||
$temps['account_balance'] = intval($row['Client_Money']);
|
||||
$temps['coupon_balance'] = 0;
|
||||
$temps['point_balance'] = 0;
|
||||
$temps['status'] = 'default';
|
||||
$temps['updated_at'] = empty($row['Client_Renew_date']) ? NULL : $row['Client_Renew_date'];
|
||||
// TODO: $temps에 필요한 데이터 매핑 추가
|
||||
if (!$this->db->table('lineinfo')->insert($temps)) {
|
||||
throw new \Exception($this->db->error()['message']);
|
||||
|
||||
@ -2,27 +2,26 @@
|
||||
|
||||
namespace App\Models\Customer;
|
||||
|
||||
use App\Entities\Customer\ServicePaymentEntity;
|
||||
use App\Entities\Customer\PaymentEntity;
|
||||
use App\Libraries\LogCollector;
|
||||
|
||||
class ServicePaymentModel extends CustomerModel
|
||||
class PaymentModel extends CustomerModel
|
||||
{
|
||||
const TABLE = "serviceinfo_payment";
|
||||
const TABLE = "payment";
|
||||
const PK = "uid";
|
||||
const TITLE = "item_type";
|
||||
const TITLE = "title";
|
||||
protected $table = self::TABLE;
|
||||
protected $primaryKey = self::PK;
|
||||
protected $returnType = ServicePaymentEntity::class;
|
||||
protected $returnType = PaymentEntity::class;
|
||||
protected $allowedFields = [
|
||||
"serviceinfo_uid",
|
||||
"ownerinfo_uid",
|
||||
"user_uid",
|
||||
"item_type",
|
||||
"item_uid",
|
||||
"billing_cycle",
|
||||
"clientinfo_code",
|
||||
"serviceinfo_code",
|
||||
"title",
|
||||
"amount",
|
||||
"billing_method",
|
||||
"billing_at",
|
||||
"issue_at",
|
||||
"pay_method",
|
||||
"status",
|
||||
"updated_at"
|
||||
];
|
||||
@ -36,26 +35,23 @@ class ServicePaymentModel extends CustomerModel
|
||||
throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true));
|
||||
}
|
||||
switch ($field) {
|
||||
case "serviceinfo_uid":
|
||||
case "ownerinfo_uid":
|
||||
case "item_uid":
|
||||
case "user_uid":
|
||||
case "amount":
|
||||
$rule = "required|numeric";
|
||||
break;
|
||||
case "user_uid":
|
||||
$rule = "if_exist|numeric";
|
||||
break;
|
||||
case "item_type":
|
||||
case "billing_cycle":
|
||||
case "title":
|
||||
case "billing_method":
|
||||
case "clientinfo_code":
|
||||
case "serviceinfo_code":
|
||||
$rule = "required|trim|string";
|
||||
break;
|
||||
case "billing_at":
|
||||
$rule = "required|valid_date";
|
||||
break;
|
||||
case "pay_method":
|
||||
case "status":
|
||||
$rule = "if_exist|trim|string";
|
||||
break;
|
||||
case "billing_at":
|
||||
case "issue_at":
|
||||
$rule = "required|valid_date";
|
||||
break;
|
||||
default:
|
||||
$rule = parent::getFormFieldRule($action, $field);
|
||||
break;
|
||||
@ -1,56 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Customer;
|
||||
|
||||
use App\Entities\Customer\ServiceItemEntity;
|
||||
|
||||
class ServiceItemModel extends CustomerModel
|
||||
{
|
||||
const TABLE = "serviceinfo_items";
|
||||
const PK = "uid";
|
||||
const TITLE = "item_type";
|
||||
protected $table = self::TABLE;
|
||||
protected $primaryKey = self::PK;
|
||||
protected $returnType = ServiceItemEntity::class;
|
||||
protected $allowedFields = [
|
||||
"serviceinfo_uid",
|
||||
"item_type",
|
||||
"item_uid",
|
||||
"billing_cycle",
|
||||
"price",
|
||||
"amount",
|
||||
"start_at",
|
||||
"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":
|
||||
case "item_uid":
|
||||
case "price":
|
||||
case "amount":
|
||||
$rule = "required|numeric";
|
||||
break;
|
||||
case "item_type":
|
||||
case "billing_cycle":
|
||||
case "status":
|
||||
$rule = "required|trim|string";
|
||||
break;
|
||||
case "start_at":
|
||||
$rule = "required|valid_date";
|
||||
break;
|
||||
default:
|
||||
$rule = parent::getFormFieldRule($action, $field);
|
||||
break;
|
||||
}
|
||||
return $rule;
|
||||
}
|
||||
}
|
||||
@ -17,7 +17,8 @@ class CSModel extends EquipmentModel
|
||||
"ip",
|
||||
"accountid",
|
||||
"domain",
|
||||
"description",
|
||||
"price",
|
||||
"amount",
|
||||
"status",
|
||||
"updated_at"
|
||||
];
|
||||
@ -43,6 +44,7 @@ class CSModel extends EquipmentModel
|
||||
$rule .= in_array($action, ["create", "create_form"]) ? "|is_unique[{$this->table}.{$field}]" : "";
|
||||
break;
|
||||
case "price":
|
||||
case "amount":
|
||||
$rule = "required|numeric";
|
||||
break;
|
||||
default:
|
||||
|
||||
@ -14,7 +14,12 @@ class IpModel extends EquipmentModel
|
||||
protected $returnType = IpEntity::class;
|
||||
protected $allowedFields = [
|
||||
"lineinfo_uid",
|
||||
"clientinfo_code",
|
||||
"serverinfo_code",
|
||||
"ip",
|
||||
"price",
|
||||
"amount",
|
||||
"history",
|
||||
"status",
|
||||
"updated_at"
|
||||
];
|
||||
@ -31,11 +36,17 @@ class IpModel extends EquipmentModel
|
||||
case "lineinfo_uid":
|
||||
$rule = "required|numeric";
|
||||
break;
|
||||
case "clientinfo_code":
|
||||
case "serverinfo_code":
|
||||
case "history":
|
||||
$rule = "if_exist|trim|string";
|
||||
break;
|
||||
case "ip":
|
||||
$rule = "required|trim|valid_ip[both]"; //ipv4 , ipv6 , both(ipv4,ipv6)
|
||||
$rule .= in_array($action, ["create", "create_form"]) ? "|is_unique[{$this->table}.{$field}]" : "";
|
||||
break;
|
||||
case "price":
|
||||
case "amount":
|
||||
$rule = "if_exist|numeric";
|
||||
break;
|
||||
default:
|
||||
|
||||
@ -13,12 +13,12 @@ class LineModel extends EquipmentModel
|
||||
protected $primaryKey = self::PK;
|
||||
protected $returnType = LineEntity::class;
|
||||
protected $allowedFields = [
|
||||
"clientinfo_uid",
|
||||
"type",
|
||||
"title",
|
||||
"bandwith",
|
||||
"status",
|
||||
"start_at",
|
||||
"end_at",
|
||||
"status",
|
||||
"updated_at"
|
||||
];
|
||||
public function __construct()
|
||||
@ -31,9 +31,6 @@ class LineModel extends EquipmentModel
|
||||
throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true));
|
||||
}
|
||||
switch ($field) {
|
||||
case "clientinfo_uid":
|
||||
$rule = "if_exist|numeric";
|
||||
break;
|
||||
case "price":
|
||||
$rule = "required|numeric";
|
||||
break;
|
||||
|
||||
@ -58,71 +58,15 @@ abstract class CustomerService extends CommonService
|
||||
return $this->_serverService;
|
||||
}
|
||||
//ServiceItemController,ServiceController에서 사용
|
||||
final public function getServiceItemLinkService(string $key): mixed
|
||||
{
|
||||
if (!array_key_exists($key, $this->_equipmentService)) {
|
||||
switch ($key) {
|
||||
case 'SERVER':
|
||||
if (!array_key_exists($key, $this->_equipmentService)) {
|
||||
$this->_equipmentService[$key] = new ServerService();
|
||||
}
|
||||
break;
|
||||
case 'CPU':
|
||||
if (!array_key_exists($key, $this->_equipmentService)) {
|
||||
$this->_equipmentService[$key] = new CpuService();
|
||||
}
|
||||
break;
|
||||
case 'RAM':
|
||||
if (!array_key_exists($key, $this->_equipmentService)) {
|
||||
$this->_equipmentService[$key] = new RamService();
|
||||
}
|
||||
break;
|
||||
case 'STORAGE':
|
||||
if (!array_key_exists($key, $this->_equipmentService)) {
|
||||
$this->_equipmentService[$key] = new StorageService();
|
||||
}
|
||||
break;
|
||||
case 'LINE':
|
||||
if (!array_key_exists($key, $this->_equipmentService)) {
|
||||
$this->_equipmentService[$key] = new LineService();
|
||||
}
|
||||
break;
|
||||
case 'IP':
|
||||
if (!array_key_exists($key, $this->_equipmentService)) {
|
||||
$this->_equipmentService[$key] = new IpService();
|
||||
}
|
||||
break;
|
||||
case 'DEFENCE':
|
||||
if (!array_key_exists($key, $this->_equipmentService)) {
|
||||
$this->_equipmentService[$key] = new DefenceService();
|
||||
}
|
||||
break;
|
||||
case 'SOFTWARE':
|
||||
if (!array_key_exists($key, $this->_equipmentService)) {
|
||||
$this->_equipmentService[$key] = new SoftwareService();
|
||||
}
|
||||
break;
|
||||
case 'DOMAIN':
|
||||
if (!array_key_exists($key, $this->_equipmentService)) {
|
||||
$this->_equipmentService[$key] = new DomainService();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new \Exception(__FUNCTION__ . "에서 사용하지않는 Service를 요청하였습니다.: {$key}");
|
||||
}
|
||||
}
|
||||
return $this->_equipmentService[$key];
|
||||
}
|
||||
//기본기능
|
||||
//FieldForm관련용
|
||||
public function getFormFieldOption(string $field, array $options = []): array
|
||||
{
|
||||
switch ($field) {
|
||||
case 'clientinfo_uid':
|
||||
case 'ownerinfo_uid':
|
||||
case 'clientinfo_code':
|
||||
$options = $this->getClientService()->getEntities();
|
||||
break;
|
||||
case 'serviceinfo_uid':
|
||||
case 'serviceinfo_code':
|
||||
$options = $this->getServiceService()->getEntities();
|
||||
break;
|
||||
case 'user_uid':
|
||||
@ -135,10 +79,6 @@ abstract class CustomerService extends CommonService
|
||||
return $options;
|
||||
}
|
||||
//ItemType에 따른 FilterOption 설정용
|
||||
final public function getFilterOptionsByItemType(string $item_type): array
|
||||
{
|
||||
return $this->getServiceItemLinkService($item_type)->getEntities();
|
||||
}
|
||||
final public function getClient(int $uid): ClientEntity
|
||||
{
|
||||
$entity = $this->getClientService()->getEntity($uid);
|
||||
|
||||
97
app/Services/Customer/PaymentService.php
Normal file
97
app/Services/Customer/PaymentService.php
Normal file
@ -0,0 +1,97 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Customer;
|
||||
|
||||
use App\Entities\Customer\ServiceEntity;
|
||||
use App\Entities\Customer\ServiceItemEntity;
|
||||
use App\Entities\Customer\PaymentEntity;
|
||||
use App\Models\Customer\PaymentModel;
|
||||
|
||||
class PaymentService extends CustomerService
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(new PaymentModel());
|
||||
$this->addClassName('Payment');
|
||||
}
|
||||
public function getModelClass(): PaymentModel
|
||||
{
|
||||
return new PaymentModel();
|
||||
}
|
||||
public function getEntityClass(): PaymentEntity
|
||||
{
|
||||
return new PaymentEntity();
|
||||
}
|
||||
public function getFormFields(): array
|
||||
{
|
||||
return [
|
||||
"clientinfo_code",
|
||||
"serviceinfo_code",
|
||||
"title",
|
||||
"amount",
|
||||
"billing_method",
|
||||
"billing_at",
|
||||
"pay_method",
|
||||
"status",
|
||||
"updated_at"
|
||||
];
|
||||
}
|
||||
public function getFilterFields(): array
|
||||
{
|
||||
return ['clientinfo_code', 'billing_method', 'pay_method', 'status', 'user_uid'];
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
return ['clientinfo_code', 'billing_method', 'pay_method', 'status'];
|
||||
}
|
||||
public function getIndexFields(): array
|
||||
{
|
||||
return ['clientinfo_code', 'billing_method', 'amount', 'billing_at', 'pay_method', 'status', 'user_uid', 'count_down'];
|
||||
}
|
||||
public function getBatchJobButtons(): array
|
||||
{
|
||||
return [
|
||||
'invoice' => '청구서 발행',
|
||||
];
|
||||
}
|
||||
//기본 기능부분
|
||||
//FieldForm관련용
|
||||
public function getFormFieldOption(string $field, array $options = []): array
|
||||
{
|
||||
switch ($field) {
|
||||
case 'user_uid':
|
||||
$options = $this->getUserService()->getEntities();
|
||||
break;
|
||||
case 'clientinfo_code':
|
||||
$options = $this->getClientService()->getEntities();
|
||||
break;
|
||||
case 'serviceinfo_code':
|
||||
$options = $this->getServiceService()->getEntities();
|
||||
break;
|
||||
default:
|
||||
$options = parent::getFormFieldOption($field, $options);
|
||||
break;
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
//미납서비스 정보
|
||||
final public function getUnPaidCount(): array
|
||||
{
|
||||
$sql = sprintf("SELECT serviceinfo_code,COUNT(*) as CNT
|
||||
FROM payment
|
||||
WHERE billing_at < NOW() AND amount > 0 AND status = '%s'
|
||||
GROUP BY serviceinfo_code", DEFAULTS['STATUS']);
|
||||
$unpaids = [];
|
||||
foreach ($this->getModel()->query($sql)->getResult() as $row) {
|
||||
$unpaids[$row->serverinfo_code] = $row->CNT;
|
||||
}
|
||||
return $unpaids;
|
||||
}
|
||||
//List 검색용
|
||||
//OrderBy 처리
|
||||
public function setOrderBy(mixed $field = null, mixed $value = null): void
|
||||
{
|
||||
$this->getModel()->orderBy('billing_at ASC');
|
||||
parent::setOrderBy($field, $value);
|
||||
}
|
||||
}
|
||||
@ -1,80 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Customer;
|
||||
|
||||
use App\Entities\Customer\ServiceItemEntity;
|
||||
use App\Entities\Equipment\Part\IpEntity;
|
||||
use App\Models\Customer\ServiceItemModel;
|
||||
use App\Services\Customer\CustomerService;
|
||||
use App\Services\Equipment\Part\IpService;
|
||||
|
||||
class ServiceItemService extends CustomerService
|
||||
{
|
||||
private ?IpService $_ipService = null;
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->addClassName('ServiceItem');
|
||||
}
|
||||
public function getModelClass(): ServiceItemModel
|
||||
{
|
||||
return new ServiceItemModel();
|
||||
}
|
||||
public function getEntityClass(): ServiceItemEntity
|
||||
{
|
||||
return new ServiceItemEntity();
|
||||
}
|
||||
public function getIpService(): IpService
|
||||
{
|
||||
if (!$this->_ipService) {
|
||||
$this->_ipService = new IpService();
|
||||
}
|
||||
return $this->_ipService;
|
||||
}
|
||||
public function getFormFields(): array
|
||||
{
|
||||
return [
|
||||
"serviceinfo_uid",
|
||||
"item_type",
|
||||
"item_uid",
|
||||
"billing_cycle",
|
||||
"price",
|
||||
"amount",
|
||||
"start_at",
|
||||
"status",
|
||||
];
|
||||
}
|
||||
public function getFilterFields(): array
|
||||
{
|
||||
return ["serviceinfo_uid", 'item_type', 'item_uid', 'billing_cycle', 'status'];
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
return ['status'];
|
||||
}
|
||||
public function getIndexFields(): array
|
||||
{
|
||||
return ['serviceinfo_uid', 'item_type', 'item_uid', 'billing_cycle', 'price', 'amount', 'start_at', 'updated_at', 'status'];
|
||||
}
|
||||
//Entity의 관련객체정의용
|
||||
//FieldForm관련용
|
||||
public function modify(mixed $entity, array $formDatas): ServiceItemEntity
|
||||
{
|
||||
//IP가 기존과 다를경우 //toggle,batchjob의 경우 $formDatas에 code가 없을수도 있음
|
||||
if (array_key_exists('item_type', $formDatas) && $formDatas['item_type'] !== 'IP') {
|
||||
//기존 IP의 경우 반환처리
|
||||
$this->getIpService()->setStatus($entity->getItemUID(), IpEntity::STATUS_AVAILABLE);
|
||||
//신규 설정된 IP의 경우 서비스중 변경처리
|
||||
$this->getIpService()->setStatus($formDatas['item_uid'], IpEntity::STATUS_OCCUPIED);
|
||||
}
|
||||
return parent::modify($entity, $formDatas);
|
||||
}
|
||||
public function delete(mixed $entity): ServiceItemEntity
|
||||
{
|
||||
//기존 Ip의 경우 반환처리
|
||||
if ($entity->getItemType() === 'IP') {
|
||||
$this->getIpService()->setStatus($entity->getItemUID(), IpEntity::STATUS_AVAILABLE);
|
||||
}
|
||||
return parent::delete($entity);
|
||||
}
|
||||
}
|
||||
@ -5,10 +5,8 @@ namespace App\Services\Customer;
|
||||
use App\Entities\Customer\ServiceEntity;
|
||||
use App\Models\Customer\ServiceModel;
|
||||
|
||||
|
||||
class ServiceService extends CustomerService
|
||||
{
|
||||
private ?ServicePaymentService $_servicePaymentService = null;
|
||||
private ?string $_searchIP = null;
|
||||
public function __construct()
|
||||
{
|
||||
@ -18,7 +16,7 @@ class ServiceService extends CustomerService
|
||||
public function getFormFields(): array
|
||||
{
|
||||
return [
|
||||
"clientinfo_uid",
|
||||
"clientinfo_code",
|
||||
"billing_at",
|
||||
"start_at",
|
||||
"status"
|
||||
@ -26,7 +24,7 @@ class ServiceService extends CustomerService
|
||||
}
|
||||
public function getFilterFields(): array
|
||||
{
|
||||
return ["user_uid", "clientinfo_uid", 'status'];
|
||||
return ["user_uid", "clientinfo_code", 'status'];
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
@ -34,14 +32,7 @@ class ServiceService extends CustomerService
|
||||
}
|
||||
public function getIndexFields(): array
|
||||
{
|
||||
return ['clientinfo_uid', 'location', 'billing_at', 'start_at', 'updated_at', 'status', 'user_uid'];
|
||||
}
|
||||
public function getServicePaymentService(): ServicePaymentService
|
||||
{
|
||||
if (!$this->_servicePaymentService) {
|
||||
$this->_servicePaymentService = new ServicePaymentService();
|
||||
}
|
||||
return $this->_servicePaymentService;
|
||||
return ['clientinfo_code', 'location', 'billing_at', 'start_at', 'updated_at', 'status', 'user_uid'];
|
||||
}
|
||||
//Entity의 관련객체정의용
|
||||
public function setSearchIp(string $ip): void
|
||||
@ -52,18 +43,18 @@ class ServiceService extends CustomerService
|
||||
{
|
||||
return $this->_searchIP;
|
||||
}
|
||||
protected function findAllDatas_process(array $columns = ['*']): mixed
|
||||
{
|
||||
$ip = $this->getSearchIp();
|
||||
if ($ip) {
|
||||
$sql = "SELECT serviceinfo.* FROM serviceinfo
|
||||
LEFT JOIN serviceinfo_items ON serviceinfo.uid = serviceinfo_items.serviceinfo_uid
|
||||
WHERE serviceinfo_items.item_type = ?
|
||||
AND serviceinfo_items.item_uid IN (SELECT uid FROM ipinfo WHERE ip = ?)";
|
||||
return $this->getModel()->query($sql, ['IP', $ip])->getResult(ServiceEntity::class);
|
||||
}
|
||||
return parent::findAllDatas_process($columns);
|
||||
}
|
||||
// protected function findAllDatas_process(array $columns = ['*']): mixed
|
||||
// {
|
||||
// $ip = $this->getSearchIp();
|
||||
// if ($ip) {
|
||||
// $sql = "SELECT serviceinfo.* FROM serviceinfo
|
||||
// LEFT JOIN serviceinfo_items ON serviceinfo.uid = serviceinfo_items.serviceinfo_code
|
||||
// WHERE serviceinfo_items.item_type = ?
|
||||
// AND serviceinfo_items.item_uid IN (SELECT uid FROM ipinfo WHERE ip = ?)";
|
||||
// return $this->getModel()->query($sql, ['IP', $ip])->getResult(ServiceEntity::class);
|
||||
// }
|
||||
// return parent::findAllDatas_process($columns);
|
||||
// }
|
||||
//기본 기능부분
|
||||
//FieldForm관련용
|
||||
public function getFormFieldOption(string $field, array $options = []): array
|
||||
@ -72,7 +63,7 @@ class ServiceService extends CustomerService
|
||||
case 'user_uid':
|
||||
$options = $this->getUserService()->getEntities();
|
||||
break;
|
||||
case 'clientinfo_uid':
|
||||
case 'clientinfo_code':
|
||||
$options = $this->getClientService()->getEntities();
|
||||
break;
|
||||
default:
|
||||
@ -125,42 +116,6 @@ class ServiceService extends CustomerService
|
||||
// $this->getServerService()->setService($entity)ServerEntity::STATUS_OCCUPIED);
|
||||
return parent::create($formDatas);
|
||||
}
|
||||
public function modify(mixed $entity, array $formDatas): ServiceEntity
|
||||
{
|
||||
//code가 기존과 다를경우 //toggle,batchjob의 경우 $formDatas에 code가 없을수도 있음
|
||||
if (array_key_exists('codeinfo_uid', $formDatas) && $formDatas['codeinfo_uid'] !== $entity->getCodeUID()) {
|
||||
//기존 code의 경우 반환처리
|
||||
$this->getCodeService()->setStatus($entity->getCodeUID(), CodeEntity::STATUS_AVAILABLE);
|
||||
//신규 설정된 code의 경우 서비스중 변경처리
|
||||
$this->getCodeService()->setStatus($formDatas['codeinfo_uid'], CodeEntity::STATUS_OCCUPIED);
|
||||
}
|
||||
//switch가 기존과 다를경우 //toggle,batchjob의 경우 $formDatas에 switch가 없을수도 있음
|
||||
if (array_key_exists('switchinfo_uid', $formDatas) && $formDatas['switchinfo_uid'] !== $entity->getSwitchUID()) {
|
||||
//기존 switch의 경우 반환처리
|
||||
$this->getSwitchService()->setStatus($entity->getSwitchUID(), SwitchEntity::STATUS_AVAILABLE);
|
||||
//신규 설정된 switch의 경우 서비스중 변경처리
|
||||
$this->getSwitchService()->setStatus($formDatas['switchinfo_uid'], SwitchEntity::STATUS_OCCUPIED);
|
||||
}
|
||||
//관리자가 바뀐경우 결제쪽에도 결제가 완료되지않은 것은 관리자를 변경해줘야함
|
||||
if (array_key_exists('ownerinfo_uid', $formDatas) && $entity->getOwnerUID() !== intval($formDatas['ownerinfo_uid'])) {
|
||||
$this->getServicePaymentService()->modifyOwnerByService($entity, $formDatas['ownerinfo_uid']);
|
||||
}
|
||||
return parent::modify($entity, $formDatas);
|
||||
}
|
||||
public function delete(mixed $entity): ServiceEntity
|
||||
{
|
||||
//기존 code의 경우 반환처리
|
||||
$this->getCodeService()->setStatus($entity->getCode(), CodeEntity::STATUS_AVAILABLE);
|
||||
//기존 switch의 경우 반환처리
|
||||
$this->getSwitchService()->setStatus($entity->getCode(), SwitchEntity::STATUS_AVAILABLE);
|
||||
//Item들 삭제
|
||||
foreach (SERVICE_ITEM_TYPES as $item_type => $label) {
|
||||
foreach ($entity->getItemEntities($item_type) as $itemEntity) {
|
||||
$this->getServiceItemService()->delete($itemEntity);
|
||||
}
|
||||
}
|
||||
return parent::delete($entity);
|
||||
}
|
||||
//List 검색용
|
||||
//검색어조건절처리
|
||||
public function setList_WordFilter(string $word): void
|
||||
|
||||
@ -10,7 +10,7 @@ class CSService extends EquipmentService
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(new CSModel());
|
||||
$this->addClassName('Defence');
|
||||
$this->addClassName('CS');
|
||||
}
|
||||
public function getFormFields(): array
|
||||
{
|
||||
@ -19,8 +19,9 @@ class CSService extends EquipmentService
|
||||
"ip",
|
||||
"accountid",
|
||||
"domain",
|
||||
"price",
|
||||
"amount",
|
||||
"status",
|
||||
"description",
|
||||
];
|
||||
}
|
||||
public function getFilterFields(): array
|
||||
@ -33,7 +34,7 @@ class CSService extends EquipmentService
|
||||
}
|
||||
public function getIndexFields(): array
|
||||
{
|
||||
return ['type', 'ip', 'accountid', 'domain', 'status'];
|
||||
return ['type', 'ip', 'accountid', 'domain', 'price', 'amount', 'status'];
|
||||
}
|
||||
//List 검색용
|
||||
//OrderBy 처리
|
||||
|
||||
@ -1,42 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Equipment;
|
||||
|
||||
use App\Entities\Equipment\Part\DomainEntity;
|
||||
use App\Models\Equipment\Part\DomainModel;
|
||||
|
||||
class DomainService extends EquipmentService
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(new DomainModel());
|
||||
$this->addClassName('Domain');
|
||||
}
|
||||
public function getFormFields(): array
|
||||
{
|
||||
return [
|
||||
"domain",
|
||||
"status",
|
||||
];
|
||||
}
|
||||
public function getFilterFields(): array
|
||||
{
|
||||
return ['status',];
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
return ['status'];
|
||||
}
|
||||
|
||||
public function getIndexFields(): array
|
||||
{
|
||||
return ['domain', 'status'];
|
||||
}
|
||||
//List 검색용
|
||||
//OrderBy 처리
|
||||
public function setOrderBy(mixed $field = null, mixed $value = null): void
|
||||
{
|
||||
$this->getModel()->orderBy('domain', 'ASC');
|
||||
parent::setOrderBy($field, $value);
|
||||
}
|
||||
}
|
||||
@ -4,11 +4,13 @@ namespace App\Services\Equipment;
|
||||
|
||||
use App\Services\CommonService;
|
||||
use App\Services\Customer\ClientService;
|
||||
use App\Services\Equipment\ServerService;
|
||||
use CodeIgniter\Model;
|
||||
|
||||
abstract class EquipmentService extends CommonService
|
||||
{
|
||||
private ?ClientService $_clientService = null;
|
||||
private ?ServerService $_serverService = null;
|
||||
protected function __construct(Model $model)
|
||||
{
|
||||
parent::__construct($model);
|
||||
@ -22,6 +24,13 @@ abstract class EquipmentService extends CommonService
|
||||
}
|
||||
return $this->_clientService;
|
||||
}
|
||||
final public function getServerService(): ServerService
|
||||
{
|
||||
if (!$this->_serverService) {
|
||||
$this->_serverService = new ServerService();
|
||||
}
|
||||
return $this->_serverService;
|
||||
}
|
||||
//FieldForm관련용
|
||||
public function getFormFieldOption(string $field, array $options = []): array
|
||||
{
|
||||
|
||||
@ -20,7 +20,12 @@ class IpService extends EquipmentService
|
||||
{
|
||||
return [
|
||||
"lineinfo_uid",
|
||||
"clientinfo_code",
|
||||
"serverinfo_code",
|
||||
"ip",
|
||||
"price",
|
||||
"amount",
|
||||
"history",
|
||||
"status",
|
||||
];
|
||||
}
|
||||
@ -34,7 +39,7 @@ class IpService extends EquipmentService
|
||||
}
|
||||
public function getIndexFields(): array
|
||||
{
|
||||
return ['lineinfo_uid', 'ip', 'status'];
|
||||
return ['lineinfo_uid', 'clientinfo_code', 'serverinfo_code', 'ip', 'price', 'amount', 'status'];
|
||||
}
|
||||
final public function getLineService(): LineService
|
||||
{
|
||||
@ -51,6 +56,12 @@ class IpService extends EquipmentService
|
||||
case 'lineinfo_uid':
|
||||
$options = $this->getLineService()->getEntities();
|
||||
break;
|
||||
case 'clientinfo_code':
|
||||
$options = $this->getClientService()->getEntities();
|
||||
break;
|
||||
case 'serverinfo_code':
|
||||
$options = $this->getServerService()->getEntities();
|
||||
break;
|
||||
default:
|
||||
$options = parent::getFormFieldOption($field, $options);
|
||||
break;
|
||||
|
||||
@ -14,17 +14,17 @@ class LineService extends EquipmentService
|
||||
public function getFormFields(): array
|
||||
{
|
||||
return [
|
||||
"clientinfo_uid",
|
||||
"type",
|
||||
"title",
|
||||
"bandwith",
|
||||
"start_at",
|
||||
"end_at",
|
||||
"status",
|
||||
];
|
||||
}
|
||||
public function getFilterFields(): array
|
||||
{
|
||||
return ["clientinfo_uid", "type", 'status',];
|
||||
return ["type", 'status',];
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
@ -32,6 +32,6 @@ class LineService extends EquipmentService
|
||||
}
|
||||
public function getIndexFields(): array
|
||||
{
|
||||
return ['clientinfo_uid', 'type', 'title', 'bandwith', 'status', "start_at"];
|
||||
return ['type', 'title', 'bandwith', "start_at", "end_at", 'status'];
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,11 +16,15 @@ class ServerService extends EquipmentService
|
||||
public function getFormFields(): array
|
||||
{
|
||||
return [
|
||||
"clientinfo_code",
|
||||
"serviceinfo_code",
|
||||
"code",
|
||||
"type",
|
||||
"title",
|
||||
"price",
|
||||
"amount",
|
||||
"manufactur_at",
|
||||
"format_at",
|
||||
"status",
|
||||
];
|
||||
}
|
||||
@ -30,11 +34,11 @@ class ServerService extends EquipmentService
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
return ['status'];
|
||||
return ['type', 'status'];
|
||||
}
|
||||
public function getIndexFields(): array
|
||||
{
|
||||
return ['title', 'price', 'amount', 'manufactur_at', 'status'];
|
||||
return ['clientinfo_code', 'serviceinfo_code', "type", 'title', 'price', 'amount', 'manufactur_at', "format_at", 'status'];
|
||||
}
|
||||
//List 검색용
|
||||
//OrderBy 처리
|
||||
|
||||
@ -1,122 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Customer;
|
||||
|
||||
use App\Entities\Customer\ServiceEntity;
|
||||
use App\Entities\Customer\ServiceItemEntity;
|
||||
use App\Entities\Customer\ServicePaymentEntity;
|
||||
use App\Models\Customer\ServicePaymentModel;
|
||||
|
||||
class ServicePaymentService extends CustomerService
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->addClassName('ServicePayment');
|
||||
}
|
||||
public function getModelClass(): ServicePaymentModel
|
||||
{
|
||||
return new ServicePaymentModel();
|
||||
}
|
||||
public function getEntityClass(): ServicePaymentEntity
|
||||
{
|
||||
return new ServicePaymentEntity();
|
||||
}
|
||||
public function getFormFields(): array
|
||||
{
|
||||
return [
|
||||
"serviceinfo_uid",
|
||||
"ownerinfo_uid",
|
||||
"item_type",
|
||||
"item_uid",
|
||||
"billing_cycle",
|
||||
"amount",
|
||||
"billing_at",
|
||||
"issue_at",
|
||||
"status",
|
||||
];
|
||||
}
|
||||
public function getFilterFields(): array
|
||||
{
|
||||
return ["serviceinfo_uid", "ownerinfo_uid", 'user_uid', 'item_type', 'billing_cycle', 'status'];
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
return ['status'];
|
||||
}
|
||||
public function getIndexFields(): array
|
||||
{
|
||||
return ["ownerinfo_uid", 'serviceinfo_uid', 'item_type', 'item_uid', 'billing_cycle', 'amount', 'billing_at', 'issue_at', 'countdown', 'status', 'user_uid'];
|
||||
}
|
||||
public function getBatchJobButtons(): array
|
||||
{
|
||||
return [
|
||||
'invoice' => '청구서 발행',
|
||||
];
|
||||
}
|
||||
//기본 기능부분
|
||||
//FieldForm관련용
|
||||
public function getFormFieldOption(string $field, array $options = []): array
|
||||
{
|
||||
switch ($field) {
|
||||
case 'item_uid':
|
||||
$options = [];
|
||||
break;
|
||||
default:
|
||||
$options = parent::getFormFieldOption($field, $options);
|
||||
break;
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
//미납서비스 정보
|
||||
final public function getUnPaidCountByService(): array
|
||||
{
|
||||
$sql = sprintf("SELECT serviceinfo_uid,COUNT(*) as CNT
|
||||
FROM serviceinfo_payment
|
||||
WHERE billing_at < NOW() AND amount > 0 AND status = '%s'
|
||||
GROUP BY serviceinfo_uid", DEFAULTS['STATUS']);
|
||||
$unpaids = [];
|
||||
foreach ($this->getModel()->query($sql)->getResult() as $row) {
|
||||
$unpaids[$row->serviceinfo_uid] = $row->CNT;
|
||||
}
|
||||
return $unpaids;
|
||||
}
|
||||
//결체처리정보 등록 : ServiceItemService에서 사용
|
||||
public function createByServiceItemService(array $formDatas, ServiceItemEntity $serviceItemEntity): ServicePaymentEntity
|
||||
{
|
||||
$serviceEntity = $this->getServiceService()->getEntity($serviceItemEntity->getServiceUid());
|
||||
if (!$serviceEntity) {
|
||||
throw new \Exception("{$serviceItemEntity->getServiceUid()}에 대한 서비스정보를 찾을수 없습니다.");
|
||||
}
|
||||
$formDatas['serviceinfo_uid'] = $serviceItemEntity->getServiceUid();
|
||||
$formDatas['ownerinfo_uid'] = $serviceEntity->getOwnerUid();
|
||||
$formDatas['item_type'] = $serviceItemEntity->getItemType();
|
||||
$formDatas['item_uid'] = $serviceItemEntity->getItemUid();
|
||||
$formDatas['billing_cycle'] = $serviceItemEntity->getBillingCycle();
|
||||
$formDatas['amount'] = $serviceItemEntity->getAmount();
|
||||
$formDatas['billing_at'] = $serviceEntity->getBillingAt();
|
||||
$formDatas['issue_at'] = date('Y-m-d');
|
||||
return $this->create($formDatas);
|
||||
}
|
||||
|
||||
//Service정보 와 관리자가 기존 정보과 같고, 결제가 아직 완료되지 않은 결제정보의 관리자 변경
|
||||
public function modifyOwnerByService(ServiceEntity $serviceEntity, int $ownerinfo_uid)
|
||||
{
|
||||
foreach (
|
||||
$this->getEntities([
|
||||
'serviceinfo_uid' => $serviceEntity->getPK(),
|
||||
'ownerinfo_uid' => $serviceEntity->getOwnerUID(),
|
||||
'status' => DEFAULTS['STATUS']
|
||||
]) as $entity
|
||||
) {
|
||||
$this->modify($entity, ['ownerinfo_uid' => $ownerinfo_uid]);
|
||||
}
|
||||
}
|
||||
//List 검색용
|
||||
//OrderBy 처리
|
||||
public function setOrderBy(mixed $field = null, mixed $value = null): void
|
||||
{
|
||||
$this->getModel()->orderBy('billing_at ASC');
|
||||
parent::setOrderBy($field, $value);
|
||||
}
|
||||
}
|
||||
@ -1,122 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Customer;
|
||||
|
||||
use App\Entities\Customer\ServiceEntity;
|
||||
use App\Entities\Customer\ServiceItemEntity;
|
||||
use App\Entities\Customer\ServicePaymentEntity;
|
||||
use App\Models\Customer\ServicePaymentModel;
|
||||
|
||||
class ServicePaymentService extends CustomerService
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->addClassName('ServicePayment');
|
||||
}
|
||||
public function getModelClass(): ServicePaymentModel
|
||||
{
|
||||
return new ServicePaymentModel();
|
||||
}
|
||||
public function getEntityClass(): ServicePaymentEntity
|
||||
{
|
||||
return new ServicePaymentEntity();
|
||||
}
|
||||
public function getFormFields(): array
|
||||
{
|
||||
return [
|
||||
"serviceinfo_uid",
|
||||
"ownerinfo_uid",
|
||||
"item_type",
|
||||
"item_uid",
|
||||
"billing_cycle",
|
||||
"amount",
|
||||
"billing_at",
|
||||
"issue_at",
|
||||
"status",
|
||||
];
|
||||
}
|
||||
public function getFilterFields(): array
|
||||
{
|
||||
return ["serviceinfo_uid", "ownerinfo_uid", 'user_uid', 'item_type', 'billing_cycle', 'status'];
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
return ['status'];
|
||||
}
|
||||
public function getIndexFields(): array
|
||||
{
|
||||
return ["ownerinfo_uid", 'serviceinfo_uid', 'item_type', 'item_uid', 'billing_cycle', 'amount', 'billing_at', 'issue_at', 'countdown', 'status', 'user_uid'];
|
||||
}
|
||||
public function getBatchJobButtons(): array
|
||||
{
|
||||
return [
|
||||
'invoice' => '청구서 발행',
|
||||
];
|
||||
}
|
||||
//기본 기능부분
|
||||
//FieldForm관련용
|
||||
public function getFormFieldOption(string $field, array $options = []): array
|
||||
{
|
||||
switch ($field) {
|
||||
case 'item_uid':
|
||||
$options = [];
|
||||
break;
|
||||
default:
|
||||
$options = parent::getFormFieldOption($field, $options);
|
||||
break;
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
//미납서비스 정보
|
||||
final public function getUnPaidCountByService(): array
|
||||
{
|
||||
$sql = sprintf("SELECT serviceinfo_uid,COUNT(*) as CNT
|
||||
FROM serviceinfo_payment
|
||||
WHERE billing_at < NOW() AND amount > 0 AND status = '%s'
|
||||
GROUP BY serviceinfo_uid", DEFAULTS['STATUS']);
|
||||
$unpaids = [];
|
||||
foreach ($this->getModel()->query($sql)->getResult() as $row) {
|
||||
$unpaids[$row->serviceinfo_uid] = $row->CNT;
|
||||
}
|
||||
return $unpaids;
|
||||
}
|
||||
//결체처리정보 등록 : ServiceItemService에서 사용
|
||||
public function createByServiceItemService(array $formDatas, ServiceItemEntity $serviceItemEntity): ServicePaymentEntity
|
||||
{
|
||||
$serviceEntity = $this->getServiceService()->getEntity($serviceItemEntity->getServiceUid());
|
||||
if (!$serviceEntity) {
|
||||
throw new \Exception("{$serviceItemEntity->getServiceUid()}에 대한 서비스정보를 찾을수 없습니다.");
|
||||
}
|
||||
$formDatas['serviceinfo_uid'] = $serviceItemEntity->getServiceUid();
|
||||
$formDatas['ownerinfo_uid'] = $serviceEntity->getOwnerUid();
|
||||
$formDatas['item_type'] = $serviceItemEntity->getItemType();
|
||||
$formDatas['item_uid'] = $serviceItemEntity->getItemUid();
|
||||
$formDatas['billing_cycle'] = $serviceItemEntity->getBillingCycle();
|
||||
$formDatas['amount'] = $serviceItemEntity->getAmount();
|
||||
$formDatas['billing_at'] = $serviceEntity->getBillingAt();
|
||||
$formDatas['issue_at'] = date('Y-m-d');
|
||||
return $this->create($formDatas);
|
||||
}
|
||||
|
||||
//Service정보 와 관리자가 기존 정보과 같고, 결제가 아직 완료되지 않은 결제정보의 관리자 변경
|
||||
public function modifyOwnerByService(ServiceEntity $serviceEntity, int $ownerinfo_uid)
|
||||
{
|
||||
foreach (
|
||||
$this->getEntities([
|
||||
'serviceinfo_uid' => $serviceEntity->getPK(),
|
||||
'ownerinfo_uid' => $serviceEntity->getOwnerUID(),
|
||||
'status' => DEFAULTS['STATUS']
|
||||
]) as $entity
|
||||
) {
|
||||
$this->modify($entity, ['ownerinfo_uid' => $ownerinfo_uid]);
|
||||
}
|
||||
}
|
||||
//List 검색용
|
||||
//OrderBy 처리
|
||||
public function setOrderBy(mixed $field = null, mixed $value = null): void
|
||||
{
|
||||
$this->getModel()->orderBy('billing_at ASC');
|
||||
parent::setOrderBy($field, $value);
|
||||
}
|
||||
}
|
||||
@ -1,64 +0,0 @@
|
||||
<?= $this->extend(LAYOUTS[$viewDatas['layout']]['path']) ?>
|
||||
<?= $this->section('content') ?>
|
||||
<?php if ($error = session('error')): echo $viewDatas['helper']->alert($error) ?><?php endif ?>
|
||||
<div id="container" class="content">
|
||||
<div class="form_top"><?= $this->include("templates/{$viewDatas['layout']}/form_content_top"); ?></div>
|
||||
<?= form_open(current_url(), $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
|
||||
<div class="action_form">
|
||||
<table class="table table-bordered">
|
||||
<?php foreach ($viewDatas['control']['form_fields'] as $field): ?>
|
||||
<tr>
|
||||
<th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel($field, lang("{$viewDatas['class_path']}.label.{$field}"), $viewDatas) ?></th>
|
||||
<td nowrap class="text-start">
|
||||
<?= $viewDatas['helper']->getFieldForm($field, old($field) ?? ($viewDatas['control']['filter_values'][$field] ?? null), $viewDatas) ?>
|
||||
<span><?= validation_show_error($field); ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
<div class="text-center"><?= form_submit('', '입력', array("class" => "btn btn-outline btn-primary")); ?></div>
|
||||
<?= form_close(); ?>
|
||||
</div>
|
||||
<div class="form_bottom"><?= $this->include("templates/{$viewDatas['layout']}/form_content_bottom"); ?></div>
|
||||
</div>
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
if (document.querySelector('#domain')) {
|
||||
const domainSelecor = document.querySelector('#domain')
|
||||
const errorBox = document.getElementById('domain-errors');
|
||||
|
||||
const tagify = new Tagify(domainSelecor, {
|
||||
enforceWhitelist: false,
|
||||
whitelist: [],
|
||||
duplicates: false,
|
||||
delimiters: ", ",
|
||||
pattern: /[a-zA-Z0-9\.\/\?\:@\-_=#]+\.([a-zA-Z0-9\&\.\/\?\:@\-_=#])*/ // 도메인주소 패턴
|
||||
});
|
||||
// ✅ 패턴이 맞지 않을 때
|
||||
tagify.on('invalid', e => {
|
||||
const value = e.detail.data.value;
|
||||
errorBox.innerText = `"${value}" 은(는) 유효한 도메인 형식이 아닙니다. 예: domain.co.kr`;
|
||||
});
|
||||
// ✅ 서버에서 존재 여부 확인
|
||||
tagify.on('add', async e => {
|
||||
const domain = e.detail.data.value;
|
||||
const res = await fetch('/admin/equipment/part/domain/confirm', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
domain
|
||||
})
|
||||
});
|
||||
const results = await res.json();
|
||||
// 이미 존재하는 도메인인지 확인 결과처리
|
||||
if (exists = results.exists === true || results.exists === 'true') {
|
||||
tagify.removeTag(domain);
|
||||
errorBox.innerText = results.message;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<?= $this->endSection() ?>
|
||||
@ -1,20 +0,0 @@
|
||||
<?= $this->extend(LAYOUTS[$viewDatas['layout']]['path']) ?>
|
||||
<?= $this->section('content') ?>
|
||||
<?php if ($error = session('error')): echo $viewDatas['helper']->alert($error) ?><?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">
|
||||
<table class="table table-bordered">
|
||||
<?php foreach ($viewDatas['entities'] as $entity): ?>
|
||||
<?php $viewDatas['entity'] = $entity ?>
|
||||
<?php foreach ($viewDatas['control']['view_fields'] as $field): ?>
|
||||
<tr>
|
||||
<th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel($field, lang("{$viewDatas['class_path']}.label.{$field}"), $viewDatas) ?></th>
|
||||
<td nowrap class="text-start"><?= $viewDatas['helper']->getFieldView($field, $viewDatas['entity']->$field, $viewDatas) ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<?= $this->endSection() ?>
|
||||
@ -9,30 +9,18 @@
|
||||
<a href="/admin/equipment/switch"><?= ICONS['SETUP'] ?>Switch정보</a>
|
||||
</div>
|
||||
<div class="accordion-item">
|
||||
<a href="/admin/equipment/part/line"><?= ICONS['SERVICE_ITEM_LINE'] ?>회선정보</a>
|
||||
<a href="/admin/equipment/line"><?= ICONS['SERVICE_ITEM_LINE'] ?>회선정보</a>
|
||||
</div>
|
||||
<div class="accordion-item">
|
||||
<a href="/admin/equipment/part/ip"><?= ICONS['SERVICE_ITEM_IP'] ?>IP정보</a>
|
||||
<a href="/admin/equipment/ip"><?= ICONS['SERVICE_ITEM_IP'] ?>IP정보</a>
|
||||
</div>
|
||||
<div class="accordion-item">
|
||||
<a href="/admin/equipment/cs"><?= ICONS['SERVICE_ITEM_DEFENCE'] ?>CS(VPN)정보</a>
|
||||
</div>
|
||||
<div class="accordion-item">
|
||||
<a href="/admin/equipment/server"><?= ICONS['SERVICE_ITEM_SERVER'] ?>Server정보</a>
|
||||
</div>
|
||||
<div class="accordion-item">
|
||||
<a href="/admin/equipment/part/defence"><?= ICONS['SERVICE_ITEM_DEFENCE'] ?>CS정보</a>
|
||||
</div>
|
||||
<div class="accordion-item">
|
||||
<a href="/admin/equipment/part/software"><?= ICONS['SERVICE_ITEM_SOFTWARE'] ?>Software정보</a>
|
||||
</div>
|
||||
<div class="accordion-item">
|
||||
<a href="/admin/equipment/part/domain"><?= ICONS['SERVICE_ITEM_DOMAIN'] ?>도메인정보</a>
|
||||
</div>
|
||||
<div class="accordion-item">
|
||||
<a href="/admin/equipment/part/cpu"><?= ICONS['SERVICE_ITEM_CPU'] ?>CPU정보</a>
|
||||
</div>
|
||||
<div class="accordion-item">
|
||||
<a href="/admin/equipment/part/ram"><?= ICONS['SERVICE_ITEM_RAM'] ?>메모리정보</a>
|
||||
</div>
|
||||
<div class="accordion-item">
|
||||
<a href="/admin/equipment/part/storage"><?= ICONS['SERVICE_ITEM_STORAGE'] ?>저장장치정보</a>
|
||||
<a href="/admin/equipment/part"><?= ICONS['SERVICE_ITEM_SOFTWARE'] ?>부품정보</a>
|
||||
</div>
|
||||
</div>
|
||||
84
spark
Normal file
84
spark
Normal file
@ -0,0 +1,84 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of CodeIgniter 4 framework.
|
||||
*
|
||||
* (c) CodeIgniter Foundation <admin@codeigniter.com>
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/*
|
||||
* --------------------------------------------------------------------
|
||||
* CODEIGNITER COMMAND-LINE TOOLS
|
||||
* --------------------------------------------------------------------
|
||||
* The main entry point into the CLI system and allows you to run
|
||||
* commands and perform maintenance on your application.
|
||||
*/
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------
|
||||
* CHECK SERVER API
|
||||
*---------------------------------------------------------------
|
||||
*/
|
||||
|
||||
// Refuse to run when called from php-cgi
|
||||
if (str_starts_with(PHP_SAPI, 'cgi')) {
|
||||
exit("The cli tool is not supported when running php-cgi. It needs php-cli to function!\n\n");
|
||||
}
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------
|
||||
* CHECK PHP VERSION
|
||||
*---------------------------------------------------------------
|
||||
*/
|
||||
|
||||
$minPhpVersion = '8.1'; // If you update this, don't forget to update `public/index.php`.
|
||||
if (version_compare(PHP_VERSION, $minPhpVersion, '<')) {
|
||||
$message = sprintf(
|
||||
'Your PHP version must be %s or higher to run CodeIgniter. Current version: %s',
|
||||
$minPhpVersion,
|
||||
PHP_VERSION
|
||||
);
|
||||
|
||||
exit($message);
|
||||
}
|
||||
|
||||
// We want errors to be shown when using it from the CLI.
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', '1');
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------
|
||||
* SET THE CURRENT DIRECTORY
|
||||
*---------------------------------------------------------------
|
||||
*/
|
||||
|
||||
// Path to the front controller
|
||||
define('FCPATH', __DIR__ . DIRECTORY_SEPARATOR . 'public' . DIRECTORY_SEPARATOR);
|
||||
|
||||
// Ensure the current directory is pointing to the front controller's directory
|
||||
chdir(FCPATH);
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------
|
||||
* BOOTSTRAP THE APPLICATION
|
||||
*---------------------------------------------------------------
|
||||
* This process sets up the path constants, loads and registers
|
||||
* our autoloader, along with Composer's, loads our constants
|
||||
* and fires up an environment-specific bootstrapping.
|
||||
*/
|
||||
|
||||
// LOAD OUR PATHS CONFIG FILE
|
||||
// This is the line that might need to be changed, depending on your folder structure.
|
||||
require FCPATH . '../app/Config/Paths.php';
|
||||
// ^^^ Change this line if you move your application folder
|
||||
|
||||
$paths = new Config\Paths();
|
||||
|
||||
// LOAD THE FRAMEWORK BOOTSTRAP FILE
|
||||
require $paths->systemDirectory . '/Boot.php';
|
||||
|
||||
exit(CodeIgniter\Boot::bootSpark($paths));
|
||||
Loading…
Reference in New Issue
Block a user