dbms_init...1

This commit is contained in:
최준흠 2025-05-15 19:03:38 +09:00
parent b988774fdb
commit 3908b3240e
26 changed files with 2289 additions and 688 deletions

View File

@ -37,7 +37,7 @@ class ServiceController extends CustomerController
protected function index_process(): array
{
$fields = [
'fields' => ['clientinfo_uid', 'type', $this->getService()->getModel()->getTitleField(), 'payment_date', 'amount', 'startdate_at', 'enddate_at', 'status'],
'fields' => ['clientinfo_uid', 'type', $this->getService()->getModel()->getTitleField(), 'payment_date', 'amount', 'start_at', 'end_at', 'status'],
];
$this->init('index', $fields);
$this->modal_type = 'modal_iframe';

View File

@ -2,10 +2,12 @@
namespace App\Controllers\Admin\Equipment;
use App\Entities\Equipment\ServerPartEntity;
use App\Helpers\Equipment\ServerHelper;
use App\Services\Equipment\ServerPartService;
use App\Services\Equipment\PartService;
use App\Services\Equipment\ServerService;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use CodeIgniter\Validation\Validation;
@ -14,10 +16,14 @@ use Psr\Log\LoggerInterface;
class ServerController extends EquipmentController
{
private ?PartService $_partService = null;
private ?ServerPartService $_serverPartService = null;
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
$this->uri_path .= strtolower($this->getService()->getClassName()) . '/';
$this->view_path .= strtolower($this->getService()->getClassName()) . DIRECTORY_SEPARATOR;
// echo $this->view_path;
// exit;
$this->class_path = $this->getService()->getClassPath();
$this->title = lang("{$this->getService()->getClassPath()}.title");
$this->helper = $this->getHelper();
@ -45,6 +51,13 @@ class ServerController extends EquipmentController
}
return $this->_partService;
}
final public function getServerPartService(): ServerPartService
{
if (!$this->_serverPartService) {
$this->_serverPartService = new ServerPartService();
}
return $this->_serverPartService;
}
//Index,FieldForm관련
protected function getFieldRule(string $action, string $field): string
@ -100,33 +113,43 @@ class ServerController extends EquipmentController
$entity = parent::create_process();
//변경할 UIDS
$cpu_uids = $this->request->getVar('cpu_partinfo_uid[]');
if (!is_array($cpu_uids) || !count($cpu_uids)) {
if (!is_array($cpu_uids)) {
throw new \Exception("CPU가 정의되지 않았습니다.");
}
foreach ($cpu_uids as $uid) {
$temps = ['serverinfo_uid' => $entity->getPK(), 'partinfo_uid' => $uid];
$this->getServerPartService()->create($temps, new ServerPartEntity());
}
$ram_uids = $this->request->getVar('ram_partinfo_uid[]');
if (!is_array($ram_uids) || !count($ram_uids)) {
if (!is_array($ram_uids)) {
throw new \Exception("RAM가 정의되지 않았습니다.");
}
$disk_uids = $this->request->getVar('cpu_partinfo_uid[]');
if (!is_array($disk_uids) || !count($disk_uids)) {
foreach ($ram_uids as $uid) {
$temps = ['serverinfo_uid' => $entity->getPK(), 'partinfo_uid' => $uid];
$this->getServerPartService()->create($temps, new ServerPartEntity());
}
$disk_uids = $this->request->getVar('disk_partinfo_uid[]');
if (!is_array($disk_uids)) {
throw new \Exception("DISK가 정의되지 않았습니다.");
}
//데이터가 있는경우 Field만 처리하기위해
$fields = [];
foreach ($this->batchjob_fields as $field) {
if ($this->request->getVar($field)) {
$fields[] = $field;
}
foreach ($disk_uids as $uid) {
$temps = ['serverinfo_uid' => $entity->getPK(), 'partinfo_uid' => $uid];
$this->getServerPartService()->create($temps, new ServerPartEntity());
}
return $this->getService()->create($this->formDatas);
return $entity;
}
protected function index_process(): array
{
$fields = [
'fields' => ['code', 'clientinfo_uid', 'type', $this->getService()->getModel()->getTitleField(), 'price', 'status', 'description'],
'fields' => ['code', 'clientinfo_uid', 'type', $this->getService()->getModel()->getTitleField(), 'price', 'status'],
];
$this->init('index', $fields);
$this->modal_type = 'modal_iframe';
return parent::index_process();
$entities = parent::index_process();
foreach ($entities as $key => $entity) {
$entities[$key]['partinfo_uid'] = $this->getServerPartService()->getEntities(['serverinfo_uid' => $entity['id']);
$entities[$key]['ram_partinfo_uid'] = $this->getServerPartService()->getEntities(['serverinfo_uid' => $entity['id']);
$entities[$key]['disk_partinfo_uid'] = $this->getServerPartService()->getEntities(['serverinfo_uid' => $entity['id']);
}
}
}

View File

@ -470,7 +470,7 @@ abstract class CommonController extends BaseController
$this->getService()->getModel()->where(sprintf("%s.created_at <= '%s 23:59:59'", $this->getService()->getModel()->getTable(), $this->end));
}
}
protected function setOrcerByForList()
protected function setOrderByForList()
{
//OrderBy 처리
$this->order_field = $this->request->getVar('order_field');
@ -518,7 +518,7 @@ abstract class CommonController extends BaseController
$this->pagination = $this->getPaginationForList();
//조건절 , OrcerBy , Limit 처리
$this->setConditionForList($this->filter_fields);
$this->setOrcerByForList();
$this->setOrderByForList();
$this->getService()->getModel()->limit($this->per_page);
$this->getService()->getModel()->offset(($this->page - 1) * $this->per_page);
return $this->getService()->getEntities();

View File

@ -1,260 +0,0 @@
-- 1. 관리자정보
CREATE TABLE userinfo (
uid INT AUTO_INCREMENT PRIMARY KEY,
id VARCHAR(20) NOT NULL UNIQUE,
passwd VARCHAR(255) NOT NULL,
name VARCHAR(20) NOT NULL,
email VARCHAR(50) NOT NULL UNIQUE,
mobile VARCHAR(20),
role ENUM('admin', 'manager') DEFAULT 'manager',
status ENUM('use', 'stop') DEFAULT 'use',
updated_at TIMESTAMP NULL,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
) COMMENT '관리자정보';
-- 2. 고객정보
CREATE TABLE clientinfo (
uid INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(100) NOT NULL,
phone VARCHAR(50),
email VARCHAR(100),
account_balance INT DEFAULT 0 COMMENT '보증금',
role ENUM('user', 'partner') DEFAULT 'user',
note TEXT,
status ENUM('use', 'stop') DEFAULT 'use',
updated_at TIMESTAMP NULL,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
) COMMENT '고객정보';
-- 3. 고객 입출금
CREATE TABLE accountinfo (
uid INT AUTO_INCREMENT PRIMARY KEY,
clientinfo_uid INT NOT NULL,
status ENUM('deposit', 'withdrawal') DEFAULT 'deposit',
title VARCHAR(255) NOT NULL,
alias VARCHAR(50) NOT NULL COMMENT '입출금자명',
amount INT NOT NULL DEFAULT 0,
note TEXT,
updated_at TIMESTAMP NULL,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT FK_accountinfo_TO_clientinfo FOREIGN KEY (clientinfo_uid) REFERENCES clientinfo(uid)
) COMMENT '입출금계좌';
-- 4. 장비 정보
CREATE TABLE deviceinfo (
uid INT AUTO_INCREMENT PRIMARY KEY,
type ENUM('server', 'vpc', 'kcs', 'network') DEFAULT 'server',
brand VARCHAR(50) DEFAULT 'HP',
model VARCHAR(50) NOT NULL,
cost_price INT DEFAULT 0,
price INT DEFAULT 0,
description TEXT,
status ENUM('use', 'stop') DEFAULT 'use',
updated_at TIMESTAMP NULL,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
) COMMENT '장비정보';
-- 5. 장비 부속품 정보
CREATE TABLE devicepartinfo (
uid INT AUTO_INCREMENT PRIMARY KEY,
type ENUM('memory', 'hdd', 'ssd', 'nic') DEFAULT 'memory',
brand VARCHAR(50) DEFAULT 'samsung',
capacity INT NOT NULL COMMENT '용량 (GB)',
cost_price INT DEFAULT 0,
price INT DEFAULT 0,
description TEXT,
updated_at TIMESTAMP NULL,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
) COMMENT '장비 부품 정보';
-- 6. 장비 부속품 연결
CREATE TABLE deviceinfos_accessories (
uid INT AUTO_INCREMENT PRIMARY KEY,
deviceinfo_uid INT NOT NULL,
devicepartinfo_uid INT NOT NULL,
softwareinfo_uid INT,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (deviceinfo_uid) REFERENCES deviceinfo(uid),
FOREIGN KEY (devicepartinfo_uid) REFERENCES devicepartinfo(uid),
FOREIGN KEY (softwareinfo_uid) REFERENCES softwareinfo(uid)
) COMMENT '장비-부속품 연결정보';
-- 7. 소프트웨어 정보
CREATE TABLE softwareinfo (
uid INT AUTO_INCREMENT PRIMARY KEY,
type ENUM('os', 'application') DEFAULT 'os',
title VARCHAR(100) NOT NULL,
cost_price INT DEFAULT 0,
price INT DEFAULT 0,
description TEXT,
updated_at TIMESTAMP NULL,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
) COMMENT '소프트웨어 정보';
-- 8. 회선 정보
CREATE TABLE lineinfo (
uid INT AUTO_INCREMENT PRIMARY KEY,
code VARCHAR(50) NOT NULL,
type ENUM('general', 'dedicated') DEFAULT 'general',
price INT DEFAULT 0,
status ENUM('use', 'stop') DEFAULT 'use',
updated_at TIMESTAMP NULL,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
) COMMENT '회선 정보';
-- 9. IP 정보
CREATE TABLE ipinfo (
uid INT AUTO_INCREMENT PRIMARY KEY,
lineinfo_uid INT NOT NULL,
deviceinfo_uid INT,
serviceinfo_uid INT,
ip_address VARCHAR(50) NOT NULL UNIQUE,
price INT DEFAULT 0,
status ENUM('use', 'stop') DEFAULT 'use',
updated_at TIMESTAMP NULL,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (lineinfo_uid) REFERENCES lineinfo(uid),
FOREIGN KEY (deviceinfo_uid) REFERENCES deviceinfo(uid),
FOREIGN KEY (serviceinfo_uid) REFERENCES serviceinfo(uid)
) COMMENT 'IP 정보';
-- 10. 상면 정보 (Rack Space)
CREATE TABLE rackspaceinfo (
uid INT AUTO_INCREMENT PRIMARY KEY,
type ENUM('1u', '2u', '4u', 'fullrack', 'lightweight') DEFAULT '1u',
price INT DEFAULT 0,
status ENUM('use', 'stop') DEFAULT 'use',
updated_at TIMESTAMP NULL,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
) COMMENT '랙 상면 정보';
-- 11. 서비스 정보
CREATE TABLE serviceinfo (
uid INT AUTO_INCREMENT PRIMARY KEY,
clientinfo_uid INT NOT NULL,
type ENUM('hosting', 'colocation', 'defense') DEFAULT 'hosting',
title VARCHAR(100) NOT NULL,
payment_date DATE NOT NULL,
amount INT DEFAULT 0,
startdate_at TIMESTAMP NULL,
enddate_at TIMESTAMP NULL,
status ENUM('use', 'stop', 'terminate') DEFAULT 'use',
updated_at TIMESTAMP NULL,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (clientinfo_uid) REFERENCES clientinfo(uid)
) COMMENT '서비스 정보';
-- 12. 청구서 정보
CREATE TABLE invoiceinfo (
uid INT AUTO_INCREMENT PRIMARY KEY,
serviceinfo_uid INT NOT NULL,
type ENUM('monthly', 'onetime', 'daily') DEFAULT 'monthly',
billing_amount INT DEFAULT 0,
description TEXT,
status ENUM('unpaid', 'paid', 'refunded') DEFAULT 'unpaid',
updated_at TIMESTAMP NULL,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (serviceinfo_uid) REFERENCES serviceinfo(uid)
) COMMENT '청구서 정보';
-- 13. 서비스 - 장비 연결
CREATE TABLE serviceinfos_deviceinfos (
uid INT AUTO_INCREMENT PRIMARY KEY,
serviceinfo_uid INT NOT NULL,
deviceinfo_uid INT NOT NULL,
payment_type ENUM('onetime', 'month', 'free') DEFAULT 'month',
amount INT DEFAULT 0,
updated_at TIMESTAMP NULL,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (serviceinfo_uid) REFERENCES serviceinfo(uid),
FOREIGN KEY (deviceinfo_uid) REFERENCES deviceinfo(uid)
) COMMENT '서비스-장비 연결';
-- 14. 서비스 - 장비 부품 연결
CREATE TABLE serviceinfos_devicepartinfos (
uid INT AUTO_INCREMENT PRIMARY KEY,
serviceinfo_uid INT NOT NULL,
devicepartinfo_uid INT NOT NULL,
payment_type ENUM('onetime', 'month', 'free') DEFAULT 'month',
amount INT DEFAULT 0,
updated_at TIMESTAMP NULL,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (serviceinfo_uid) REFERENCES serviceinfo(uid),
FOREIGN KEY (devicepartinfo_uid) REFERENCES devicepartinfo(uid)
) COMMENT '서비스-장비 부품 연결';
-- 15. 서비스 - 소프트웨어 연결
CREATE TABLE serviceinfos_softwareinfos (
uid INT AUTO_INCREMENT PRIMARY KEY,
serviceinfo_uid INT NOT NULL,
softwareinfo_uid INT NOT NULL,
payment_type ENUM('onetime', 'month', 'free') DEFAULT 'month',
amount INT DEFAULT 0,
updated_at TIMESTAMP NULL,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (serviceinfo_uid) REFERENCES serviceinfo(uid),
FOREIGN KEY (softwareinfo_uid) REFERENCES softwareinfo(uid)
) COMMENT '서비스-소프트웨어 연결';
-- 16. 서비스 - IP 연결
CREATE TABLE serviceinfos_ipinfos (
uid INT AUTO_INCREMENT PRIMARY KEY,
serviceinfo_uid INT NOT NULL,
ipinfo_uid INT NOT NULL,
payment_type ENUM('onetime', 'month', 'free') DEFAULT 'month',
amount INT DEFAULT 0,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (serviceinfo_uid) REFERENCES serviceinfo(uid),
FOREIGN KEY (ipinfo_uid) REFERENCES ipinfo(uid)
) COMMENT '서비스-IP 연결';
-- 17. 서비스 - 회선 연결
CREATE TABLE serviceinfos_lineinfos (
uid INT AUTO_INCREMENT PRIMARY KEY,
serviceinfo_uid INT NOT NULL,
lineinfo_uid INT NOT NULL,
payment_type ENUM('onetime', 'month', 'free') DEFAULT 'month',
amount INT DEFAULT 0,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (serviceinfo_uid) REFERENCES serviceinfo(uid),
FOREIGN KEY (lineinfo_uid) REFERENCES lineinfo(uid)
) COMMENT '서비스-회선 연결';
-- 18. 서비스 - 랙 상면 연결
CREATE TABLE serviceinfos_rackinfos (
uid INT AUTO_INCREMENT PRIMARY KEY,
serviceinfo_uid INT NOT NULL,
rackspaceinfo_uid INT NOT NULL,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (serviceinfo_uid) REFERENCES serviceinfo(uid),
FOREIGN KEY (rackspaceinfo_uid) REFERENCES rackspaceinfo(uid)
) COMMENT '서비스-랙 연결';
-- 19. 고객 이벤트 (포인트, 도메인 등)
CREATE TABLE eventinfo (
uid INT AUTO_INCREMENT PRIMARY KEY,
clientinfo_uid INT NOT NULL,
type ENUM('domain', 'point') DEFAULT 'point',
title VARCHAR(100) NOT NULL,
value INT NOT NULL,
note TEXT,
status ENUM('use', 'expired') DEFAULT 'use',
updated_at TIMESTAMP NULL,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (clientinfo_uid) REFERENCES clientinfo(uid)
) COMMENT '고객 이벤트 (포인트/도메인)';
-- 20. 작업 로그
CREATE TABLE loginfo (
uid INT AUTO_INCREMENT PRIMARY KEY,
userinfo_uid INT NOT NULL,
type ENUM('info', 'warn', 'error', 'debug') DEFAULT 'info',
class VARCHAR(255),
method VARCHAR(255),
title VARCHAR(255) NOT NULL,
description TEXT NOT NULL,
status ENUM('use', 'archived') DEFAULT 'use',
updated_at TIMESTAMP NULL,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (userinfo_uid) REFERENCES userinfo(uid)
) COMMENT '작업 기록 로그';

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -20,8 +20,8 @@ class ServiceHelper extends CustomerHelper
}
switch ($field) {
case 'payment_date':
case 'startdate_at':
case 'enddate_at':
case 'start_at':
case 'end_at':
$extra_class = isset($extras['class']) ? $extras['class'] . ' calender' : 'calender';
$form = form_input($field, $value ?? "", ['class' => $extra_class, ...array_diff_key($extras, ['class' => ''])]);
break;
@ -36,8 +36,8 @@ class ServiceHelper extends CustomerHelper
$value = $viewDatas['entity']->$field ?? "";
switch ($field) {
case 'payment_date':
case 'startdate_at':
case 'enddate_at':
case 'start_at':
case 'end_at':
$value = $value ? date("Y-m-d", strtotime($value)) : "";
break;

View File

@ -7,8 +7,8 @@ return [
'title' => "제목",
'payment_date' => "결제일",
'amount' => "결제금액",
'startdate_at' => "개통일",
'enddate_at' => "해지일",
'start_at' => "개통일",
'end_at' => "해지일",
'status' => "상태",
'updated_at' => "수정일",
'created_at' => "신청일",

View File

@ -109,7 +109,7 @@ abstract class CommonModel extends Model
$rule = "is_image[{$field}]|mime_in[{$field},image/jpg,image/jpeg,image/gif,image/png,image/webp]|max_size[{$field},300]|max_dims[{$field},2048,768]";
break;
case "status":
$rule = "if_exist|in_list[use,unuse]";
$rule = "if_exist|trim|string";
break;
case "updated_at":
case "created_at":
@ -117,7 +117,7 @@ abstract class CommonModel extends Model
$rule = "if_exist|valid_date";
break;
default:
$rule = "if_exist|string";
$rule = "if_exist|trim|string";
break;
}
return $rule;

View File

@ -34,23 +34,18 @@ class ClientModel extends CustomerModel
}
switch ($field) {
case "name":
case "role":
$rule = "required|trim|string";
break;
case "email":
$rule = "if_exist|trim|valid_email";
$rule .= in_array($action, ["create", "create_form"]) ? "|is_unique[{$this->table}.{$field}]" : "";
break;
case "role":
$rule = "required|trim|string";
break;
case "account_balance":
case "coupon_balance":
case "point_balance":
$rule = "if_exist|trim|numeric";
break;
case "status":
$rule = "if_exist|in_list[use,pause]";
break;
default:
$rule = parent::getFieldRule($action, $field);
break;

View File

@ -18,8 +18,8 @@ class ServiceModel extends CustomerModel
"title",
"payment_date",
"amount",
"startdate_at",
"enddate_at",
"start_at",
"end_at",
"status",
"updated_at"
];
@ -40,20 +40,14 @@ class ServiceModel extends CustomerModel
$rule = "if_exist|numeric";
break;
case "title":
$rule = "required|trim|string";
break;
case "type":
$rule = "required|in_list[hosting,colocation]";
break;
case "status":
$rule = "required|in_list[use,pause,terminated]";
$rule = "required|trim|string";
break;
case "payment_date":
$rule = "required|valid_date";
break;
case "startdate_at":
case "enddate_at":
case "deleted_at":
case "start_at":
case "end_at":
$rule = "if_exist|valid_date";
default:
$rule = parent::getFieldRule($action, $field);

View File

@ -35,7 +35,7 @@ class IpModel extends EquipmentModel
$rule = "required|trim|valid_ip[both]"; //ipv4 , ipv6 , both(ipv4,ipv6)
break;
case "status":
$rule = "required|in_list[use,pause,occupied,forbidden]";
$rule = "required|trim|string";
break;
default:
$rule = parent::getFieldRule($action, $field);

View File

@ -39,13 +39,9 @@ class LineModel extends EquipmentModel
break;
case "title":
case "bandwith":
$rule = "required|trim|string";
break;
case "type":
$rule = "required|in_list[general,dedicated,defence]";
break;
case "status":
$rule = "required|in_list[use,pause,termination]";
$rule = "required|trim|string";
break;
default:
$rule = parent::getFieldRule($action, $field);

View File

@ -41,17 +41,13 @@ class NetworkModel extends EquipmentModel
break;
case "code":
case "model":
$rule = "required|trim|string";
break;
case "type":
$rule = "required|in_list[L2,L3,L4,Router,colocation]";
case "status":
$rule = "required|trim|string";
break;
case "manufactur_at":
$rule = "required|valid_date";
break;
case "status":
$rule = "required|in_list[use,pause,occupied]";
break;
case "description":
$rule = "if_exist|trim|string";
break;

View File

@ -39,17 +39,13 @@ class PartModel extends EquipmentModel
$rule = "required|numeric";
break;
case "model":
$rule = "required|trim|string";
break;
case "type":
$rule = "required|in_list[CPU,RAM,DISK,colocation]";
case "status":
$rule = "required|trim|string";
break;
case "manufactur_at":
$rule = "required|valid_date";
break;
case "status":
$rule = "required|in_list[use,pause,occupied]";
break;
case "description":
$rule = "if_exist|trim|string";
break;

View File

@ -41,16 +41,9 @@ class ServerModel extends EquipmentModel
break;
case "code":
case "model":
$rule = "required|trim|string";
break;
case "type":
$rule = "required|in_list[Rack,PC,MiniPC,clocation]";
break;
case "manufactur_at":
$rule = "required|valid_date";
break;
case "status":
$rule = "required|in_list[use,pause,occupied]";
$rule = "required|trim|string";
break;
case "description":
$rule = "if_exist|trim|string";

View File

@ -0,0 +1,43 @@
<?php
namespace App\Models\Equipment;
use App\Entities\Equipment\ServerPartEntity;
class ServerPartModel extends EquipmentModel
{
const TABLE = "serverinfos_partinfos";
const PK = "uid";
const TITLE = "serverinfo_uid";
protected $table = self::TABLE;
protected $primaryKey = self::PK;
protected $returnType = ServerPartEntity::class;
protected $allowedFields = [
"serverinfo_uid",
"partinfo_uid",
"type"
];
public function __construct()
{
parent::__construct();
}
public function getFieldRule(string $action, string $field): string
{
if (is_array($field)) {
throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true));
}
switch ($field) {
case "serverinfo_uid":
case "partinfo_uid":
$rule = "required|numeric";
break;
case "type":
$rule = "required|trim|string";
break;
default:
$rule = parent::getFieldRule($action, $field);
break;
}
return $rule;
}
}

View File

@ -35,13 +35,9 @@ class SoftwareModel extends EquipmentModel
$rule = "required|numeric";
break;
case "model":
$rule = "required|trim|string";
break;
case "type":
$rule = "required|in_list[Windows,Linux,Security,Virus,App]";
break;
case "status":
$rule = "required|in_list[use,pause]";
$rule = "required|trim|string";
break;
case "description":
$rule = "if_exist|trim|string";

View File

@ -33,8 +33,8 @@ class ServiceService extends CustomerService
"title",
"payment_date",
"amount",
"startdate_at",
"enddate_at",
"start_at",
"end_at",
"status",
];
}

