dbms_init...1

This commit is contained in:
최준흠 2025-05-13 19:12:02 +09:00
parent 07a4799f31
commit b292ca2f6b
37 changed files with 857 additions and 460 deletions

View File

@ -93,6 +93,19 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au
$routes->post('batchjob_delete', 'PointController::batchjob_delete'); $routes->post('batchjob_delete', 'PointController::batchjob_delete');
$routes->get('download/(:alpha)', 'PointController::download/$1'); $routes->get('download/(:alpha)', 'PointController::download/$1');
}); });
$routes->group('service', ['namespace' => 'App\Controllers\Admin\Customer'], function ($routes) {
$routes->get('/', 'ServiceController::index', []);
$routes->get('create', 'ServiceController::create_form');
$routes->post('create', 'ServiceController::create');
$routes->get('modify/(:num)', 'ServiceController::modify_form/$1');
$routes->post('modify/(:num)', 'ServiceController::modify/$1');
$routes->get('view/(:num)', 'ServiceController::view/$1');
$routes->get('delete/(:num)', 'ServiceController::delete/$1');
$routes->get('toggle/(:num)/(:any)', 'ServiceController::toggle/$1/$2');
$routes->post('batchjob', 'ServiceController::batchjob');
$routes->post('batchjob_delete', 'ServiceController::batchjob_delete');
$routes->get('download/(:alpha)', 'ServiceController::download/$1');
});
}); });
$routes->group('equipment', ['namespace' => 'App\Controllers\Admin\Equipment'], function ($routes) { $routes->group('equipment', ['namespace' => 'App\Controllers\Admin\Equipment'], function ($routes) {
$routes->group('line', ['namespace' => 'App\Controllers\Admin\Equipment'], function ($routes) { $routes->group('line', ['namespace' => 'App\Controllers\Admin\Equipment'], function ($routes) {

View File

@ -52,36 +52,36 @@ class ClientController extends CustomerController
return $validation; return $validation;
} }
protected function create_process(): ClientEntity // protected function create_process(): ClientEntity
{ // {
$entity = parent::create_process(); // $entity = parent::create_process();
//Account정보 // //Account정보
$temps = []; // $temps = [];
$temps['clientinfo_uid'] = $entity->getPK(); // $temps['clientinfo_uid'] = $entity->getPK();
$temps['title'] = "첫가입"; // $temps['title'] = "첫가입";
$temps['alias'] = $entity->getTitle(); // $temps['alias'] = $entity->getTitle();
$temps['amount'] = $this->formDatas['account_balance'] ?? 0; // $temps['amount'] = $this->formDatas['account_balance'] ?? 0;
$temps['status'] = lang("{$this->getAccountService()->getClassPath()}.DEFAULTS.status"); // $temps['status'] = lang("{$this->getAccountService()->getClassPath()}.DEFAULTS.status");
$this->getAccountService()->create($temps, new AccountEntity()); // $this->getAccountService()->create($temps, new AccountEntity());
//Coupon정보 // //Coupon정보
$temps = []; // $temps = [];
$temps['clientinfo_uid'] = $entity->getPK(); // $temps['clientinfo_uid'] = $entity->getPK();
$temps['title'] = "첫가입"; // $temps['title'] = "첫가입";
$temps['amount'] = $this->formDatas['coupon_balance'] ?? 0; // $temps['amount'] = $this->formDatas['coupon_balance'] ?? 0;
$temps['status'] = lang("{$this->getCouponService()->getClassPath()}.DEFAULTS.status"); // $temps['status'] = lang("{$this->getCouponService()->getClassPath()}.DEFAULTS.status");
$this->getCouponService()->create($temps, new CouponEntity()); // $this->getCouponService()->create($temps, new CouponEntity());
//Point정보 // //Point정보
$temps = []; // $temps = [];
$temps['clientinfo_uid'] = $entity->getPK(); // $temps['clientinfo_uid'] = $entity->getPK();
$temps['title'] = "첫가입"; // $temps['title'] = "첫가입";
$temps['amount'] = $this->formDatas['point_balance'] ?? 0; // $temps['amount'] = $this->formDatas['point_balance'] ?? 0;
$temps['status'] = lang("{$this->getPointService()->getClassPath()}.DEFAULTS.status"); // $temps['status'] = lang("{$this->getPointService()->getClassPath()}.DEFAULTS.status");
$this->getPointService()->create($temps, new CouponEntity()); // $this->getPointService()->create($temps, new CouponEntity());
return $entity; // return $entity;
} // }
//Index,FieldForm관련. //Index,FieldForm관련.
//View관련 //View관련

View File

@ -8,13 +8,11 @@ use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
use App\Services\Customer\AccountService; use App\Services\Customer\AccountService;
use App\Services\Customer\ClientService;
use App\Services\Customer\CouponService; use App\Services\Customer\CouponService;
use App\Services\Customer\PointService; use App\Services\Customer\PointService;
abstract class CustomerController extends AdminController abstract class CustomerController extends AdminController
{ {
private ?ClientService $_clientService = null;
private ?AccountService $_accountService = null; private ?AccountService $_accountService = null;
private ?CouponService $_couponService = null; private ?CouponService $_couponService = null;
private ?PointService $_pointService = null; private ?PointService $_pointService = null;
@ -24,13 +22,6 @@ abstract class CustomerController extends AdminController
$this->uri_path .= 'customer/'; $this->uri_path .= 'customer/';
// $this->view_path .= "customer" . DIRECTORY_SEPARATOR; // $this->view_path .= "customer" . DIRECTORY_SEPARATOR;
} }
final public function getClientService(): ClientService
{
if (!$this->_clientService) {
$this->_clientService = new ClientService($this->request);
}
return $this->_clientService;
}
final public function getAccountService(): AccountService final public function getAccountService(): AccountService
{ {
if (!$this->_accountService) { if (!$this->_accountService) {
@ -53,18 +44,4 @@ abstract class CustomerController extends AdminController
return $this->_pointService; return $this->_pointService;
} }
//Index,FieldForm관련 //Index,FieldForm관련
protected function getFormFieldOption(string $field, array $options = []): array
{
switch ($field) {
case 'clientinfo_uid':
$options[$field] = $this->getClientService()->getFormFieldOption($field);
// echo $this->getUserModel()->getLastQuery();
// dd($options);
break;
default:
$options = parent::getFormFieldOption($field, $options);
break;
}
return $options;
}
} }

View File

@ -0,0 +1,46 @@
<?php
namespace App\Controllers\Admin\Customer;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
use App\Helpers\Customer\ServiceHelper;
use App\Services\Customer\ServiceService;
class ServiceController extends CustomerController
{
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
$this->uri_path .= strtolower($this->getService()->getClassName()) . '/';
$this->class_path = $this->getService()->getClassPath();
$this->title = lang("{$this->getService()->getClassPath()}.title");
$this->helper = $this->getHelper();
}
public function getService(): ServiceService
{
if (!$this->_service) {
$this->_service = new ServiceService($this->request);
}
return $this->_service;
}
public function getHelper(): mixed
{
if (!$this->_helper) {
$this->_helper = new ServiceHelper($this->request);
}
return $this->_helper;
}
//Index,FieldForm관련.
protected function index_process(): array
{
$fields = [
'fields' => ['clientinfo_uid', 'type', $this->getService()->getModel()->getTitleField(), 'payment_date', 'amount', 'startdate_at', 'enddate_at', 'status'],
];
$this->init('index', $fields);
$this->modal_type = 'modal_iframe';
return parent::index_process();
}
}

View File

@ -9,13 +9,11 @@ use Psr\Log\LoggerInterface;
use App\Services\Equipment\LineService; use App\Services\Equipment\LineService;
use App\Services\Equipment\ServerService; use App\Services\Equipment\ServerService;
use App\Services\Customer\ClientService;
abstract class EquipmentController extends AdminController abstract class EquipmentController extends AdminController
{ {
private ?ServerService $_serverService = null; private ?ServerService $_serverService = null;
private ?LineService $_lineService = null; private ?LineService $_lineService = null;
private ?ClientService $_clientService = null;
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger) public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{ {
parent::initController($request, $response, $logger); parent::initController($request, $response, $logger);
@ -36,19 +34,12 @@ abstract class EquipmentController extends AdminController
} }
return $this->_lineService; return $this->_lineService;
} }
final public function getClientService(): ClientService
{
if (!$this->_clientService) {
$this->_clientService = new ClientService($this->request);
}
return $this->_clientService;
}
//Index,FieldForm관련 //Index,FieldForm관련
protected function getFormFieldOption(string $field, array $options = []): array protected function getFormFieldOption(string $field, array $options = []): array
{ {
switch ($field) { switch ($field) {
case 'clientinfo_uid': case 'lineinfo_uid':
$options[$field] = $this->getClientService()->getFormFieldOption($field); $options[$field] = $this->getLineService()->getFormFieldOption($field);
// echo $this->getUserModel()->getLastQuery(); // echo $this->getUserModel()->getLastQuery();
// dd($options); // dd($options);
break; break;

View File

@ -35,18 +35,13 @@ class PartController extends EquipmentController
return $this->_helper; return $this->_helper;
} }
//Index,FieldForm관련 //Index,FieldForm관련
protected function setValidation(Validation $validation, string $action, string $field, ?string $rule = null): Validation protected function index_process(): array
{ {
switch ($field) { $fields = [
case 'role': 'fields' => ['clientinfo_uid', 'type', $this->getService()->getModel()->getTitleField(), 'capacity', 'price', 'status', 'description'],
//아래 Rule Array는 필드명.* checkbox를 사용 ];
$validation->setRule("{$field}.*", $field, $rule); $this->init('index', $fields);
break; $this->modal_type = 'modal_iframe';
default: return parent::index_process();
$validation = parent::setValidation($validation, $action, $field, $rule);
break;
}
return $validation;
} }
//Index,FieldForm관련.
} }

View File

@ -4,14 +4,15 @@ namespace App\Controllers\Admin\Equipment;
use CodeIgniter\HTTP\RequestInterface; use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface; use CodeIgniter\HTTP\ResponseInterface;
use CodeIgniter\Validation\Validation;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
use App\Helpers\Equipment\ServerHelper; use App\Helpers\Equipment\ServerHelper;
use App\Services\Equipment\ServerService; use App\Services\Equipment\ServerService;
use App\Services\Equipment\PartService;
class ServerController extends EquipmentController class ServerController extends EquipmentController
{ {
private ?PartService $_partService = null;
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger) public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{ {
parent::initController($request, $response, $logger); parent::initController($request, $response, $logger);
@ -34,6 +35,30 @@ class ServerController extends EquipmentController
} }
return $this->_helper; return $this->_helper;
} }
final public function getPartService(): PartService
{
if (!$this->_partService) {
$this->_partService = new PartService($this->request);
}
return $this->_partService;
}
//Index,FieldForm관련
protected function getFormFieldOption(string $field, array $options = []): array
{
switch ($field) {
case 'partinfo_uid':
$options[$field] = $this->getPartService()->getFormFieldOption($field);
// echo $this->getUserModel()->getLastQuery();
// dd($options);
break;
default:
$options = parent::getFormFieldOption($field, $options);
break;
}
return $options;
}
//Index,FieldForm관련 //Index,FieldForm관련
protected function index_process(): array protected function index_process(): array
{ {

View File

@ -35,18 +35,13 @@ class SoftwareController extends EquipmentController
return $this->_helper; return $this->_helper;
} }
//Index,FieldForm관련 //Index,FieldForm관련
protected function setValidation(Validation $validation, string $action, string $field, ?string $rule = null): Validation protected function index_process(): array
{ {
switch ($field) { $fields = [
case 'role': 'fields' => ['type', $this->getService()->getModel()->getTitleField(), 'price', 'status', 'description'],
//아래 Rule Array는 필드명.* checkbox를 사용 ];
$validation->setRule("{$field}.*", $field, $rule); $this->init('index', $fields);
break; $this->modal_type = 'modal_iframe';
default: return parent::index_process();
$validation = parent::setValidation($validation, $action, $field, $rule);
break;
}
return $validation;
} }
//Index,FieldForm관련.
} }

View File

@ -17,11 +17,13 @@ use Psr\Log\LoggerInterface;
use App\Libraries\LogCollector; use App\Libraries\LogCollector;
use App\Services\MyLogService; use App\Services\MyLogService;
use App\Services\Customer\ClientService;
abstract class CommonController extends BaseController abstract class CommonController extends BaseController
{ {
private $_myAuth = null; private $_myAuth = null;
private $_myLogService = null; private ?MyLogService $_myLogService = null;
private ?ClientService $_clientService = null;
private $_viewDatas = []; private $_viewDatas = [];
abstract public function getService(): mixed; abstract public function getService(): mixed;
abstract function getHelper(): mixed; abstract function getHelper(): mixed;
@ -57,6 +59,13 @@ abstract class CommonController extends BaseController
{ {
return $this->_viewDatas; return $this->_viewDatas;
} }
final public function getClientService(): ClientService
{
if (!$this->_clientService) {
$this->_clientService = new ClientService($this->request);
}
return $this->_clientService;
}
final public function getMyLogService(): mixed final public function getMyLogService(): mixed
{ {
if (!$this->_myLogService) { if (!$this->_myLogService) {
@ -108,6 +117,11 @@ abstract class CommonController extends BaseController
protected function getFormFieldOption(string $field, array $options): array protected function getFormFieldOption(string $field, array $options): array
{ {
switch ($field) { switch ($field) {
case 'clientinfo_uid':
$options[$field] = $this->getClientService()->getFormFieldOption($field);
// echo $this->getUserModel()->getLastQuery();
// dd($options);
break;
default: default:
$options[$field] = lang($this->getService()->getClassPath() . '.' . strtoupper($field)); $options[$field] = lang($this->getService()->getClassPath() . '.' . strtoupper($field));
break; break;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,16 @@
<?php
namespace App\Entities\Customer;
use App\Models\Customer\ServiceModel;
class ServiceEntity extends CustomerEntity
{
const PK = ServiceModel::PK;
const TITLE = ServiceModel::TITLE;
public function getAmount()
{
return $this->attributes['amount'];
}
}

View File

@ -8,9 +8,4 @@ class PartEntity extends EquipmentEntity
{ {
const PK = PartModel::PK; const PK = PartModel::PK;
const TITLE = PartModel::TITLE; const TITLE = PartModel::TITLE;
public function getAmount()
{
return $this->attributes['amount'];
}
} }

View File

@ -8,9 +8,4 @@ class SoftwareEntity extends EquipmentEntity
{ {
const PK = SoftwareModel::PK; const PK = SoftwareModel::PK;
const TITLE = SoftwareModel::TITLE; const TITLE = SoftwareModel::TITLE;
public function getAmount()
{
return $this->attributes['amount'];
}
} }

View File

@ -14,6 +14,10 @@ class UserEntity extends CommonEntity
{ {
return $this->attributes['id']; return $this->attributes['id'];
} }
public function getPassword(): string
{
return $this->attributes['passwd'];
}
public function getRole(): string public function getRole(): string
{ {
return $this->attributes['role']; return $this->attributes['role'];

View File

@ -242,9 +242,19 @@ class CommonHelper
$form = form_dropdown($field, $formOptions, $value, $extras); $form = form_dropdown($field, $formOptions, $value, $extras);
} }
break; break;
case 'clientinfo_uid':
if (!is_array($viewDatas['field_options'][$field])) {
throw new \Exception(__METHOD__ . "에서 {$field}의 field_options가 array형태가 아닙니다.");
}
$extra_class = isset($extras['class']) ? $extras['class'] . ' select-field' : 'select-field';
$formOptions = ["" => lang($viewDatas['class_path'] . '.label.' . $field) . ' 선택'];
foreach ($viewDatas['field_options'][$field] as $key => $label) {
$formOptions[$key] = $label;
}
$form = form_dropdown($field, $formOptions, $value, ['class' => $extra_class, ...array_diff_key($extras, ['class' => ''])]);
break;
case 'updated_at': case 'updated_at':
case 'created_at': case 'created_at':
case 'manufactur_at':
$extra_class = isset($extras['class']) ? $extras['class'] . ' calender' : 'calender'; $extra_class = isset($extras['class']) ? $extras['class'] . ' calender' : 'calender';
$form = form_input($field, $value ?? "", ['class' => $extra_class, ...array_diff_key($extras, ['class' => ''])]); $form = form_input($field, $value ?? "", ['class' => $extra_class, ...array_diff_key($extras, ['class' => ''])]);
break; break;
@ -257,11 +267,13 @@ class CommonHelper
if (!is_array($viewDatas['field_options'][$field])) { if (!is_array($viewDatas['field_options'][$field])) {
throw new \Exception(__METHOD__ . "에서 {$field}의 field_options가 array형태가 아닙니다."); throw new \Exception(__METHOD__ . "에서 {$field}의 field_options가 array형태가 아닙니다.");
} }
// $extra_class = isset($extras['class']) ? $extras['class'] . ' select-field' : 'select-field';
$extra_class = isset($extras['class']) ? $extras['class'] : "";
$formOptions = ["" => lang($viewDatas['class_path'] . '.label.' . $field) . ' 선택']; $formOptions = ["" => lang($viewDatas['class_path'] . '.label.' . $field) . ' 선택'];
foreach ($viewDatas['field_options'][$field] as $key => $label) { foreach ($viewDatas['field_options'][$field] as $key => $label) {
$formOptions[$key] = $label; $formOptions[$key] = $label;
} }
$form = form_dropdown($field, $formOptions, $value, $extras); $form = form_dropdown($field, $formOptions, $value, ['class' => $extra_class, ...array_diff_key($extras, ['class' => ''])]);
} else { } else {
$form = form_input($field, $value ?? "", ["autocomplete" => $field, ...$extras]); $form = form_input($field, $value ?? "", ["autocomplete" => $field, ...$extras]);
} }
@ -287,15 +299,6 @@ class CommonHelper
] ]
); );
break; break;
case 'category_uid':
foreach (array_values($viewDatas['field_options'][$field]) as $category_2depths) {
foreach ($category_2depths as $key => $depth) {
if ($key == $depth) {
$value = $depth;
}
}
}
break;
case 'user_uid': case 'user_uid':
$user_uids = []; $user_uids = [];
foreach (explode(DEFAULTS["DELIMITER_ROLE"], $value) as $key) { foreach (explode(DEFAULTS["DELIMITER_ROLE"], $value) as $key) {
@ -312,7 +315,6 @@ class CommonHelper
break; break;
case 'updated_at': case 'updated_at':
case 'created_at': case 'created_at':
case 'manufactur_at':
$value = $value ? date("Y-m-d", strtotime($value)) : ""; $value = $value ? date("Y-m-d", strtotime($value)) : "";
break; break;
default: default:

View File

@ -0,0 +1,50 @@
<?php
namespace App\Helpers\Customer;
use App\Models\Customer\ServiceModel;
use CodeIgniter\HTTP\IncomingRequest;
class ServiceHelper extends CustomerHelper
{
protected ?IncomingRequest $request = null;
public function __construct(?IncomingRequest $request = null)
{
parent::__construct($request);
$this->setTitleField(field: ServiceModel::TITLE);
}
public function getFieldForm(string $field, mixed $value, array $viewDatas, array $extras = []): string
{
if (in_array($viewDatas['action'], ['create', 'modify'])) {
$extras = (strpos($viewDatas['field_rules'][$field], 'required') !== false) ? ["class" => "form-control", "required" => "", ...$extras] : ["class" => "form-control", ...$extras];
}
switch ($field) {
case 'payment_date':
case 'startdate_at':
case 'enddate_at':
$extra_class = isset($extras['class']) ? $extras['class'] . ' calender' : 'calender';
$form = form_input($field, $value ?? "", ['class' => $extra_class, ...array_diff_key($extras, ['class' => ''])]);
break;
default:
$form = parent::getFieldForm($field, $value, $viewDatas, $extras);
break;
}
return $form;
} //
public function getFieldView(string $field, array $viewDatas, array $extras = []): string
{
$value = $viewDatas['entity']->$field ?? "";
switch ($field) {
case 'payment_date':
case 'startdate_at':
case 'enddate_at':
$value = $value ? date("Y-m-d", strtotime($value)) : "";
break;
default:
$value = parent::getFieldView($field, $viewDatas, $extras);
break;
}
return $value;
}
}

View File

@ -27,14 +27,27 @@ class EquipmentHelper extends CommonHelper
); );
$form = form_dropdown($field, $formOptions, $value, $extras); $form = form_dropdown($field, $formOptions, $value, $extras);
break; break;
case 'manufactur_at':
$extra_class = isset($extras['class']) ? $extras['class'] . ' calender' : 'calender';
$form = form_input($field, $value ?? "", ['class' => $extra_class, ...array_diff_key($extras, ['class' => ''])]);
break;
default: default:
$form = parent::getFieldForm($field, $value, $viewDatas, $extras); $form = parent::getFieldForm($field, $value, $viewDatas, $extras);
break; break;
} }
return $form; return $form;
} // } //
public function getListRowColor(mixed $entity, string $field = 'status', string $value = 'use'): string public function getFieldView(string $field, array $viewDatas, array $extras = []): string
{ {
return $entity->isMatched($field, $value) ? "" : 'class="table-danger"'; $value = $viewDatas['entity']->$field ?? "";
switch ($field) {
case 'manufactur_at':
$value = $value ? date("Y-m-d", strtotime($value)) : "";
break;
default:
$value = parent::getFieldView($field, $viewDatas, $extras);
break;
}
return $value;
} }
} }

View File

@ -0,0 +1,29 @@
<?php
return [
'title' => "고객서비스정보",
'label' => [
'clientinfo_uid' => "고객명",
'type' => "종류",
'title' => "제목",
'payment_date' => "결제일",
'amount' => "결제금액",
'startdate_at' => "시작일",
'enddate_at' => "해지일",
'status' => "상태",
'updated_at' => "수정일",
'created_at' => "작성일",
],
'DEFAULTS' => [
'type' => "hosting",
'status' => "use"
],
"TYPE" => [
"hosting" => "서버호스팅",
"colocation" => "코로케이션",
],
"STATUS" => [
"use" => "사용중",
"pause" => "일시정지",
"terminated" => "해지",
],
];

View File

@ -20,7 +20,7 @@ return [
"defence" => "빙아", "defence" => "빙아",
], ],
"STATUS" => [ "STATUS" => [
"use" => "사용", "use" => "사용가능",
"pause" => "사용정지", "pause" => "사용정지",
"termination" => "해지", "termination" => "해지",
], ],

View File

@ -9,6 +9,7 @@ return [
'price' => "금액", 'price' => "금액",
'description' => "설명", 'description' => "설명",
'status' => "상태", 'status' => "상태",
'manufactur_at' => "제조일",
'updated_at' => "수정일", 'updated_at' => "수정일",
'created_at' => "작성일", 'created_at' => "작성일",
], ],
@ -24,7 +25,7 @@ return [
"colocation" => "코로케이션", "colocation" => "코로케이션",
], ],
"STATUS" => [ "STATUS" => [
"use" => "사용", "use" => "사용가능",
"pause" => "수리중", "pause" => "수리중",
"occupied" => "사용중", "occupied" => "사용중",
], ],

