dbmsv2 init...1
This commit is contained in:
parent
383e3e4ac9
commit
757df14d47
@ -367,7 +367,7 @@ define('SERVICE_NEW_INTERVAL', $_ENV['SERVICE_NEW_INTERVAL'] ?? $_SERVER['SERVIC
|
|||||||
|
|
||||||
//서버 PartType
|
//서버 PartType
|
||||||
define("SERVER", [
|
define("SERVER", [
|
||||||
"PARTTYPES" => ['CPU', 'RAM', 'DISK', 'OS', 'SOFTWARE'],
|
"PARTTYPES" => ['CPU', 'RAM', 'DISK'],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
//결제관련
|
//결제관련
|
||||||
|
|||||||
@ -353,7 +353,7 @@ abstract class CommonController extends BaseController
|
|||||||
if (!$entity) {
|
if (!$entity) {
|
||||||
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
|
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
|
||||||
}
|
}
|
||||||
$this->entity = $this->modify_form_process($uid);
|
$this->entity = $this->modify_form_process($entity);
|
||||||
helper(['form']);
|
helper(['form']);
|
||||||
$this->forms = ['attributes' => ['method' => "post",], 'hiddens' => []];
|
$this->forms = ['attributes' => ['method' => "post",], 'hiddens' => []];
|
||||||
return $this->getResultSuccess();
|
return $this->getResultSuccess();
|
||||||
@ -426,7 +426,7 @@ abstract class CommonController extends BaseController
|
|||||||
{
|
{
|
||||||
return $this->getService()->modify($entity, $formDatas);
|
return $this->getService()->modify($entity, $formDatas);
|
||||||
}
|
}
|
||||||
protected function batchjob_pre_process(): array
|
private function batchjob_pre_process(): array
|
||||||
{
|
{
|
||||||
$selectedFields = [];
|
$selectedFields = [];
|
||||||
//getBatchJobFields를 이용해서 선택된 Field 와 값정의
|
//getBatchJobFields를 이용해서 선택된 Field 와 값정의
|
||||||
@ -509,7 +509,7 @@ abstract class CommonController extends BaseController
|
|||||||
{
|
{
|
||||||
return $this->getService()->delete($entity);
|
return $this->getService()->delete($entity);
|
||||||
}
|
}
|
||||||
protected function batchjob_delete_pre_process(): array
|
private function batchjob_delete_pre_process(): array
|
||||||
{
|
{
|
||||||
//변경할 UIDS
|
//변경할 UIDS
|
||||||
$uids = $this->request->getPost('batchjob_uids[]');
|
$uids = $this->request->getPost('batchjob_uids[]');
|
||||||
@ -576,17 +576,30 @@ abstract class CommonController extends BaseController
|
|||||||
//조건절 처리
|
//조건절 처리
|
||||||
protected function index_condition_process(): void
|
protected function index_condition_process(): void
|
||||||
{
|
{
|
||||||
|
//Filter조건절 처리
|
||||||
|
$index_filters = [];
|
||||||
|
foreach ($this->getControlDatas('actionFilters') as $field) {
|
||||||
|
$value = $this->request->getGet($field);
|
||||||
|
if ($value) {
|
||||||
|
$this->getService()->index_condition_filterField($field, $value);
|
||||||
|
$index_filters[$field] = $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->setControlDatas('index_filters', $index_filters);
|
||||||
//검색어조건절 처리
|
//검색어조건절 처리
|
||||||
$this->word = $this->request->getVar('word');
|
$index_word = $this->request->getVar('index_word');
|
||||||
if ($this->word !== null && $this->word !== '') {
|
if ($index_word !== null && $index_word !== '') {
|
||||||
$this->getService()->index_condition_filterWord($this->word);
|
$this->getService()->index_condition_filterWord($index_word);
|
||||||
}
|
}
|
||||||
|
$this->setControlDatas('index_word', $index_word);
|
||||||
//날자검색
|
//날자검색
|
||||||
$this->start = $this->request->getVar('start');
|
$index_start = $this->request->getVar('index_start');
|
||||||
$this->end = $this->request->getVar('end');
|
$index_end = $this->request->getVar('index_end');
|
||||||
if ($this->start !== null && $this->start !== '' && $this->end !== null && $this->end !== '') {
|
if ($index_start !== null && $index_start !== '' && $index_end !== null && $index_end !== '') {
|
||||||
$this->getService()->index_condition_filterDate($this->start, $this->end);
|
$this->getService()->index_condition_filterDate($index_start, $index_end);
|
||||||
}
|
}
|
||||||
|
$this->setControlDatas('index_start', $index_start);
|
||||||
|
$this->setControlDatas('index_end', $index_end);
|
||||||
}
|
}
|
||||||
//PageNation 처리
|
//PageNation 처리
|
||||||
protected function index_pagenation_process($pager_group = 'default', int $segment = 0, $template = 'bootstrap_full')
|
protected function index_pagenation_process($pager_group = 'default', int $segment = 0, $template = 'bootstrap_full')
|
||||||
|
|||||||
@ -11,4 +11,21 @@ class SwitchHelper extends EquipmentHelper
|
|||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->setTitleField(field: SwitchModel::TITLE);
|
$this->setTitleField(field: SwitchModel::TITLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getListButton(string $action, string $label, array $viewDatas, array $extras = []): string
|
||||||
|
{
|
||||||
|
switch ($action) {
|
||||||
|
case 'modify':
|
||||||
|
if (!$this->getMyAuth()->isAccessRole(['security'])) {
|
||||||
|
$action = $viewDatas['entity']->getCode();
|
||||||
|
} else {
|
||||||
|
$action = parent::getListButton($action, $viewDatas['entity']->getCode(), $viewDatas, $extras);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$action = parent::getListButton($action, $label, $viewDatas, $extras);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return $action;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,25 +10,12 @@ abstract class CommonService
|
|||||||
{
|
{
|
||||||
private $_model = null;
|
private $_model = null;
|
||||||
private $_classNames = [];
|
private $_classNames = [];
|
||||||
private $_serviceDatas = [];
|
|
||||||
protected function __construct(Model $model)
|
protected function __construct(Model $model)
|
||||||
{
|
{
|
||||||
$this->_model = $model;
|
$this->_model = $model;
|
||||||
}
|
}
|
||||||
abstract public function getFormFields(): array;
|
abstract public function getFormFields(): array;
|
||||||
abstract public function getFormFilters(): array;
|
abstract public function getFormFilters(): array;
|
||||||
//기본 기능부분
|
|
||||||
final public function __get($name)
|
|
||||||
{
|
|
||||||
if (!array_key_exists($name, $this->_serviceDatas)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return $this->_serviceDatas[$name];
|
|
||||||
}
|
|
||||||
final public function __set($name, $value): void
|
|
||||||
{
|
|
||||||
$this->_serviceDatas[$name] = $value;
|
|
||||||
}
|
|
||||||
final protected function addClassName(string $className): void
|
final protected function addClassName(string $className): void
|
||||||
{
|
{
|
||||||
$this->_classNames[] = $className;
|
$this->_classNames[] = $className;
|
||||||
@ -65,7 +52,12 @@ abstract class CommonService
|
|||||||
final public function getEntities(mixed $where = null, array $columns = ['*']): array
|
final public function getEntities(mixed $where = null, array $columns = ['*']): array
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
return $this->getEntities_process($where, $columns);
|
$entities = $this->getEntities_process($where, $columns);
|
||||||
|
$debug = sprintf("debug.%s.%s", str_replace("\\", ".", get_class($this)), __FUNCTION__);
|
||||||
|
if (env($debug, false)) {
|
||||||
|
echo $this->getModel()->getLastQuery() . "<BR>";
|
||||||
|
}
|
||||||
|
return $entities;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$message = sprintf(
|
$message = sprintf(
|
||||||
"\n------%s SQL오류-----<BR>\n%s<BR>\n%s<BR>\n------------------------------\n",
|
"\n------%s SQL오류-----<BR>\n%s<BR>\n%s<BR>\n------------------------------\n",
|
||||||
@ -76,62 +68,6 @@ abstract class CommonService
|
|||||||
throw new \Exception($message);
|
throw new \Exception($message);
|
||||||
}
|
}
|
||||||
} //
|
} //
|
||||||
//삭제
|
|
||||||
final public function delete(mixed $entity): mixed
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
$message = "[{$entity->getTitle()}]" . MESSAGES["DELETED"] . ":";
|
|
||||||
$result = $this->getModel()->delete($entity->getPK());
|
|
||||||
if (!$result) {
|
|
||||||
throw new \Exception($message);
|
|
||||||
}
|
|
||||||
LogCollector::info($message);
|
|
||||||
return $entity;
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
$message = sprintf(
|
|
||||||
"\n------%s SQL오류-----<BR>\n%s<BR>\n%s<BR>\n------------------------------\n",
|
|
||||||
__FUNCTION__,
|
|
||||||
$this->getModel()->getLastQuery(),
|
|
||||||
$e->getMessage()
|
|
||||||
);
|
|
||||||
throw new \Exception($message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//Index용
|
|
||||||
final public function getTotalCount(): int
|
|
||||||
{
|
|
||||||
return $this->getModel()->countAllResults(false);
|
|
||||||
}
|
|
||||||
//Limit처리
|
|
||||||
final public function setLimit(int $per_page): void
|
|
||||||
{
|
|
||||||
$this->getModel()->limit($per_page);
|
|
||||||
}
|
|
||||||
//Offset처리
|
|
||||||
final public function setOffset(int $offset): void
|
|
||||||
{
|
|
||||||
$this->getModel()->offset($offset);
|
|
||||||
}
|
|
||||||
final public function isIPAddress(string $ip, $type = false): bool
|
|
||||||
{
|
|
||||||
switch ($type) {
|
|
||||||
case 'ipv4':
|
|
||||||
$result = filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4);
|
|
||||||
break;
|
|
||||||
case 'ipv6':
|
|
||||||
$result = filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6);
|
|
||||||
break;
|
|
||||||
case 'all':
|
|
||||||
$result = filter_var($ip, FILTER_VALIDATE_IP);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
$result = filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
//기본기능
|
|
||||||
//개별기능
|
|
||||||
//Entity별로 작업처리시
|
//Entity별로 작업처리시
|
||||||
protected function getEntity_process(mixed $entity): mixed
|
protected function getEntity_process(mixed $entity): mixed
|
||||||
{
|
{
|
||||||
@ -228,7 +164,43 @@ abstract class CommonService
|
|||||||
LogCollector::info("[{$entity->getTitle()}]" . MESSAGES["UPDATED"] . ":");
|
LogCollector::info("[{$entity->getTitle()}]" . MESSAGES["UPDATED"] . ":");
|
||||||
return $entity;
|
return $entity;
|
||||||
}
|
}
|
||||||
|
//삭제
|
||||||
|
public function delete(mixed $entity): mixed
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$message = "[{$entity->getTitle()}]" . MESSAGES["DELETED"] . ":";
|
||||||
|
$result = $this->getModel()->delete($entity->getPK());
|
||||||
|
if (!$result) {
|
||||||
|
throw new \Exception($message);
|
||||||
|
}
|
||||||
|
LogCollector::info($message);
|
||||||
|
return $entity;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$message = sprintf(
|
||||||
|
"\n------%s SQL오류-----<BR>\n%s<BR>\n%s<BR>\n------------------------------\n",
|
||||||
|
__FUNCTION__,
|
||||||
|
$this->getModel()->getLastQuery(),
|
||||||
|
$e->getMessage()
|
||||||
|
);
|
||||||
|
throw new \Exception($message);
|
||||||
|
}
|
||||||
|
}
|
||||||
////Index 검색용
|
////Index 검색용
|
||||||
|
//Index용
|
||||||
|
final public function getTotalCount(): int
|
||||||
|
{
|
||||||
|
return $this->getModel()->countAllResults(false);
|
||||||
|
}
|
||||||
|
//Limit처리
|
||||||
|
final public function setLimit(int $per_page): void
|
||||||
|
{
|
||||||
|
$this->getModel()->limit($per_page);
|
||||||
|
}
|
||||||
|
//Offset처리
|
||||||
|
final public function setOffset(int $offset): void
|
||||||
|
{
|
||||||
|
$this->getModel()->offset($offset);
|
||||||
|
}
|
||||||
//FormFilter 조건절 처리
|
//FormFilter 조건절 처리
|
||||||
public function index_condition_filterField(string $field, mixed $filter_value): void
|
public function index_condition_filterField(string $field, mixed $filter_value): void
|
||||||
{
|
{
|
||||||
|
|||||||
@ -14,7 +14,9 @@ abstract class CustomerService extends CommonService
|
|||||||
{
|
{
|
||||||
private ?UserService $_userService = null;
|
private ?UserService $_userService = null;
|
||||||
private ?ClientService $_clientService = null;
|
private ?ClientService $_clientService = null;
|
||||||
|
private ?ServiceService $_serviceService = null;
|
||||||
private ?ServerService $_serverService = null;
|
private ?ServerService $_serverService = null;
|
||||||
|
|
||||||
private $_equipmentService = [];
|
private $_equipmentService = [];
|
||||||
protected function __construct(Model $model)
|
protected function __construct(Model $model)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -3,11 +3,12 @@
|
|||||||
namespace App\Services\Customer;
|
namespace App\Services\Customer;
|
||||||
|
|
||||||
use App\Entities\Customer\ServiceEntity;
|
use App\Entities\Customer\ServiceEntity;
|
||||||
use App\Entities\Equipment\ServerEntity;
|
|
||||||
use App\Models\Customer\ServiceModel;
|
use App\Models\Customer\ServiceModel;
|
||||||
|
use App\Traits\IPTrait;
|
||||||
|
|
||||||
class ServiceService extends CustomerService
|
class ServiceService extends CustomerService
|
||||||
{
|
{
|
||||||
|
use IPTrait;
|
||||||
private ?string $_searchIP = null;
|
private ?string $_searchIP = null;
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
@ -141,7 +142,7 @@ class ServiceService extends CustomerService
|
|||||||
//검색어조건절처리
|
//검색어조건절처리
|
||||||
public function index_condition_filterWord(string $word): void
|
public function index_condition_filterWord(string $word): void
|
||||||
{
|
{
|
||||||
if ($this->isIPAddress($word, 'ipv4')) {
|
if ($this->isIPAddressTrait($word, 'ipv4')) {
|
||||||
$this->setSearchIp($word);
|
$this->setSearchIp($word);
|
||||||
} else {
|
} else {
|
||||||
parent::index_condition_filterWord($word);
|
parent::index_condition_filterWord($word);
|
||||||
|
|||||||
@ -15,6 +15,7 @@ abstract class EquipmentService extends CommonService
|
|||||||
{
|
{
|
||||||
private ?UserService $_userService = null;
|
private ?UserService $_userService = null;
|
||||||
private ?ClientService $_clientService = null;
|
private ?ClientService $_clientService = null;
|
||||||
|
private ?ServiceService $_serviceService = null;
|
||||||
private ?ServerService $_serverService = null;
|
private ?ServerService $_serverService = null;
|
||||||
private $_equipmentService = [];
|
private $_equipmentService = [];
|
||||||
protected function __construct(Model $model)
|
protected function __construct(Model $model)
|
||||||
|
|||||||
@ -90,49 +90,43 @@ class ServerPartService extends EquipmentService
|
|||||||
}
|
}
|
||||||
return $options;
|
return $options;
|
||||||
}
|
}
|
||||||
|
//생성
|
||||||
//서버별 부품연결정보 생성
|
public function createByServer(ServerEntity $serverEntity, array $formDatas): ServerPartEntity
|
||||||
private function createByServer_process(ServerEntity $serverEntity, string $partType, array $formDatas): ServerPartEntity
|
|
||||||
{
|
{
|
||||||
$serverPartFormDatas = [
|
foreach (SERVER['PARTTYPES'] as $partType) {
|
||||||
"partinfo_uid" => $formDatas["partinfo_uid_{$partType}"],
|
$serverPartFormDatas = [];
|
||||||
"serverinfo_uid" => $serverEntity->getPK(),
|
$serverPartFormDatas["partinfo_uid"] = $formDatas["partinfo_uid_{$partType}"];
|
||||||
"serviceinfo_uid" => $serverEntity->getServiceInfoUID(),
|
$serverPartFormDatas["serverinfo_uid"] = $serverEntity->getPK();
|
||||||
"type" => $partType,
|
$serverPartFormDatas["serviceinfo_uid"] = $serverEntity->getServiceInfoUID();
|
||||||
"billing" => array_key_exists("serverinfopartinfo_uid_{$partType}_billing", $formDatas) ? $formDatas["serverinfopartinfo_uid_{$partType}_billing"] : null,
|
$serverPartFormDatas["type"] = $partType;
|
||||||
"amount" => array_key_exists("serverinfopartinfo_uid_{$partType}_amount", $formDatas) ? $formDatas["serverinfopartinfo_uid_{$partType}_amount"] : 0,
|
$serverPartFormDatas["billing"] = array_key_exists("serverinfopartinfo_uid_{$partType}_billing", $formDatas) ? $formDatas["serverinfopartinfo_uid_{$partType}_billing"] : null;
|
||||||
"cnt" => array_key_exists("serverinfopartinfo_uid_{$partType}_cnt", $formDatas) ? $formDatas["serverinfopartinfo_uid_{$partType}_cnt"] : null,
|
$serverPartFormDatas["amount"] = array_key_exists("serverinfopartinfo_uid_{$partType}_amount", $formDatas) ? $formDatas["serverinfopartinfo_uid_{$partType}_amount"] : 0;
|
||||||
"extra" => array_key_exists("serverinfopartinfo_uid_{$partType}_extra", $formDatas) ? $formDatas["serverinfopartinfo_uid_{$partType}_extra"] : null
|
$serverPartFormDatas["cnt"] = array_key_exists("serverinfopartinfo_uid_{$partType}_cnt", $formDatas) ? $formDatas["serverinfopartinfo_uid_{$partType}_cnt"] : null;
|
||||||
];
|
$serverPartFormDatas["extra"] = array_key_exists("serverinfopartinfo_uid_{$partType}_extra", $formDatas) ? $formDatas["serverinfopartinfo_uid_{$partType}_extra"] : null;
|
||||||
$entity = parent::create($serverPartFormDatas);
|
$entity = parent::create($serverPartFormDatas);
|
||||||
//부품정보 정의
|
//부품정보 정의
|
||||||
$partEntity = $this->getPartService()->getEntity($entity->getPartInfoUID());
|
$partEntity = $this->getPartService()->getEntity($entity->getPartInfoUID());
|
||||||
if ($partEntity) {
|
if ($partEntity) {
|
||||||
$entity->setPartEntity($partEntity);
|
$entity->setPartEntity($partEntity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return $entity;
|
return $entity;
|
||||||
}
|
}
|
||||||
//생성
|
|
||||||
public function createByServer(ServerEntity $serverEntity, array $formDatas): array
|
|
||||||
{
|
|
||||||
$entities = [];
|
|
||||||
foreach (SERVER['PARTTYPES'] as $partType) {
|
|
||||||
//파트정보 선택했는지 여부에따라 처리
|
|
||||||
if (array_key_exists("partinfo_uid_{$partType}", $formDatas) && $formDatas["partinfo_uid_{$partType}"]) {
|
|
||||||
$entities[] = $this->createByServer_process($serverEntity, $partType, $formDatas);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $entities;
|
|
||||||
}
|
|
||||||
//수정
|
//수정
|
||||||
public function modifyByServer(ServerEntity $serverEntity, array $formDatas): array
|
public function modifyByServer(ServerEntity $serverEntity, array $formDatas): ServerPartEntity
|
||||||
|
{
|
||||||
|
//삭제후생성
|
||||||
|
$this->deleteByServer($serverEntity);
|
||||||
|
return $this->createByServer($serverEntity, $formDatas);
|
||||||
|
}
|
||||||
|
//삭제
|
||||||
|
public function deleteByServer(ServerEntity $serverEntity): array
|
||||||
{
|
{
|
||||||
//기존 서벼별 부품연결정보 삭제 후
|
//기존 서벼별 부품연결정보 삭제 후
|
||||||
$entities = $this->getEntities(['serverinfo_uid' => $serverEntity->getPK()]);
|
$entities = $this->getEntities(['serverinfo_uid' => $serverEntity->getPK()]);
|
||||||
foreach ($entities as $entity) {
|
foreach ($entities as $entity) {
|
||||||
$this->delete($entity);
|
$this->delete($entity);
|
||||||
}
|
}
|
||||||
//서버별 부품연결정보 생성
|
return $entities;
|
||||||
return $this->createByServer($serverEntity, $formDatas);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,12 +4,13 @@ namespace App\Services\Equipment;
|
|||||||
|
|
||||||
use App\Entities\Equipment\ServerEntity;
|
use App\Entities\Equipment\ServerEntity;
|
||||||
use App\Models\Equipment\ServerModel;
|
use App\Models\Equipment\ServerModel;
|
||||||
use App\Models\Equipment\ServerPartModel;
|
|
||||||
use App\Services\Equipment\EquipmentService;
|
use App\Services\Equipment\EquipmentService;
|
||||||
|
|
||||||
class ServerService extends EquipmentService
|
class ServerService extends EquipmentService
|
||||||
{
|
{
|
||||||
private ?ServerPartService $_serverPartService = null;
|
private ?ServerPartService $_serverPartService = null;
|
||||||
|
private ?IPService $_ipService = null;
|
||||||
|
private ?CSService $_csService = null;
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct(new ServerModel());
|
parent::__construct(new ServerModel());
|
||||||
@ -189,11 +190,14 @@ class ServerService extends EquipmentService
|
|||||||
{
|
{
|
||||||
$entity = parent::create($formDatas);
|
$entity = parent::create($formDatas);
|
||||||
//ServerPart정보 생성
|
//ServerPart정보 생성
|
||||||
foreach ($this->getServerPartService()->createByServer($entity, $formDatas) as $serverPartEntity) {
|
foreach (SERVER['PARTTYPES'] as $partType) {
|
||||||
$entity->addServerPartEntity($serverPartEntity->getType(), $serverPartEntity);
|
foreach ($this->getServerPartService()->createByServer($entity, $formDatas) as $serverPartEntity) {
|
||||||
};
|
$entity->addServerPartEntity($serverPartEntity->getType(), $serverPartEntity);
|
||||||
|
};
|
||||||
|
}
|
||||||
return $entity;
|
return $entity;
|
||||||
}
|
}
|
||||||
|
//수정
|
||||||
public function modify(mixed $entity, array $formDatas): ServerEntity
|
public function modify(mixed $entity, array $formDatas): ServerEntity
|
||||||
{
|
{
|
||||||
$entity = parent::modify($entity, $formDatas);
|
$entity = parent::modify($entity, $formDatas);
|
||||||
@ -203,7 +207,16 @@ class ServerService extends EquipmentService
|
|||||||
};
|
};
|
||||||
return $entity;
|
return $entity;
|
||||||
}
|
}
|
||||||
|
//삭제
|
||||||
|
public function delete(mixed $entity): ServerEntity
|
||||||
|
{
|
||||||
|
$entity = parent::delete($entity);
|
||||||
|
// ServerPart정보 수정
|
||||||
|
foreach ($this->getServerPartService()->deleteByServer($entity) as $serverPartEntity) {
|
||||||
|
$entity->addServerPartEntity($serverPartEntity->getType(), $serverPartEntity);
|
||||||
|
};
|
||||||
|
return $entity;
|
||||||
|
}
|
||||||
//List 검색용
|
//List 검색용
|
||||||
//OrderBy 처리
|
//OrderBy 처리
|
||||||
public function setOrderBy(mixed $field = null, mixed $value = null): void
|
public function setOrderBy(mixed $field = null, mixed $value = null): void
|
||||||
|
|||||||
@ -31,22 +31,12 @@ class SwitchService extends EquipmentService
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
public function getIndexFields(): array
|
public function getIndexFields(): array
|
||||||
{
|
|
||||||
return [
|
|
||||||
'code',
|
|
||||||
'status',
|
|
||||||
'clientinfo_uid',
|
|
||||||
'serviceinfo_uid',
|
|
||||||
'serverinfo_uid'
|
|
||||||
];
|
|
||||||
}
|
|
||||||
public function getIndexFilters(): array
|
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'clientinfo_uid',
|
'clientinfo_uid',
|
||||||
'serviceinfo_uid',
|
'serviceinfo_uid',
|
||||||
'serverinfo_uid',
|
'serverinfo_uid',
|
||||||
'status'
|
'status',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
public function getBatchjobFields(): array
|
public function getBatchjobFields(): array
|
||||||
|
|||||||
@ -21,14 +21,14 @@ class UserService extends CommonService
|
|||||||
'name',
|
'name',
|
||||||
'email',
|
'email',
|
||||||
'mobile',
|
'mobile',
|
||||||
'role'
|
'role',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
public function getFormFilters(): array
|
public function getFormFilters(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'role',
|
'role',
|
||||||
'status'
|
'status',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
public function getIndexFields(): array
|
public function getIndexFields(): array
|
||||||
@ -38,7 +38,8 @@ class UserService extends CommonService
|
|||||||
'name',
|
'name',
|
||||||
'email',
|
'email',
|
||||||
'mobile',
|
'mobile',
|
||||||
'role'
|
'role',
|
||||||
|
'status',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
public function getBatchjobFields(): array
|
public function getBatchjobFields(): array
|
||||||
|
|||||||
25
app/Traits/IPTrait.php
Normal file
25
app/Traits/IPTrait.php
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Traits;
|
||||||
|
|
||||||
|
trait IPTrait
|
||||||
|
{
|
||||||
|
public function isIPAddressTrait(string $ip, $type = false): bool
|
||||||
|
{
|
||||||
|
switch ($type) {
|
||||||
|
case 'ipv4':
|
||||||
|
$result = filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4);
|
||||||
|
break;
|
||||||
|
case 'ipv6':
|
||||||
|
$result = filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6);
|
||||||
|
break;
|
||||||
|
case 'all':
|
||||||
|
$result = filter_var($ip, FILTER_VALIDATE_IP);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$result = filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -35,25 +35,9 @@
|
|||||||
<?php if ($partType === "DISK"): ?>
|
<?php if ($partType === "DISK"): ?>
|
||||||
<?= $viewDatas['helper']->getFieldForm("serverinfopartinfo_uid_{$partType}_extra", old("serverinfopartinfo_uid_{$partType}_extra") ?? ($viewDatas['control']['form_datas']["serverinfopartinfo_uid_{$partType}_extra"] ?? null), $viewDatas) ?>
|
<?= $viewDatas['helper']->getFieldForm("serverinfopartinfo_uid_{$partType}_extra", old("serverinfopartinfo_uid_{$partType}_extra") ?? ($viewDatas['control']['form_datas']["serverinfopartinfo_uid_{$partType}_extra"] ?? null), $viewDatas) ?>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
,금액 <?= $viewDatas['helper']->getFieldForm("serverinfopartinfo_uid_{$partType}_amount", old("serverinfopartinfo_uid_{$partType}_amount") ?? ($viewDatas['control']['form_datas']["serverinfopartinfo_uid_{$partType}_amount"] ?? null), $viewDatas) ?>
|
|
||||||
<span><?= validation_show_error("partinfo_uid_{$partType}"); ?></span>
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
<tr>
|
|
||||||
<th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel("ipinfo_uid", lang("{$viewDatas['class_path']}.label.ipinfo_uid"), $viewDatas) ?></th>
|
|
||||||
<td nowrap class="text-start">
|
|
||||||
<?= $viewDatas['helper']->getFieldForm("ipinfo_uid", old("ipinfo_uid") ?? ($viewDatas['control']['form_datas']["ipinfo_uid"] ?? null), $viewDatas) ?>
|
|
||||||
,금액 <?= $viewDatas['helper']->getFieldForm("ipinfo_uid_amount", old("ipinfo_uid_amount") ?? ($viewDatas['control']['form_datas']["ipinfo_uid_amount"] ?? null), $viewDatas) ?>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel("csinfo_uid", lang("{$viewDatas['class_path']}.label.csinfo_uid"), $viewDatas) ?></th>
|
|
||||||
<td nowrap class="text-start">
|
|
||||||
<?= $viewDatas['helper']->getFieldForm("csinfo_uid", old("csinfo_uid") ?? ($viewDatas['control']['form_datas']["csinfo_uid"] ?? null), $viewDatas) ?>
|
|
||||||
,금액 <?= $viewDatas['helper']->getFieldForm("csinfo_uid_amount", old("csinfo_uid_amount") ?? ($viewDatas['control']['form_datas']["csinfo_uid_amount"] ?? null), $viewDatas) ?>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
</table>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@ -35,29 +35,9 @@
|
|||||||
<?php if ($partType === "DISK"): ?>
|
<?php if ($partType === "DISK"): ?>
|
||||||
<?= $viewDatas['helper']->getFieldForm("serverinfopartinfo_uid_{$partType}_extra", old("serverinfopartinfo_uid_{$partType}_extra") ?? ($viewDatas['entity']->getServerPartEntity($partType) ? $viewDatas['entity']->getServerPartEntity($partType)->getExtra() : ($viewDatas['control']['form_datas']["serverinfopartinfo_uid_{$partType}_extra"] ?? null)), $viewDatas) ?>
|
<?= $viewDatas['helper']->getFieldForm("serverinfopartinfo_uid_{$partType}_extra", old("serverinfopartinfo_uid_{$partType}_extra") ?? ($viewDatas['entity']->getServerPartEntity($partType) ? $viewDatas['entity']->getServerPartEntity($partType)->getExtra() : ($viewDatas['control']['form_datas']["serverinfopartinfo_uid_{$partType}_extra"] ?? null)), $viewDatas) ?>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
,금액 <?= $viewDatas['helper']->getFieldForm("serverinfopartinfo_uid_{$partType}_amount", ($viewDatas['entity']->getServerPartEntity($partType) ? $viewDatas['entity']->getServerPartEntity($partType)->getAmount() : ($viewDatas['control']['form_datas']["serverinfopartinfo_uid_{$partType}_amount"] ?? null)), $viewDatas) ?>
|
|
||||||
<span><?= validation_show_error("partinfo_uid_{$partType}"); ?></span>
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
<tr>
|
|
||||||
<th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel("ipinfo_uid", lang("{$viewDatas['class_path']}.label.ipinfo_uid"), $viewDatas) ?></th>
|
|
||||||
<td nowrap class="text-start">
|
|
||||||
<?php foreach ($viewDatas['entity']->getIPEntities() as $entity): ?>
|
|
||||||
<?= $viewDatas['helper']->getFieldForm("ipinfo_uid", old("ipinfo_uid") ?? ($viewDatas['control']['form_datas']["ipinfo_uid"] ?? null), $viewDatas) ?>
|
|
||||||
,금액 <?= $viewDatas['helper']->getFieldForm("ipinfo_uid_amount", ($ipEntity ? $ipEntity->getAmount() : ($viewDatas['control']['form_datas']["ipinfo_amount"] ?? null)), $viewDatas) ?>
|
|
||||||
<?php endforeach ?>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel("csinfo_uid", lang("{$viewDatas['class_path']}.label.csinfo_uid"), $viewDatas) ?></th>
|
|
||||||
<td nowrap class="text-start">
|
|
||||||
<?php foreach ($viewDatas['entity']->getCSEntities() as $entity): ?>
|
|
||||||
<?= $viewDatas['helper']->getFieldForm("csinfo_uid", old("csinfo_uid") ?? ($viewDatas['control']['form_datas']["csinfo_uid"] ?? null), $viewDatas) ?>
|
|
||||||
,금액 <?= $viewDatas['helper']->getFieldForm("csinfo_uid_amount", ($entity ? $entity->getAmount() : ($viewDatas['control']['form_datas']["csinfo_amount"] ?? null)), $viewDatas) ?>
|
|
||||||
<?php endforeach ?>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
</table>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@ -4,12 +4,12 @@
|
|||||||
<nav class="condition nav">
|
<nav class="condition nav">
|
||||||
조건:
|
조건:
|
||||||
<?php foreach ($viewDatas['control']['actionFilters'] as $field): ?>
|
<?php foreach ($viewDatas['control']['actionFilters'] as $field): ?>
|
||||||
<?= $viewDatas['helper']->getListFilter($field, $viewDatas['control']['form_datas'][$field] ?? old($field), $viewDatas, ['id' => $field]) ?>
|
<?= $viewDatas['helper']->getListFilter($field, $viewDatas['control']['index_filters'][$field] ?? old($field), $viewDatas, ['id' => $field]) ?>
|
||||||
<?php endforeach ?>
|
<?php endforeach ?>
|
||||||
</nav>
|
</nav>
|
||||||
<nav class="search nav justify-content-center">
|
<nav class="search nav justify-content-center">
|
||||||
검색어:<?= form_input('word', $viewDatas['word'] ?? "") ?>
|
검색어:<?= form_input('index_word', $viewDatas['control']['index_word'] ?? "") ?>
|
||||||
검색일:<?= form_input('start', $viewDatas['start'] ?? "", ["class" => "calender"]) ?>~<?= form_input('end', $viewDatas['end'] ?? "", ["class" => "calender"]) ?>
|
검색일:<?= form_input('index_start', $viewDatas['index_start'] ?? "", ["class" => "calender"]) ?>~<?= form_input('index_end', $viewDatas['index_end'] ?? "", ["class" => "calender"]) ?>
|
||||||
<button class="btn btn-outline-primary" type="submit">검색</button>
|
<button class="btn btn-outline-primary" type="submit">검색</button>
|
||||||
<?= anchor(current_url() . '/download/excel', ICONS['EXCEL'], ["target" => "_self", "class" => "excel"]) ?>
|
<?= anchor(current_url() . '/download/excel', ICONS['EXCEL'], ["target" => "_self", "class" => "excel"]) ?>
|
||||||
</nav>
|
</nav>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user