View File

@ -0,0 +1,44 @@
<?php
namespace App\Services\Equipment;
use App\Entities\Equipment\ServerPartEntity;
use App\Models\Equipment\ServerPartModel;
use CodeIgniter\HTTP\IncomingRequest;
use App\Services\Equipment\EquipmentService; // Ensure this path is correct and the class exists or create the class if missing
class ServerPartService extends EquipmentService
{
protected ?IncomingRequest $request = null;
public function __construct(?IncomingRequest $request = null)
{
parent::__construct($request);
}
public function getClassName(): string
{
return parent::getClassName() . DIRECTORY_SEPARATOR . "Part";
}
public function getModelClass(): ServerPartModel
{
return new ServerPartModel();
}
public function getEntityClass(): ServerPartEntity
{
return new ServerPartEntity();
}
public function getFields(): array
{
return [
"serverinfo_uid",
"partinfo_uid",
];
}
public function getFilterFields(): array
{
return ["serverinfo_uid", "partinfo_uid"];
}
public function getBatchJobFields(): array
{
return [];
}
}

View File

@ -0,0 +1,31 @@
<?= $this->extend(LAYOUTS[$viewDatas['layout']]['path']) ?>
<?= $this->section('content') ?>
<div id="container" class="content">
<link href="/css/<?= $viewDatas['layout'] ?>/form.css" media="screen" rel="stylesheet" type="text/css" />
<script src="/js/<?= $viewDatas['layout'] ?>/form.js" referrerpolicy="origin"></script>
<script src="/assets/tinymce/tinymce.min.js" referrerpolicy="origin"></script>
<?php foreach ($viewDatas['individualStylesheets'] as $css): ?>
<link href="/css/<?= $viewDatas['layout'] ?>/<?= $css ?>" media="screen" rel="stylesheet" type="text/css" />
<?php endforeach ?>
<?php foreach ($viewDatas['individualScripts'] as $js): ?>
<script src="/js/<?= $viewDatas['layout'] ?>/<?= $js ?>" referrerpolicy="origin"></script>
<?php endforeach ?>
<?= form_open(current_url(), $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
<div class=" action_form">
<table class="table table-bordered">
<?php foreach ($viewDatas['fields'] as $field): ?>
<tr>
<th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel($field, $viewDatas) ?></th>
<td nowrap class="text-start">
<?= $viewDatas['helper']->getFieldForm($field, old($field), $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>
<?php if ($error = session('error')): ?><?= $viewDatas['helper']->alert($error) ?><?php endif ?>
</div>
<?= $this->endSection() ?>

View File

@ -0,0 +1,63 @@
<?= $this->extend(LAYOUTS[$viewDatas['layout']]['path']) ?>
<?= $this->section('content') ?>
<div class="layout_top"><?= $this->include(LAYOUTS[$viewDatas['layout']]['path'] . '/top'); ?></div>
<!-- Layout Middle Start -->
<table class="layout_middle">
<tr>
<td class="layout_left">
<!-- Layout Left Start -->
<?= $this->include(LAYOUTS[$viewDatas['layout']]['path'] . '/left_menu'); ?>
<!-- Layout Left End -->
</td>
<td class="layout_right">
<!-- Layout Right Start -->
<?= $this->include("templates/{$viewDatas['layout']}/index_header"); ?>
<div id="container" class="layout_content">
<link href="/css/<?= $viewDatas['layout'] ?>/index.css" media="screen" rel="stylesheet" type="text/css" />
<div class="index_body">
<?= $this->include("templates/{$viewDatas['layout']}/index_content_top"); ?>
<?= form_open(current_url(), ['id' => 'batchjob_form', 'method' => "post"]) ?>
<table class="index_table data table table-bordered table-hover table-striped" data-rtc-resizable-table="reisze_table">
<thead>
<tr>
<th class="index_head_short_column">번호</th>
<?php foreach ($viewDatas['fields'] as $field): ?>
<th data-rtc-resizable="<?= $field ?>"><?= $viewDatas['helper']->getListLabel($field, $viewDatas) ?></th>
<?php endforeach ?>
<th class="index_head_short_column">작업</th>
</tr>
</thead>
<tbody>
<?php $cnt = 0 ?>
<?php foreach ($viewDatas['entities'] as $entity): ?>
<tr <?= $viewDatas['helper']->getListRowColor($entity) ?>>
<?php $viewDatas['cnt'] = $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt); ?>
<?php $viewDatas['entity'] = $entity; ?>
<th><?= $viewDatas['helper']->getListButton('modify', $viewDatas) ?></th>
<?php foreach ($viewDatas['fields'] as $field): ?>
<td><?= $viewDatas['helper']->getFieldView($field, $viewDatas) ?></td>
<?php endforeach ?>
<th><?= $viewDatas['helper']->getListButton('delete', $viewDatas) ?></th>
</tr>
<?php $cnt++ ?>
<?php endforeach ?>
</tbody>
</table>
<?= $this->include("templates/{$viewDatas['layout']}/index_content_batchjob"); ?>
<?= form_close() ?>
<div class=" index_pagination"><?= $viewDatas['pagination'] ?></div>
</div>
<div class="index_bottom"><?= $this->include("templates/common/" . (isset($viewDatas['modal_type']) ? $viewDatas['modal_type'] : 'modal_fetch')); ?></div>
<script type="text/javascript" src="/js/<?= $viewDatas['layout'] ?>/index.js"></script>
</div>
<div class="layout_footer"><?= $this->include("templates/{$viewDatas['layout']}/index_footer"); ?></div>
<!-- Layout Right End -->
</td>
</tr>
</table>
<?php if ($error = session('error')): ?><?= $viewDatas['helper']->alert($error) ?><?php endif ?>
<!-- Layout Middle End -->
<div class="layout_bottom">
<?= $this->include(LAYOUTS[$viewDatas['layout']]['path'] . '/bottom'); ?>
</div>
<?= $this->endSection() ?>

View File

@ -0,0 +1,31 @@
<?= $this->extend(LAYOUTS[$viewDatas['layout']]['path']) ?>
<?= $this->section('content') ?>
<div id="container" class="content">
<link href="/css/<?= $viewDatas['layout'] ?>/form.css" media="screen" rel="stylesheet" type="text/css" />
<script src="/js/<?= $viewDatas['layout'] ?>/form.js" referrerpolicy="origin"></script>
<script src="/assets/tinymce/tinymce.min.js" referrerpolicy="origin"></script>
<?php foreach ($viewDatas['individualStylesheets'] as $css): ?>
<link href="/css/<?= $viewDatas['layout'] ?>/<?= $css ?>" media="screen" rel="stylesheet" type="text/css" />
<?php endforeach ?>
<?php foreach ($viewDatas['individualScripts'] as $js): ?>
<script src="/js/<?= $viewDatas['layout'] ?>/<?= $js ?>" referrerpolicy="origin"></script>
<?php endforeach ?>
<?= form_open(current_url(), ['id' => 'action_form', ...$viewDatas['forms']['attributes']], $viewDatas['forms']['hiddens']) ?>
<div class="action_form">
<table class="table table-bordered">
<?php foreach ($viewDatas['fields'] as $field): ?>
<tr>
<th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel($field, $viewDatas) ?></th>
<td nowrap class="text-start">
<?= $viewDatas['helper']->getFieldForm($field, old($field) ?? $viewDatas['entity']->$field, $viewDatas) ?>
<div><?= validation_show_error($field); ?></div>
</td>
</tr>
<?php endforeach; ?>
</table>
<div class="text-center"><?= form_submit("", '수정', ["class" => "btn btn-outline btn-primary"]) ?></div>
<?= form_close(); ?>
</div>
<?php if ($error = session('error')): ?><?= $viewDatas['helper']->alert($error) ?><?php endif ?>
</div>
<?= $this->endSection() ?>

View File

@ -0,0 +1,16 @@
<?= $this->extend(LAYOUTS[$viewDatas['layout']]['path']) ?>
<?= $this->section('content') ?>
<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['fields'] as $field): ?>
<tr>
<th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel($field, $viewDatas) ?></th>
<td nowrap class="text-start"><?= $viewDatas['helper']->getFieldView($field, $viewDatas) ?></td>
</tr>
<?php endforeach; ?>
</table>
</div>
</div>
<?= $this->endSection() ?>