View File

@ -0,0 +1,31 @@
<?php
return [
'title' => "부품장비정보",
'label' => [
'clientinfo_uid' => "소유자명",
'type' => "종류",
'model' => "모델",
'capacity' => "용량/성능",
'price' => "금액",
'description' => "설명",
'status' => "상태",
'manufactur_at' => "제조일",
'updated_at' => "수정일",
'created_at' => "작성일",
],
'DEFAULTS' => [
'type' => 'CPU',
'status' => "use"
],
"TYPE" => [
"CPU" => "CPU",
"RAM" => "RAM",
"DISK" => "DISK",
"colocation" => "코로케이션",
],
"STATUS" => [
"use" => "사용가능",
"pause" => "수리중",
"occupied" => "사용중",
],
];

View File

@ -14,20 +14,17 @@ return [
'created_at' => "작성일", 'created_at' => "작성일",
], ],
'DEFAULTS' => [ 'DEFAULTS' => [
'type' => 'L2', 'type' => 'RacKMount',
'status' => "use" 'status' => "use"
], ],
"TYPE" => [ "TYPE" => [
"normal" => "일반", "Rack" => "RacKMount",
"kcs" => "KCS", "PC" => "조립PC",
"vpc" => "VPC", "MiniPC" => "MiniPC",
"jcs" => "JCS",
"VPN" => "VPN",
"defence" => "방어",
"colocation" => "코로케이션", "colocation" => "코로케이션",
], ],
"STATUS" => [ "STATUS" => [
"use" => "사용", "use" => "사용가능",
"pause" => "수리중", "pause" => "수리중",
"occupied" => "사용중", "occupied" => "사용중",
], ],

