dbmsv2 init...1

This commit is contained in:
choi.jh 2025-09-22 18:53:51 +09:00
parent a416801940
commit 97e7bcdb0c
11 changed files with 147 additions and 29 deletions

View File

@ -8,8 +8,6 @@ use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use CodeIgniter\Validation\Validation;
use Psr\Log\LoggerInterface;
use App\Helpers\UserHelper;
use App\Services\UserService;
class UserController extends AdminController

View File

@ -2,17 +2,20 @@
namespace App\Services;
use App\Models\CommonModel;
use App\Helpers\CommonHelper;
use App\Models\CommonModel;
use App\Services\Customer\ClientService;
use App\Services\UserService;
abstract class CommonService
{
private $_myAuth = null;
private $_model = null;
private $_helper = null;
private $_classNames = [];
private $_control = [];
private $_userService = null;
private $_clientService = null;
protected function __construct(CommonModel $model, CommonHelper $helper)
{
$this->_model = $model;
@ -201,6 +204,22 @@ abstract class CommonService
throw new \Exception($message);
}
} //
public function getUserService(): UserService
{
if (!$this->_userService) {
$this->_userService = new UserService();
}
return $this->_userService;
}
public function getClientService(): ClientService
{
if (!$this->_clientService) {
$this->_clientService = new ClientService();
}
return $this->_clientService;
}
//기본 기능부분
//FieldForm관련용
final public function getFormDatas(): array
{
return $this->getControlDatas('form_datas');
@ -212,8 +231,6 @@ abstract class CommonService
}
$this->setControlDatas('form_datas', $formDatas);
}
//기본 기능부분
//FieldForm관련용
public function getViewFields(): array
{
return $this->getFormFields();
@ -244,12 +261,18 @@ abstract class CommonService
public function getFormOption(string $field, array $options = []): array
{
switch ($field) {
case 'user_uid':
$options = $this->getUserService()->getEntities();
break;
case 'clientinfo_uid':
$options = $this->getClientService()->getEntities();
break;
default:
$options = lang($this->getClassName() . '.' . strtoupper($field));
break;
}
if (!is_array($options)) {
throw new \Exception(__FUNCTION__ . "에서 {$field}의 options 값이 array가 아닙니다.\n" . var_export($options, true));
throw new \Exception(__FUNCTION__ . "에서 {$field}의 options 값이 array가 아닙니다.\n" . var_export($options, true));
}
return $options;
}
@ -259,6 +282,9 @@ abstract class CommonService
throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true));
}
switch ($field) {
case 'user_uid':
$options = $this->getUserService()->getEntities();
break;
default:
$rule = $this->getModel()->getFormRule($action, $field);
break;

View File

@ -1,6 +1,6 @@
<?php
namespace App\Services\Customer\Service\Server;
namespace App\Services\Customer\Service;
use App\Entities\Customer\ServiceEntity;
use App\Entities\PaymentEntity;

View File

@ -1,6 +1,6 @@
<?php
namespace App\Services\Customer\Service\Server;
namespace App\Services\Customer\Service;
use App\Entities\Customer\ServiceEntity;
use App\Entities\Equipment\ServerEntity;

View File

@ -7,8 +7,8 @@ use App\Entities\Equipment\ServerEntity;
use App\Entities\PaymentEntity;
use App\Helpers\Customer\ServiceHelper;
use App\Models\Customer\ServiceModel;
use App\Services\Customer\Service\Server\ServerService;
use App\Services\Customer\Service\Server\PaymentService;
use App\Services\Customer\Service\ServerService;
use App\Services\Customer\Service\PaymentService;
class ServiceService extends CustomerService
{
@ -132,6 +132,9 @@ class ServiceService extends CustomerService
public function getFormOption(string $field, array $options = []): array
{
switch ($field) {
case 'serverinfo_uid':
$options = $this->getServerService()->getEntities();
break;
case 'CPU':
case 'RAM':
case 'DISK':

View File

@ -4,9 +4,14 @@ namespace App\Services\Equipment;
use App\Helpers\Equipment\CSHelper;
use App\Models\Equipment\CSModel;
use App\Services\Customer\ClientService;
use App\Services\Customer\ServiceService;
class CSService extends EquipmentService
{
private ?ClientService $_clientService = null;
private ?ServiceService $_serviceService = null;
private ?ServerService $_serverService = null;
public function __construct()
{
parent::__construct(new CSModel(), new CSHelper());
@ -50,7 +55,44 @@ class CSService extends EquipmentService
{
return ['type', 'status'];
}
final public function getClientService(): ClientService
{
if (!$this->_clientService) {
$this->_clientService = new ClientService();
}
return $this->_clientService;
}
public function getServiceService(): ServiceService
{
if (!$this->_serviceService) {
$this->_serviceService = new ServiceService();
}
return $this->_serviceService;
}
public function getServerService(): ServerService
{
if (!$this->_serverService) {
$this->_serverService = new ServerService();
}
return $this->_serverService;
}
//기본 기능부분
//FieldForm관련용
public function getFormOption(string $field, $options = []): array
{
switch ($field) {
case 'serviceinfo_uid':
$options = $this->getServiceService()->getEntities();
break;
case 'serverinfo_uid':
$options = $this->getServerService()->getEntities();
break;
default:
$options = parent::getFormOption($field, $options);
break;
}
return $options;
}
//List 검색용
//OrderBy 처리
public function setOrderBy(mixed $field = null, mixed $value = null): void

View File

@ -5,6 +5,7 @@ namespace App\Services\Equipment;
use App\Helpers\Equipment\IPHelper;
use App\Models\Equipment\IPModel;
use App\Services\Customer\ClientService;
use App\Services\Customer\ServiceService;
use App\Services\Equipment\EquipmentService;
use App\Services\Equipment\LineService;
@ -12,6 +13,8 @@ class IPService extends EquipmentService
{
private ?LineService $_lineService = null;
private ?ClientService $_clientService = null;
private ?ServiceService $_serviceService = null;
private ?ServerService $_serverService = null;
public function __construct()
{
parent::__construct(new IPModel(), new IPHelper());
@ -67,6 +70,20 @@ class IPService extends EquipmentService
}
return $this->_clientService;
}
public function getServiceService(): ServiceService
{
if (!$this->_serviceService) {
$this->_serviceService = new ServiceService();
}
return $this->_serviceService;
}
public function getServerService(): ServerService
{
if (!$this->_serverService) {
$this->_serverService = new ServerService();
}
return $this->_serverService;
}
//기본기능
//FieldForm관련용
public function getFormOption(string $field, $options = []): array
@ -78,6 +95,12 @@ class IPService extends EquipmentService
case 'old_clientinfo_uid':
$options = $this->getClientService()->getEntities();
break;
case 'serviceinfo_uid':
$options = $this->getServiceService()->getEntities();
break;
case 'serverinfo_uid':
$options = $this->getServerService()->getEntities();
break;
default:
$options = parent::getFormOption($field, $options);
break;

View File

@ -127,6 +127,18 @@ class ServerService extends EquipmentService
}
//기본 기능부분
//FieldForm관련용
public function getFormOption(string $field, $options = []): array
{
switch ($field) {
case 'serviceinfo_uid':
$options = $this->getServiceService()->getEntities();
break;
default:
$options = parent::getFormOption($field, $options);
break;
}
return $options;
}
public function setFormData(string $field, array $requestDatas, array $formDatas): array
{
switch ($field) {

View File

@ -4,10 +4,13 @@ namespace App\Services\Equipment;
use App\Helpers\Equipment\SwitchHelper;
use App\Models\Equipment\SwitchModel;
use App\Services\Customer\ServiceService;
use App\Services\Equipment\EquipmentService;
class SwitchService extends EquipmentService
{
private ?ServiceService $_serviceService = null;
private ?ServerService $_serverService = null;
public function __construct()
{
parent::__construct(new SwitchModel(), new SwitchHelper());
@ -45,7 +48,36 @@ class SwitchService extends EquipmentService
{
return ['clientinfo_uid', 'serverinfo_uid', 'status'];
}
public function getServiceService(): ServiceService
{
if (!$this->_serviceService) {
$this->_serviceService = new ServiceService();
}
return $this->_serviceService;
}
public function getServerService(): ServerService
{
if (!$this->_serverService) {
$this->_serverService = new ServerService();
}
return $this->_serverService;
}
//기본 기능부분
public function getFormOption(string $field, array $options = []): array
{
switch ($field) {
case 'serviceinfo_uid':
$options = $this->getServiceService()->getEntities();
break;
case 'serverinfo_uid':
$options = $this->getServerService()->getEntities();
break;
default:
$options = parent::getFormOption($field, $options);
break;
}
return $options;
}
//FieldForm관련용
//List 검색용
//OrderBy 처리

View File

@ -46,18 +46,6 @@ class MyLogService extends CommonService
}
//기본 기능부분
//FieldForm관련용
public function getFormOption(string $field, array $options = []): array
{
switch ($field) {
case 'user_uid':
$options = $this->getUserService()->getEntities();
break;
default:
$options = parent::getFormOption($field, $options);
break;
}
return $options;
}
public function save(string $class, string $method, string $title, int $user_uid): MyLogEntity
{
$formDatas = [

View File

@ -122,12 +122,6 @@ class PaymentService extends CommonService
final public function getFormOption(string $field, array $options = []): array
{
switch ($field) {
case 'user_uid':
$options = $this->getUserService()->getEntities();
break;
case 'clientinfo_uid':
$options = $this->getClientService()->getEntities();
break;
case 'serviceinfo_uid':
$options = $this->getServiceService()->getEntities();
break;