View File

@ -0,0 +1,103 @@
<?= $this->extend(LAYOUTS[$viewDatas['layout']]['path']) ?>
<?= $this->section('content') ?>
<div class="layout_top"><?= $this->include(LAYOUTS[$viewDatas['layout']]['path'] . '/top'); ?></div>
<!-- Layout Middle Start -->
<table class="layout_middle">
<tr>
<td class="layout_left">
<!-- Layout Left Start -->
<?= $this->include(LAYOUTS[$viewDatas['layout']]['path'] . '/left_menu'); ?>
<!-- Layout Left End -->
</td>
<td class="layout_right">
<!-- Layout Right Start -->
<?= $this->include("templates/{$viewDatas['layout']}/index_header"); ?>
<div id="container" class="layout_content">
<!-- RSS Feed Start -->
<style>
.news-container {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}
.news-item {
width: 48%;
margin-bottom: 20px;
border: 1px solid #ddd;
padding: 10px;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}
.news-item h3 {
font-size: 18px;
margin-bottom: 5px;
}
.news-item p {
font-size: 14px;
color: #666;
}
</style>
<div class="news-container" id="newsContainer"><!-- RSS 피드 항목들이 여기에 동적으로 추가됩니다 --></div>
<script>
// fetchRSS 함수 정의
function fetchRSS() {
fetch('/RSSFeed/getITWorld')
.then(response => response.json())
.then(data => {
const newsContainer = document.getElementById('newsContainer');
newsContainer.innerHTML = '';
data.forEach(item => {
const pubDate = new Date(item.pubDate);
const newsItem = document.createElement('div');
newsItem.className = 'news-item';
let imageUrl = item.imageUrl || extractImageFromContent(item.content);
imageUrl = convertToAbsoluteUrl(imageUrl, item.link);
newsItem.innerHTML = `
<h3><img src="${imageUrl || '/images/common/news.png'}" alt="${item.title}" style="width: 30px; height: 30px; object-fit: cover; margin-bottom: 10px;" onerror="this.onerror=null; this.src='/images/common/news.png';"><a href="${item.link}" target="_blank">${item.title}</a></h3>
<p>${item.description}</p>
<small>게시일: ${pubDate.toLocaleString()}</small>
`;
newsContainer.appendChild(newsItem);
});
})
.catch(error => console.error('RSS 피드를 가져오는 중 오류 발생:', error));
}
function extractImageFromContent(content) {
const parser = new DOMParser();
const doc = parser.parseFromString(content, 'text/html');
const img = doc.querySelector('img');
return img ? img.src : null;
}
function convertToAbsoluteUrl(url, baseUrl) {
if (!url) return null;
if (url.startsWith('http://') || url.startsWith('https://')) {
return url;
}
const base = new URL(baseUrl);
if (url.startsWith('/')) {
return `${base.protocol}//${base.hostname}${url}`;
}
return `${base.protocol}//${base.hostname}${base.pathname.substring(0, base.pathname.lastIndexOf('/') + 1)}${url}`;
}
document.addEventListener('DOMContentLoaded', function () {
fetchRSS();
setInterval(fetchRSS, 3600000);
});
</script>
<!-- RSS Feed End -->
</div>
<div class="layout_footer"><?= $this->include("templates/{$viewDatas['layout']}/index_footer"); ?></div>
<!-- Layout Right End -->
</td>
</tr>
</table>
<!-- Layout Middle End -->
<div class="layout_bottom"><?= $this->include(LAYOUTS[$viewDatas['layout']]['path'] . '/bottom'); ?></div>
<?= $this->endSection() ?>

View File

@ -14,6 +14,7 @@ table.action_form {
table.action_form th {
text-align: center;
background-color: #f5f5f5;
}
table.action_form td {
@ -70,7 +71,7 @@ table.index_table {
border-collapse: collapse;
}
table.index_table thead th {
table.index_table thead tr th {
white-space: nowrap;
padding-top: 15px;
padding-bottom: 15px;