View File

@ -0,0 +1,28 @@
<?php
return [
'title' => "소프트웨어정보",
'label' => [
'type' => "종류",
'model' => "모델",
'price' => "금액",
'description' => "설명",
'status' => "상태",
'updated_at' => "수정일",
'created_at' => "작성일",
],
'DEFAULTS' => [
'type' => 'Windows',
'status' => "use"
],
"TYPE" => [
"Windows" => "Windows OS",
"Linux" => "Linux OS",
"Security" => "보안용",
"Virus" => "바이러스용",
"App" => "어플리케이션",
],
"STATUS" => [
"use" => "사용가능",
"occupied" => "사용중",
],
];

View File

@ -0,0 +1,64 @@
<?php
namespace App\Models\Customer;
use App\Entities\Customer\ServiceEntity;
class ServiceModel extends CustomerModel
{
const TABLE = "serviceinfo";
const PK = "uid";
const TITLE = "title";
protected $table = self::TABLE;
protected $primaryKey = self::PK;
protected $returnType = ServiceEntity::class;
protected $allowedFields = [
"clientinfo_uid",
"type",
"title",
"payment_date",
"amount",
"startdate_at",
"enddate_at",
"status",
"updated_at"
];
public function __construct()
{
parent::__construct();
}
public function getFieldRule(string $action, string $field): string
{
if (is_array($field)) {
throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true));
}
switch ($field) {
case "clientinfo_uid":
$rule = "required|numeric";
break;
case "amount":
$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]";
break;
case "payment_date":
$rule = "required|valid_date";
break;
case "startdate_at":
case "enddate_at":
case "deleted_at":
$rule = "if_exist|valid_date";
default:
$rule = parent::getFieldRule($action, $field);
break;
}
return $rule;
}
}

View File

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

View File

@ -8,15 +8,20 @@ class PartModel extends EquipmentModel
{ {
const TABLE = "partinfo"; const TABLE = "partinfo";
const PK = "uid"; const PK = "uid";
const TITLE = "title"; const TITLE = "model";
protected $table = self::TABLE; protected $table = self::TABLE;
protected $primaryKey = self::PK; protected $primaryKey = self::PK;
protected $returnType = PartEntity::class; protected $returnType = PartEntity::class;
protected $allowedFields = [ protected $allowedFields = [
"clientinfo_uid", "clientinfo_uid",
"code",
"type",
"model",
"manufactur_at",
"capacity",
"price",
"status", "status",
"title", "description",
"amount",
"updated_at" "updated_at"
]; ];
public function __construct() public function __construct()
@ -30,14 +35,27 @@ class PartModel extends EquipmentModel
} }
switch ($field) { switch ($field) {
case "clientinfo_uid": case "clientinfo_uid":
case "amount": $rule = "if_exist|numeric";
break;
case "capacity":
case "price":
$rule = "required|numeric"; $rule = "required|numeric";
break; break;
case "title": case "code":
case "model":
$rule = "required|trim|string"; $rule = "required|trim|string";
break; break;
case "type":
$rule = "required|in_list[CPU,RAM,DISK,colocation]";
break;
case "manufactur_at":
$rule = "required|valid_date";
break;
case "status": case "status":
$rule = "required|in_list[in,out]"; $rule = "required|in_list[use,pause,occupied]";
break;
case "description":
$rule = "if_exist|trim|string";
break; break;
default: default:
$rule = parent::getFieldRule($action, $field); $rule = parent::getFieldRule($action, $field);

View File

@ -44,7 +44,10 @@ class ServerModel extends EquipmentModel
$rule = "required|trim|string"; $rule = "required|trim|string";
break; break;
case "type": case "type":
$rule = "required|in_list[normal,kcs,vpc,jcs,vpn,defence,clocation]"; $rule = "required|in_list[Rack,PC,MiniPC,clocation]";
break;
case "manufactur_at":
$rule = "required|valid_date";
break; break;
case "status": case "status":
$rule = "required|in_list[use,pause,occupied]"; $rule = "required|in_list[use,pause,occupied]";
@ -52,9 +55,6 @@ class ServerModel extends EquipmentModel
case "description": case "description":
$rule = "if_exist|trim|string"; $rule = "if_exist|trim|string";
break; break;
case "manufactur_at":
$rule = "required|valid_date";
break;
default: default:
$rule = parent::getFieldRule($action, $field); $rule = parent::getFieldRule($action, $field);
break; break;

View File

@ -6,17 +6,19 @@ use App\Entities\Equipment\SoftwareEntity;
class SoftwareModel extends EquipmentModel class SoftwareModel extends EquipmentModel
{ {
const TABLE = "serverinfo"; const TABLE = "softwareinfo";
const PK = "uid"; const PK = "uid";
const TITLE = "title"; const TITLE = "model";
protected $table = self::TABLE; protected $table = self::TABLE;
protected $primaryKey = self::PK; protected $primaryKey = self::PK;
protected $returnType = SoftwareEntity::class; protected $returnType = SoftwareEntity::class;
protected $allowedFields = [ protected $allowedFields = [
"clientinfo_uid", "clientinfo_uid",
"type",
"model",
"price",
"status", "status",
"title", "description",
"amount",
"updated_at" "updated_at"
]; ];
public function __construct() public function __construct()
@ -29,15 +31,20 @@ class SoftwareModel extends EquipmentModel
throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true)); throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true));
} }
switch ($field) { switch ($field) {
case "clientinfo_uid": case "price":
case "amount":
$rule = "required|numeric"; $rule = "required|numeric";
break; break;
case "title": case "model":
$rule = "required|trim|string"; $rule = "required|trim|string";
break; break;
case "type":
$rule = "required|in_list[Windows,Linux,Security,Virus,App]";
break;
case "status": case "status":
$rule = "required|in_list[in,out]"; $rule = "required|in_list[use,occupied]";
break;
case "description":
$rule = "if_exist|trim|string";
break; break;
default: default:
$rule = parent::getFieldRule($action, $field); $rule = parent::getFieldRule($action, $field);

View File

@ -41,11 +41,11 @@ class LocalService extends AuthService
public function checkUser(array $formDatas): UserEntity public function checkUser(array $formDatas): UserEntity
{ {
$entity = $this->getEntity(['id' => $formDatas['id']]); $entity = $this->getEntity(['id' => $formDatas['id'], 'status' => 'use']);
if (is_null($entity) || !isset($entity->passwd)) { if (is_null($entity)) {
throw new \Exception("사용자ID: {$formDatas['id']}가 존재하지 않습니다."); throw new \Exception("사용자ID: {$formDatas['id']}가 존재하지 않습니다.");
} }
if (!password_verify($formDatas['passwd'], $entity->passwd)) { if (!password_verify($formDatas['passwd'], $entity->getPassword())) {
// log_message("error", "암호: {$formDatas['passwd']}, {$entity->passwd}"); // log_message("error", "암호: {$formDatas['passwd']}, {$entity->passwd}");
throw new \Exception("암호가 맞지 않습니다."); throw new \Exception("암호가 맞지 않습니다.");
} }

View File

@ -0,0 +1,49 @@
<?php
namespace App\Services\Customer;
use App\Entities\Customer\ServiceEntity;
use App\Models\Customer\ServiceModel;
use CodeIgniter\HTTP\IncomingRequest;
class ServiceService extends CustomerService
{
protected ?IncomingRequest $request = null;
public function __construct(?IncomingRequest $request = null)
{
parent::__construct($request);
}
public function getClassName(): string
{
return parent::getClassName() . DIRECTORY_SEPARATOR . "Service";
}
public function getModelClass(): ServiceModel
{
return new ServiceModel();
}
public function getEntityClass(): ServiceEntity
{
return new ServiceEntity();
}
public function getFields(): array
{
return [
"clientinfo_uid",
"type",
"title",
"payment_date",
"amount",
"startdate_at",
"enddate_at",
"status",
];
}
public function getFilterFields(): array
{
return ["clientinfo_uid", 'type', 'status'];
}
public function getBatchJobFields(): array
{
return ['type', 'status'];
}
}

View File

@ -32,6 +32,7 @@ class NetworkService extends EquipmentService
"code", "code",
"type", "type",
"model", "model",
"manufactur_at",
"price", "price",
"status", "status",
"description", "description",
@ -43,6 +44,6 @@ class NetworkService extends EquipmentService
} }
public function getBatchJobFields(): array public function getBatchJobFields(): array
{ {
return ["clientinfo_uid", "type", 'status']; return ["type", 'status'];
} }
} }

View File

@ -5,6 +5,7 @@ namespace App\Services\Equipment;
use App\Entities\Equipment\PartEntity; use App\Entities\Equipment\PartEntity;
use App\Models\Equipment\PartModel; use App\Models\Equipment\PartModel;
use CodeIgniter\HTTP\IncomingRequest; 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 PartService extends EquipmentService class PartService extends EquipmentService
{ {
@ -29,17 +30,21 @@ class PartService extends EquipmentService
{ {
return [ return [
"clientinfo_uid", "clientinfo_uid",
"type",
"model",
"manufactur_at",
"capacity",
"price",
"status", "status",
"title", "description",
"amount",
]; ];
} }
public function getFilterFields(): array public function getFilterFields(): array
{ {
return ["clientinfo_uid", 'status']; return ["clientinfo_uid", "type", 'status'];
} }
public function getBatchJobFields(): array public function getBatchJobFields(): array
{ {
return ['status']; return ['type', 'status'];
} }
} }

View File

@ -45,6 +45,6 @@ class ServerService extends EquipmentService
} }
public function getBatchJobFields(): array public function getBatchJobFields(): array
{ {
return ["clientinfo_uid", 'type', 'status']; return ['type', 'status'];
} }
} }

View File

@ -28,18 +28,19 @@ class SoftwareService extends EquipmentService
public function getFields(): array public function getFields(): array
{ {
return [ return [
"clientinfo_uid", "type",
"model",
"price",
"status", "status",
"title", "description",
"amount",
]; ];
} }
public function getFilterFields(): array public function getFilterFields(): array
{ {
return ["clientinfo_uid", 'status']; return ['type', 'status'];
} }
public function getBatchJobFields(): array public function getBatchJobFields(): array
{ {
return ['status']; return ['type', 'status'];
} }
} }

View File

@ -17,6 +17,9 @@
<div class="accordion-item"> <div class="accordion-item">
<a href="/admin/customer/point"><?= ICONS['FLAG'] ?> Point내역</a> <a href="/admin/customer/point"><?= ICONS['FLAG'] ?> Point내역</a>
</div> </div>
<div class="accordion-item">
<a href="/admin/customer/service"><?= ICONS['CARD'] ?> 서비스내역</a>
</div>
<div class="accordion-item"> <div class="accordion-item">
<a href="/admin/customer/invoice"><?= ICONS['CARD'] ?> 청구내역</a> <a href="/admin/customer/invoice"><?= ICONS['CARD'] ?> 청구내역</a>
</div> </div>

View File

@ -25,4 +25,10 @@ div.action_form table td {
/* 자동 줄바꿈 */ /* 자동 줄바꿈 */
} }
/* create,modify,view 페이지용 */ /* create,modify,view 페이지용 */
/*Form 안에서 datepicker 사용시*/
/* datepicker의 z-index를 높여서 다른 요소 위에 표시되도록 설정 tinyMCE와 겹치는 문제 처리용용*/
.ui-datepicker {
z-index: 9999 !important;
}

View File

@ -25,4 +25,10 @@ div.action_form table td {
/* 자동 줄바꿈 */ /* 자동 줄바꿈 */
} }
/* create,modify,view 페이지용 */ /* create,modify,view 페이지용 */
/*Form 안에서 datepicker 사용시*/
/* datepicker의 z-index를 높여서 다른 요소 위에 표시되도록 설정 tinyMCE와 겹치는 문제 처리용용*/
.ui-datepicker {
z-index: 9999 !important;
}