dbms_init...1

This commit is contained in:
최준흠 2025-06-05 19:07:27 +09:00
parent 903160e124
commit 6ea19c18c5
67 changed files with 667 additions and 734 deletions

View File

@ -136,7 +136,6 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au
});
$routes->group('domain', ['namespace' => 'App\Controllers\Admin\Equipment'], function ($routes) {
$routes->get('/', 'DomainController::index', []);
$routes->get('popup', 'DomainController::popup', []);
$routes->get('create', 'DomainController::create_form');
$routes->post('create', 'DomainController::create');
$routes->get('modify/(:num)', 'DomainController::modify_form/$1');

View File

@ -3,13 +3,14 @@
namespace App\Controllers\Admin\Customer;
use App\Entities\Customer\AccountEntity;
use App\Entities\Customer\ClientEntity;
use App\Helpers\Customer\AccountHelper;
use App\Services\Customer\AccountService;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
use App\Helpers\Customer\AccountHelper;
use App\Services\Customer\AccountService;
class AccountController extends CustomerController
{
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
@ -37,23 +38,25 @@ class AccountController extends CustomerController
}
//Index,FieldForm관련.
protected function create_process(): AccountEntity
private function setAccountBalance(array $formDatas): ClientEntity
{
//account_balance 체크
$clientEntity = $this->getClientService()->getEntity($this->formDatas['clientinfo_uid']);
//입금
$amount = intval($this->formDatas['amount']);
if ($this->formDatas['status'] === DEFAULTS['STATUS']) {
if ($amount < 0) {
throw new \Exception("입금액이 0보다 작습니다.");
$entity = $this->getClientService()->getEntity($formDatas['clientinfo_uid']);
$amount = intval($formDatas['amount']);
if ($formDatas['status'] === DEFAULTS['STATUS']) { //입금, 쿠폰추가
$entity = $this->getClientService()->deposit($entity, 'account_balance', $amount);
} else { // 출금, 쿠폰사용
$entity = $this->getClientService()->withdrawal($entity, 'account_balance', $amount);
}
$this->getClientService()->modify($clientEntity, ['account_balance' => $clientEntity->getAccountBalance() + $amount]);
} else { // 출금
if ($clientEntity->getAccountBalance() < $amount) {
throw new \Exception("예치금:{$clientEntity->getAccountBalance()} < 출금액:{$amount} 출금이 불가합니다.");
return $entity;
}
$this->getClientService()->modify($clientEntity, ['account_balance' => $clientEntity->getAccountBalance() - $amount]);
}
return parent::create_process();
protected function create_process(string $action, array $fields, array $formDatas = []): AccountEntity
{
//데이터 검증
$formDatas = $this->doValidate($action, $fields, $formDatas);
$entity = $this->getService()->create($formDatas);
//고객예치금처리
$this->setAccountBalance($formDatas);
return $entity;
}
}

View File

@ -39,7 +39,7 @@ class ClientController extends CustomerController
return $this->_helper;
}
//Index,FieldForm관련
protected function setValidation(Validation $validation, string $action, string $field, ?string $rule = null): Validation
protected function setValidation(Validation $validation, string $action, string $field, string $rule): Validation
{
switch ($field) {
case 'role':
@ -53,22 +53,4 @@ class ClientController extends CustomerController
return $validation;
}
//Index,FieldForm관련.
//View관련
protected function view_process($uid): mixed
{
$fields = [
'fields' => ['name', 'email', 'phone', 'role', 'account_balance', 'coupon_balance', 'point_balance', 'status'],
];
$this->init('view', $fields);
return parent::view_process($uid);
}
protected function index_process(): array
{
$fields = [
'fields' => ['name', 'email', 'phone', 'role', 'account_balance', 'coupon_balance', 'point_balance', 'status'],
];
$this->init('index', $fields);
return parent::index_process();
}
}

View File

@ -2,10 +2,11 @@
namespace App\Controllers\Admin\Customer;
use App\Entities\Customer\ClientEntity;
use App\Entities\Customer\CouponEntity;
use App\Helpers\Customer\CouponHelper;
use App\Services\Customer\CouponService;
use App\Services\Customer\CouponService;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
@ -36,23 +37,25 @@ class CouponController extends CustomerController
return $this->_helper;
}
//Index,FieldForm관련.
protected function create_process(): CouponEntity
private function setCouponBalance(array $formDatas): ClientEntity
{
//coupon_balance 체크
$clientEntity = $this->getClientService()->getEntity($this->formDatas['clientinfo_uid']);
//입금
$amount = intval($this->formDatas['amount']);
if ($this->formDatas['status'] === DEFAULTS['STATUS']) {
if ($amount < 0) {
throw new \Exception("쿠폰이 0보다 작습니다.");
$entity = $this->getClientService()->getEntity($formDatas['clientinfo_uid']);
$amount = intval($formDatas['amount']);
if ($formDatas['status'] === DEFAULTS['STATUS']) { //입금, 쿠폰추가
$entity = $this->getClientService()->deposit($entity, 'coupon_balance', $amount);
} else { // 출금, 쿠폰사용
$entity = $this->getClientService()->withdrawal($entity, 'coupon_balance', $amount);
}
$this->getClientService()->modify($clientEntity, ['coupon_balance' => $clientEntity->getCouponBalance() + $amount]);
} else { // 출금
if ($clientEntity->getCouponBalance() < $amount) {
throw new \Exception("쿠폰수:{$clientEntity->getCouponBalance()} < 사용수:{$amount} 쿠폰사용이 불가합니다.");
return $entity;
}
$this->getClientService()->modify($clientEntity, ['coupon_balance' => $clientEntity->getCouponBalance() - $amount]);
}
return parent::create_process();
protected function create_process(string $action, array $fields, array $formDatas = []): CouponEntity
{
//데이터 검증
$formDatas = $this->doValidate($action, $fields, $formDatas);
$entity = $this->getService()->create($formDatas);
//고객쿠폰처리
$this->setCouponBalance($formDatas);
return $entity;
}
}

View File

@ -3,14 +3,25 @@
namespace App\Controllers\Admin\Customer;
use App\Controllers\Admin\AdminController;
use App\Services\Customer\ClientService;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
use App\Services\Customer\ClientService;
use App\Services\Equipment\Part\CpuService;
use App\Services\Equipment\Part\DefenceService;
use App\Services\Equipment\Part\StorageService;
use App\Services\Equipment\Part\IpService;
use App\Services\Equipment\Part\LINEService;
use App\Services\Equipment\Part\RamService;
use App\Services\Equipment\Part\SoftwareService;
use App\Services\Equipment\ServerService;
use App\Services\Equipment\DomainService;
abstract class CustomerController extends AdminController
{
private ?ClientService $_clientService = null;
private $_equipmentService = [];
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
@ -23,7 +34,44 @@ abstract class CustomerController extends AdminController
}
return $this->_clientService;
}
protected function getFormFieldOption(string $field, array $options): array
final public function getEquipmentService(string $key): mixed
{
if (!array_key_exists($key, $this->_equipmentService)) {
switch ($key) {
case 'SERVER':
$this->_equipmentService[$key] = new ServerService();
break;
case 'CPU':
$this->_equipmentService[$key] = new CpuService();
break;
case 'RAM':
$this->_equipmentService[$key] = new RamService();
break;
case 'STORAGE':
$this->_equipmentService[$key] = new StorageService();
break;
case 'LINE':
$this->_equipmentService[$key] = new LineService();
break;
case 'IP':
$this->_equipmentService[$key] = new IpService();
break;
case 'DEFENCE':
$this->_equipmentService[$key] = new DefenceService();
break;
case 'SOFTWARE':
$this->_equipmentService[$key] = new SoftwareService();
break;
case 'DOMAIN':
$this->_equipmentService[$key] = new DomainService();
break;
default:
throw new \Exception(__FUNCTION__ . "에서 사용하지않는 Service를 요청하였습니다.: {$key}");
}
}
return $this->_equipmentService[$key];
}
protected function getFormFieldOption(string $field, array $options = []): array
{
switch ($field) {
case 'clientinfo_uid':
@ -32,7 +80,22 @@ abstract class CustomerController extends AdminController
$temps[$entity->getPK()] = $entity->getTitle();
}
$options[$field] = $temps;
// dd($options);
break;
case 'SERVER':
case 'CPU':
case 'RAM':
case 'STORAGE':
case 'LINE':
case 'IP':
case 'DEFENCE':
case 'SOFTWARE':
case 'DOMAIN':
$temps = [];
// throw new \Exception(__FUNCTION__ . "에서 item_type이 지정되지 않았습니다.->{$item_type}");
foreach ($this->getEquipmentService($field)->getEntities() as $entity) {
$temps[$entity->getPK()] = $entity->getTitle();
}
$options[$field] = $temps;
break;
default:
$options = parent::getFormFieldOption($field, $options);

View File

@ -2,10 +2,11 @@
namespace App\Controllers\Admin\Customer;
use App\Entities\Customer\ClientEntity;
use App\Entities\Customer\PointEntity;
use App\Helpers\Customer\PointHelper;
use App\Services\Customer\PointService;
use App\Services\Customer\PointService;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
@ -37,23 +38,25 @@ class PointController extends CustomerController
}
//Index,FieldForm관련.
protected function create_process(): PointEntity
private function setPointBalance(array $formDatas): ClientEntity
{
//point_balance 체크
$clientEntity = $this->getClientService()->getEntity($this->formDatas['clientinfo_uid']);
//입금
$amount = intval($this->formDatas['amount']);
if ($this->formDatas['status'] === DEFAULTS['STATUS']) {
if ($amount < 0) {
throw new \Exception("포인트금액이 0보다 작습니다.");
$entity = $this->getClientService()->getEntity($formDatas['clientinfo_uid']);
$amount = intval($formDatas['amount']);
if ($formDatas['status'] === DEFAULTS['STATUS']) { //입금, 쿠폰추가
$entity = $this->getClientService()->deposit($entity, 'point_balance', $amount);
} else { // 출금, 쿠폰사용
$entity = $this->getClientService()->withdrawal($entity, 'point_balance', $amount);
}
$this->getClientService()->modify($clientEntity, ['point_balance' => $clientEntity->getPointBalance() + $amount]);
} else { // 출금
if ($clientEntity->getPointBalance() < $amount) {
throw new \Exception("포인트금액:{$clientEntity->getPointBalance()} < 사용금액:{$amount} 포인트사용이 불가합니다.");
return $entity;
}
$this->getClientService()->modify($clientEntity, ['point_balance' => $clientEntity->getPointBalance() - $amount]);
}
return parent::create_process();
protected function create_process(string $action, array $fields, array $formDatas = []): PointEntity
{
//데이터 검증
$formDatas = $this->doValidate($action, $fields, $formDatas);
$entity = $this->getService()->create($formDatas);
//고객포인트처리
$this->setPointBalance($formDatas);
return $entity;
}
}

View File

@ -7,16 +7,6 @@ use App\Services\Customer\ServiceService;
use App\Services\Customer\ServiceItemService;
use App\Services\Equipment\Part\CpuService;
use App\Services\Equipment\Part\DefenceService;
use App\Services\Equipment\Part\StorageService;
use App\Services\Equipment\Part\IpService;
use App\Services\Equipment\Part\LINEService;
use App\Services\Equipment\Part\RamService;
use App\Services\Equipment\Part\SoftwareService;
use App\Services\Equipment\ServerService;
use App\Services\Equipment\DomainService;
use CodeIgniter\HTTP\RedirectResponse;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
@ -24,7 +14,6 @@ use Psr\Log\LoggerInterface;
class ServiceController extends CustomerController
{
private $_equipmentService = [];
private ?ServiceItemService $_serviceItemService = null;
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
@ -47,7 +36,6 @@ class ServiceController extends CustomerController
if (!$this->_helper) {
$this->_helper = new ServiceHelper($this->request);
}
// dd($this->_helper);
return $this->_helper;
}
public function getServiceItemService(): ServiceItemService
@ -57,70 +45,6 @@ class ServiceController extends CustomerController
}
return $this->_serviceItemService;
}
final public function getEquipmentService(string $key): mixed
{
if (!array_key_exists($key, $this->_equipmentService)) {
switch ($key) {
case 'SERVER':
$this->_equipmentService[$key] = new ServerService();
break;
case 'CPU':
$this->_equipmentService[$key] = new CpuService();
break;
case 'RAM':
$this->_equipmentService[$key] = new RamService();
break;
case 'STORAGE':
$this->_equipmentService[$key] = new StorageService();
break;
case 'LINE':
$this->_equipmentService[$key] = new LineService();
break;
case 'IP':
$this->_equipmentService[$key] = new IpService();
break;
case 'DEFENCE':
$this->_equipmentService[$key] = new DefenceService();
break;
case 'SOFTWARE':
$this->_equipmentService[$key] = new SoftwareService();
break;
case 'DOMAIN':
$this->_equipmentService[$key] = new DomainService();
break;
default:
throw new \Exception(__FUNCTION__ . "에서 사용하지않는 Service를 요청하였습니다.: {$key}");
}
}
return $this->_equipmentService[$key];
}
protected function getFormFieldOption(string $field, array $options): array
{
switch ($field) {
case 'SERVER':
case 'CPU':
case 'RAM':
case 'STORAGE':
case 'LINE':
case 'IP':
case 'DEFENCE':
case 'SOFTWARE':
case 'DOMAIN':
$temps = [];
// throw new \Exception(__FUNCTION__ . "에서 item_type이 지정되지 않았습니다.->{$item_type}");
foreach ($this->getEquipmentService($field)->getEntities() as $entity) {
$temps[$entity->getPK()] = $entity->getTitle();
}
$options[$field] = $temps;
// dd($options);
break;
default:
$options = parent::getFormFieldOption($field, $options);
break;
}
return $options;
}
protected function getResultPageByActon(string $action, string $message = MESSAGES["SUCCESS"]): RedirectResponse|string
{
switch ($action) {
@ -135,23 +59,17 @@ class ServiceController extends CustomerController
return $result;
}
//Index,FieldForm관련
protected function index_process(): array
protected function index_process(string $action, array $fields): array
{
$fields = [
'fields' => ['clientinfo_uid', 'location', 'switch', 'code', 'type', 'raid', 'billing_at', 'start_at', 'status'],
];
$this->init('index', $fields);
//추가 Field작업 처리
$this->item_types = lang($this->getServiceItemService()->getClassName() . '.' . strtoupper('ITEM_TYPE'));
foreach ($this->item_types as $field => $label) {
$this->field_options = $this->getFormFieldOption($field, $this->field_options);
}
// dd($this->field_options);
$entities = [];
foreach (parent::index_process() as $entity) {
foreach (parent::index_process($action, $fields) as $entity) {
foreach ($this->item_types as $field => $label) {
$itemEntities = $this->getServiceItemService()->getEntities(['item_type' => $field]);
// dd($itemEntities);
$entity->setItemEntities($field, $itemEntities);
}
$entities[] = $entity;

View File

@ -2,25 +2,15 @@
namespace App\Controllers\Admin\Customer;
use App\Helpers\Customer\ServiceItemHelper;
use App\Services\Customer\ServiceItemService;
use App\Services\Customer\ServiceService;
use App\Services\Equipment\Part\CpuService;
use App\Services\Equipment\Part\DefenceService;
use App\Services\Equipment\Part\StorageService;
use App\Services\Equipment\Part\IpService;
use App\Services\Equipment\Part\LINEService;
use App\Services\Equipment\Part\RamService;
use App\Services\Equipment\Part\SoftwareService;
use App\Services\Equipment\ServerService;
use App\Services\Equipment\DomainService;
use CodeIgniter\HTTP\RedirectResponse;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
use App\Helpers\Customer\ServiceItemHelper;
use App\Services\Customer\ServiceItemService;
use App\Services\Customer\ServiceService;
class ServiceItemController extends CustomerController
{
private ?ServiceService $_serviceService = null;
@ -46,7 +36,6 @@ class ServiceItemController extends CustomerController
if (!$this->_helper) {
$this->_helper = new ServiceItemHelper($this->request);
}
// dd($this->_helper);
return $this->_helper;
}
public function getServiceService(): ServiceService
@ -56,44 +45,8 @@ class ServiceItemController extends CustomerController
}
return $this->_serviceService;
}
final public function getEquipmentService(string $key): mixed
{
if (!array_key_exists($key, $this->_equipmentService)) {
switch ($key) {
case 'SERVER':
$this->_equipmentService[$key] = new ServerService();
break;
case 'CPU':
$this->_equipmentService[$key] = new CpuService();
break;
case 'RAM':
$this->_equipmentService[$key] = new RamService();
break;
case 'STORAGE':
$this->_equipmentService[$key] = new StorageService();
break;
case 'LINE':
$this->_equipmentService[$key] = new LineService();
break;
case 'IP':
$this->_equipmentService[$key] = new IpService();
break;
case 'DEFENCE':
$this->_equipmentService[$key] = new DefenceService();
break;
case 'SOFTWARE':
$this->_equipmentService[$key] = new SoftwareService();
break;
case 'DOMAIN':
$this->_equipmentService[$key] = new DomainService();
break;
default:
throw new \Exception(__FUNCTION__ . "에서 사용하지않는 Service를 요청하였습니다.: {$key}");
}
}
return $this->_equipmentService[$key];
}
protected function getFormFieldOption(string $field, array $options): array
protected function getFormFieldOption(string $field, array $options = []): array
{
switch ($field) {
case 'serviceinfo_uid':
@ -102,7 +55,6 @@ class ServiceItemController extends CustomerController
$temps[$entity->getPK()] = $entity->getTitle();
}
$options[$field] = $temps;
// dd($options);
break;
case 'item_uid':
$temps = [];
@ -115,7 +67,6 @@ class ServiceItemController extends CustomerController
$temps[$entity->getPK()] = $entity->getTitle();
}
$options[$field] = $temps;
// dd($options);
break;
default:
$options = parent::getFormFieldOption($field, $options);
@ -137,31 +88,19 @@ class ServiceItemController extends CustomerController
return $result;
}
//Index,FieldForm관련
protected function create_process(): mixed
protected function create_process(string $action, array $fields, array $formDatas = []): mixed
{
// dd($this->formDatas);
if (!array_key_exists('item_type', $this->formDatas) || !$this->formDatas['item_type']) {
throw new \Exception(__METHOD__ . "에서 item_type이 지정되지 않았습니다.");
$this->field_rules = $this->getFieldRules($action, $fields);
//데이터 검증
$validatedFormDatas = $this->doValidate($action, $fields, $formDatas);
//도메인의 경우 domaininfo에 등록 후 ItemEntity의 item_uid에 넣어줘야함
if ($validatedFormDatas['item_type'] === 'DOMAIN') {
$serviceEntity = $this->getServiceService()->getEntity($validatedFormDatas['serviceinfo_uid']);
$tempDatas = ['clientinfo_uid' => $serviceEntity->getClientInfoUID(), 'domain' => $validatedFormDatas['item_uid']];
$equipmentEntity = $this->getEquipmentService($validatedFormDatas['item_type'])->create($tempDatas);
//도메인용 항목의 item_uid로 전달함
$validatedFormDatas['item_uid'] = $equipmentEntity->getPK();
}
if (!array_key_exists('item_uid', $this->formDatas) || !$this->formDatas['item_uid']) {
throw new \Exception(__METHOD__ . "에서 item_uid가가 지정되지 않았습니다.");
}
$equipmentEntity = $this->getEquipmentService($this->formDatas['item_type'])->getEntity($this->formDatas['item_uid']);
if (!$equipmentEntity) {
throw new \Exception(__METHOD__ . "에서 equipmentEntity 정보가 확인되지 않습니다.");
}
//각 항목의 Price를 Item Price로 전달함
$formDatas = $this->formDatas;
$formDatas['price'] = $equipmentEntity->getPrice();
$this->formDatas = $formDatas;
return parent::create_process();
}
protected function index_process(): array
{
$fields = [
'fields' => ['serviceinfo_uid', 'item_type', 'item_uid', 'billing_cycle', 'price', 'amount', 'start_at', 'status'],
];
$this->init('index', $fields);
return parent::index_process();
return $this->getService()->create($validatedFormDatas);
}
}

View File

@ -35,19 +35,6 @@ class DomainController extends EquipmentController
}
return $this->_helper;
}
protected function getResultPageByActon(string $action, string $message = MESSAGES["SUCCESS"]): RedirectResponse|string
{
echo "TEST:{$action}";
switch ($action) {
case 'popup':
// $this->getHelper()->setViewDatas($this->getViewDatas());
$result = view($this->view_path . 'popup' . DIRECTORY_SEPARATOR . 'index', ['viewDatas' => $this->getViewDatas()]);
break;
default:
$result = parent::getResultPageByActon($action, $message);
}
return $result;
}
//Index,FieldForm관련
protected function setOrderByForList(): void
@ -56,27 +43,4 @@ class DomainController extends EquipmentController
$this->getService()->getModel()->orderBy('domain', 'ASC', false);
parent::setOrderByForList();
}
protected function index_process(): array
{
$fields = [
'fields' => ['clientinfo_uid', 'domain', 'status'],
];
$this->init('index', $fields);
return parent::index_process();
}
public function popup(): RedirectResponse|string
{
try {
// 현재 URL을 스택에 저장
$this->getMyAuth()->pushCurrentUrl($this->request->getUri()->getPath() . ($this->request->getUri()->getQuery() ? "?" . $this->request->getUri()->getQuery() : ""));
helper(['form']);
$this->init(__FUNCTION__, ['fields' => ['clientinfo_uid', 'domain', 'price', 'status'],]);
$this->entities = parent::index_process();
return $this->getResultPageByActon($this->action);
} catch (\Exception $e) {
return redirect()->back()->withInput()->with('error', $e->getMessage());
}
}
}

View File

@ -32,7 +32,6 @@ abstract class EquipmentController extends AdminController
$temps[$entity->getPK()] = $entity->getTitle();
}
$options[$field] = $temps;
// dd($options);
break;
default:
$options = parent::getFormFieldOption($field, $options);

View File

@ -41,12 +41,4 @@ class CpuController extends PartController
$this->getService()->getModel()->orderBy('model', 'ASC', false);
parent::setOrderByForList();
}
protected function index_process(): array
{
$fields = [
'fields' => ['model', 'status'],
];
$this->init('index', $fields);
return parent::index_process();
}
}

View File

@ -42,13 +42,4 @@ class DefenceController extends PartController
$this->getService()->getModel()->orderBy('INET_ATON(ip)', 'ASC', false);
parent::setOrderByForList();
}
protected function index_process(): array
{
$fields = [
'fields' => ['type', 'ip', 'accountid', 'domain', 'status'],
];
$this->init('index', $fields);
return parent::index_process();
}
}

View File

@ -67,13 +67,4 @@ class IpController extends PartController
$this->getService()->getModel()->orderBy('INET_ATON(ip)', 'ASC', false);
parent::setOrderByForList();
}
protected function index_process(): array
{
$fields = [
'fields' => ['lineinfo_uid', 'ip', 'status'],
];
$this->init('index', $fields);
return parent::index_process();
}
}

View File

@ -48,35 +48,19 @@ class LineController extends PartController
//Index,FieldForm관련
//생성
protected function create_process(): LineEntity
protected function create_process(string $action, array $fields, array $formDatas = []): LineEntity
{
//Line 등록
if (!$this->getHelper()->isValidCIDR($this->formDatas['bandwith'])) {
throw new \Exception("{$this->formDatas['bandwith']}는 CIDR 형식에 부합되지 않습니다.");
}
$entity = parent::create_process();
//데이터 검증
$validatedFormDatas = $this->doValidate($action, $fields, $formDatas);
return $this->getService()->create($validatedFormDatas);
//IP 등록
foreach ($this->getHelper()->cidrToIpRange($this->formDatas['bandwith']) as $ip) {
$this->getIpService()->createByLineInfo($entity, $ip);
}
return $entity;
}
protected function view_process($uid): mixed
{
$fields = [
'fields' => ['clientinfo_uid', 'type', 'title', 'bandwith', 'status', "start_at"],
];
$this->init('view', $fields);
return parent::view_process($uid);
}
protected function index_process(): array
{
$fields = [
'fields' => ['clientinfo_uid', 'type', 'title', 'bandwith', 'status', "start_at"],
];
$this->init('index', $fields);
return parent::index_process();
}
}

View File

@ -41,12 +41,4 @@ class RamController extends PartController
$this->getService()->getModel()->orderBy('model', 'ASC', false);
parent::setOrderByForList();
}
protected function index_process(): array
{
$fields = [
'fields' => ['model', 'status'],
];
$this->init('index', $fields);
return parent::index_process();
}
}

View File

@ -42,12 +42,4 @@ class SoftwareController extends PartController
$this->getService()->getModel()->orderBy('model', 'ASC', false);
parent::setOrderByForList();
}
protected function index_process(): array
{
$fields = [
'fields' => ['type', 'model', 'status'],
];
$this->init('index', $fields);
return parent::index_process();
}
}

View File

@ -41,12 +41,4 @@ class StorageController extends PartController
$this->getService()->getModel()->orderBy('model', 'ASC', false);
parent::setOrderByForList();
}
protected function index_process(): array
{
$fields = [
'fields' => ['model', 'status'],
];
$this->init('index', $fields);
return parent::index_process();
}
}

View File

@ -41,13 +41,4 @@ class ServerController extends EquipmentController
$this->getService()->getModel()->orderBy('model', 'ASC', false);
parent::setOrderByForList();
}
protected function index_process(): array
{
$fields = [
'fields' => ['clientinfo_uid', 'model', 'status'],
];
$this->init('index', $fields);
// $this->modal_type = 'modal_fetch_v2'; //기본은 modal_iframe임
return parent::index_process();
}
}

View File

@ -63,23 +63,4 @@ class MyLogController extends AdminController
return $options;
}
//Index,FieldForm관련
//View관련
protected function view_process($uid): mixed
{
$fields = [
'fields' => ['user_uid', 'class_name', 'method_name', 'title', 'status', 'created_at', 'content'],
];
$this->init('view', $fields);
return parent::view_process($uid);
}
protected function index_process(): array
{
$fields = [
'fields' => ['user_uid', 'class_name', 'method_name', 'title', 'status', 'created_at'],
];
$this->init('index', $fields);
return parent::index_process();
}
}

View File

@ -40,7 +40,7 @@ class UserController extends AdminController
return $this->_helper;
}
//Index,FieldForm관련
protected function setValidation(Validation $validation, string $action, string $field, ?string $rule = null): Validation
protected function setValidation(Validation $validation, string $action, string $field, string $rule): Validation
{
switch ($field) {
case 'role':
@ -54,22 +54,4 @@ class UserController extends AdminController
return $validation;
}
//Index,FieldForm관련.
//View관련
protected function view_process($uid): mixed
{
$fields = [
'fields' => ['id', 'name', 'email', 'mobile', 'role', 'status'],
];
$this->init('view', $fields);
return parent::view_process($uid);
}
protected function index_process(): array
{
$fields = [
'fields' => ['id', 'name', 'email', 'mobile', 'role', 'status'],
];
$this->init('index', $fields);
return parent::index_process();
}
}

View File

@ -26,7 +26,7 @@ abstract class AuthController extends CommonController
$this->individualScripts = [];
}
abstract protected function getSNSButton(): string;
abstract protected function login_process(): UserEntity;
abstract protected function login_process(string $action): UserEntity;
final public function getHelper(): mixed
{
@ -43,31 +43,42 @@ abstract class AuthController extends CommonController
//로그인화면
final public function login_form(): RedirectResponse|string
{
$action = __FUNCTION__;
try {
$this->init(__FUNCTION__);
helper(['form']);
$this->sns_buttoh = $this->getSNSButton();
$this->forms = ['attributes' => ['method' => "post",], 'hiddens' => []];
return $this->getResultPageByActon($this->action);
return $this->getResultPageByActon($action);
} catch (\Exception $e) {
if (env('app.debug.' . $action)) {
echo $e->getMessage();
exit;
} else {
return redirect()->back()->withInput()->with('error', $e->getMessage());
}
}
}
//로그인
final public function login(): RedirectResponse|string
{
$action = __FUNCTION__;
try {
$this->entity = $this->login_process();
return $this->getResultPageByActon($this->action, MESSAGES['LOGIN']);
$this->entity = $this->login_process($action);
return $this->getResultPageByActon($action, MESSAGES['LOGIN']);
} catch (\Exception $e) {
if (env('app.debug.' . $action)) {
echo $e->getMessage();
exit;
} else {
return redirect()->back()->withInput()->with('error', $e->getMessage());
}
}
}
//로그아웃
final public function logout(): RedirectResponse
{
try {
$this->init(__FUNCTION__);
// $this->init(__FUNCTION__);
$this->getService()->logout();
// 홈페이지로 리다이렉트
return redirect()->route('/')->with('error', MESSAGES['LOGOUT']);

View File

@ -41,7 +41,7 @@ class GoogleController extends AuthController
}
//로그인처리
protected function login_process(): UserEntity
protected function login_process(string $action): UserEntity
{
$access_code = $this->request->getVar('code');
if (!$access_code) {

View File

@ -29,10 +29,11 @@ class LocalController extends AuthController
return "";
}
//로그인처리
protected function login_process(): UserEntity
protected function login_process(string $action, array $formDatas = []): UserEntity
{
$this->init(__FUNCTION__);
$this->formDatas = $this->doValidate($this->action, $this->fields);
return $this->getService()->login($this->getService()->checkUser($this->formDatas));
foreach ($this->fields as $field) {
$formDatas[] = $this->request->getVar($field);
}
return $this->getService()->login($this->getService()->checkUser($formDatas));
}
}

View File

@ -34,6 +34,13 @@ abstract class CommonController extends BaseController
$this->myAuthName = $this->getMyAuth()->getNameByAuthInfo();
$this->myAuthUID = $this->getMyAuth()->getUIDByAuthInfo();
}
//각 Field 초기화
$this->form_fields = $this->getFormFields();
$this->filter_fields = $this->getFilterFields();
$this->field_options = $this->getFormFieldOptions($this->getFormFields());
$this->index_fields = $this->getIndexFields();
$this->view_fields = $this->getViewFields();
$this->batchjob_fields = $this->getBatchJobFields();
}
final public function __get($name)
{
@ -65,26 +72,55 @@ abstract class CommonController extends BaseController
return $this->_myLogService;
}
//Index,FieldForm관련
protected function init(string $action, array $fields = []): void
public function getFormFields(?array $form_fields = null): array
{
$this->action = $action;
$this->fields = array_key_exists('fields', $fields) && is_array($fields['fields']) && count($fields['fields']) ? $fields['fields'] : $this->getFields();
$this->field_rules = array_key_exists('field_rules', $fields) && is_array($fields['field_rules']) && count($fields['field_rules']) ? $fields['field_rules'] : $this->getFieldRules($this->action, $this->fields);
$this->filter_fields = array_key_exists('filter_fields', $fields) && is_array($fields['filter_fields']) && count($fields['filter_fields']) ? $fields['filter_fields'] : $this->getFilterFields();
$this->field_options = array_key_exists('field_options', $fields) && is_array($fields['field_optionss']) && count($fields['field_options']) ? $fields['field_options'] : $this->getFormFieldOptions($this->filter_fields);
$this->batchjob_fields = array_key_exists('batchjob_fields', $fields) && is_array($fields['batchjob_fields']) && count($fields['batchjob_fields']) ? $fields['filter_fields'] : $this->getBatchJobFields();
if (is_array($form_fields)) {
$this->form_fields = $form_fields;
}
public function getFields(): array
{
return $this->getService()->getFields();
if (!is_array($this->form_fields)) {
$this->form_fields = $this->getService()->getFormFields();;
}
public function getFilterFields(): array
{
return $this->getService()->getFilterFields();
return $this->form_fields;
}
public function getBatchJobFields(): array
public function getFilterFields(?array $filter_fields = null): array
{
return $this->getService()->getBatchJobFields();
if (is_array($filter_fields)) {
$this->filter_fields = $filter_fields;
}
if (!is_array($this->filter_fields)) {
$this->filter_fields = $this->getService()->getFilterFields();;
}
return $this->filter_fields;
}
public function getIndexFields(?array $index_fields = null): array
{
if (is_array($index_fields)) {
$this->index_fields = $index_fields;
}
if (!is_array($this->index_fields)) {
$this->index_fields = $this->getService()->getIndexFields();;
}
return $this->index_fields;
}
public function getViewFields(?array $view_fields = null): array
{
if (is_array($view_fields)) {
$this->view_fields = $view_fields;
}
if (!is_array($this->view_fields)) {
$this->view_fields = $this->getService()->getViewFields();;
}
return $this->view_fields;
}
public function getBatchJobFields(?array $batchjob_fields = null): array
{
if (is_array($batchjob_fields)) {
$this->batchjob_fields = $batchjob_fields;
}
if (!is_array($this->batchjob_fields)) {
$this->batchjob_fields = $this->getService()->getBatchJobFields();;
}
return $this->batchjob_fields;
}
protected function getFieldRule(string $action, string $field): string
{
@ -130,27 +166,27 @@ abstract class CommonController extends BaseController
}
return $options;
}
protected function setValidation(Validation $validation, string $action, string $field, ?string $rule = null): Validation
protected function setValidation(Validation $validation, string $action, string $field, string $rule): Validation
{
switch ($field) {
default:
$validation->setRule($field, $field, $rule ?? $this->getFieldRule($action, $field));
$validation->setRule($field, $field, $rule);
break;
}
return $validation;
}
//Field관련
//데이터 검증
final protected function doValidate(string $action, array $fields, ?Validation $validation = null): array
final protected function doValidate(string $action, array $fields, array $formDatas, ?Validation $validation = null): array
{
//변경할 값 확인 : Upload된 파일 검증시 $this->request->getPOST()보다 먼처 체크필요
if (!$validation) {
$validation = service('validation');
}
foreach ($fields as $field) {
$validation = $this->setValidation($validation, $action, $field, $this->field_rules[$field] ?? null);
$validation = $this->setValidation($validation, $action, $field, $this->getFieldRule($action, $field));
}
if (!$validation->withRequest($this->request)->run()) {
if (!$validation->run($formDatas)) {
throw new \Exception("{$this->getService()->getClassName()} 작업 데이터 검증 오류발생\n" . implode(
"\n",
$validation->getErrors()
@ -160,6 +196,7 @@ abstract class CommonController extends BaseController
}
protected function getResultPageByActon(string $action, string $message = MESSAGES["SUCCESS"]): RedirectResponse|string
{
$this->action = $action;
switch ($action) {
case 'create':
case 'modify':
@ -182,220 +219,274 @@ abstract class CommonController extends BaseController
//Index,FieldForm관련
// 생성
protected function create_form_process(): void
final protected function create_form_process($action): void
{
foreach ($this->filter_fields as $field) {
$this->field_rules = $this->getFieldRules($action, $this->getFormFields());
}
final public function create_form(): RedirectResponse|string
{
$action = 'create';
try {
helper(['form']);
//filter_fields에 해당하는 값이 있을 경우 정의
foreach ($this->getFilterFields() as $field) {
$value = $this->request->getVar($field);
if ($value) {
$this->$field = $value;
}
}
}
final public function create_form(): RedirectResponse|string
{
try {
// 현재 URL을 스택에 저장
// $this->getMyAuth()->pushCurrentUrl($this->request->getUri()->getPath() . ($this->request->getUri()->getQuery() ? "?" . $this->request->getUri()->getQuery() : ""));
helper(['form']);
$this->init(__FUNCTION__);
$this->create_form_process();
$this->create_form_process($action);
$this->forms = ['attributes' => ['method' => "post",], 'hiddens' => []];
return $this->getResultPageByActon($this->action);
return $this->getResultPageByActon($action);
} catch (\Exception $e) {
if (env('app.debug.' . $action)) {
echo $e->getMessage();
exit;
} else {
return redirect()->back()->withInput()->with('error', $e->getMessage());
}
}
protected function create_process(): mixed
}
protected function create_process(string $action, array $fields, array $formDatas = []): mixed
{
return $this->getService()->create($this->formDatas);
$this->field_rules = $this->getFieldRules($action, $fields);
//데이터 검증
$validatedFormDatas = $this->doValidate($action, $fields, $formDatas);
return $this->getService()->create($validatedFormDatas);
}
final public function create(): RedirectResponse|string
{
$action = __FUNCTION__;
$this->getService()->getModel()->transStart();
try {
$this->init(__FUNCTION__);
//데이터 검증
$this->formDatas = $this->doValidate($this->action, $this->fields);
$this->entity = $this->create_process();
// dd($this->entity);
//입력값정의
$formDatas = [];
foreach ($this->getFormFields() as $field) {
$formDatas[] = $this->request->getVar($field);
}
$this->entity = $this->create_process($action, $this->getFormFields(), $formDatas);
$this->getService()->getModel()->transCommit();
$this->getMyLogService()->save($this->getService(), __FUNCTION__, $this->getMyAuth(), MESSAGES["SUCCESS"]);
return $this->getResultPageByActon($this->action);
return $this->getResultPageByActon($action);
} catch (\Exception $e) {
// dd($e->getMessage());
$this->getService()->getModel()->transRollback();
LogCollector::debug($e->getMessage());
$this->getMyLogService()->save($this->getService(), __FUNCTION__, $this->getMyAuth(), MESSAGES["FAILED"]);
if (env('app.debug.' . $action)) {
echo $e->getMessage();
exit;
} else {
return redirect()->back()->withInput()->with('error', $e->getMessage());
}
}
}
//수정관련
protected function modify_form_process(mixed $uid): mixed
final protected function modify_form_process(string $action, mixed $entity): mixed
{
return $this->getService()->getEntity($uid);
$this->field_rules = $this->getFieldRules($action, $this->getFormFields());
return $entity;
}
final public function modify_form(mixed $uid): RedirectResponse|string
{
$action = 'modify';
try {
// 현재 URL을 스택에 저장
// $this->getMyAuth()->pushCurrentUrl($this->request->getUri()->getPath() . ($this->request->getUri()->getQuery() ? "?" . $this->request->getUri()->getQuery() : ""));
helper(['form']);
$this->init(__FUNCTION__);
$this->entity = $this->modify_form_process($uid);
//filter_fields에 해당하는 값이 있을 경우 정의
foreach ($this->getFilterFields() as $field) {
$value = $this->request->getVar($field);
if ($value) {
$this->$field = $value;
}
}
//기존 Entity 가져오기
$entity = $this->getService()->getEntity($uid);
$this->entity = $this->modify_form_process($action, $entity);
$this->forms = ['attributes' => ['method' => "post",], 'hiddens' => []];
return $this->getResultPageByActon($this->action);
return $this->getResultPageByActon($action);
} catch (\Exception $e) {
if (env('app.debug.' . $action)) {
echo $e->getMessage();
exit;
} else {
return redirect()->back()->withInput()->with('error', $e->getMessage());
}
}
protected function modify_process(mixed $uid): mixed
}
protected function modify_process(string $action, mixed $entity, array $fields, array $formDatas = []): mixed
{
//자신정보정의
$entity = $this->getService()->getEntity($uid);
return $this->getService()->modify($entity, $this->formDatas);
$this->field_rules = $this->getFieldRules($action, $fields);
//데이터 검증
$validatedFormDatas = $this->doValidate($action, $fields, $formDatas);
return $this->getService()->modify($entity, $validatedFormDatas);
}
final public function modify(int $uid): RedirectResponse|string
{
$action = __FUNCTION__;
//Transaction Start
$this->getService()->getModel()->transStart();
try {
$this->init(__FUNCTION__);
//데이터 검증
$this->formDatas = $this->doValidate($this->action, $this->fields);
$this->entity = $this->modify_process($uid);
//입력값정의
$formDatas = [];
foreach ($this->getFormFields() as $field) {
$formDatas[] = $this->request->getVar($field);
}
//기존 Entity 가져오기
$entity = $this->getService()->getEntity($uid);
$this->entity = $this->modify_process($action, $entity, $this->getFormFields(), $formDatas);
$this->getService()->getModel()->transCommit();
$this->getMyLogService()->save($this->getService(), __FUNCTION__, $this->getMyAuth(), MESSAGES["SUCCESS"]);
return $this->getResultPageByActon($this->action);
return $this->getResultPageByActon($action);
} catch (\Exception $e) {
$this->getService()->getModel()->transRollback();
LogCollector::debug($e->getMessage());
$this->getMyLogService()->save($this->getService(), __FUNCTION__, $this->getMyAuth(), MESSAGES["FAILED"]);
if (env('app.debug.' . $action)) {
echo $e->getMessage();
exit;
} else {
return redirect()->back()->withInput()->with('error', $e->getMessage());
}
}
}
//단일필드작업
protected function toggle_process(mixed $uid): mixed
protected function toggle_process(string $action, mixed $entity, array $fields, array $formDatas = []): mixed
{
//자신정보정의
$entity = $this->getService()->getEntity($uid);
return $this->getService()->modify($entity, $this->formDatas);
$this->field_rules = $this->getFieldRules($action, $fields);
//데이터 검증
$validatedFormDatas = $this->doValidate($action, $fields, $formDatas);
return $this->getService()->modify($entity, $validatedFormDatas);
}
final public function toggle(mixed $uid, string $field): RedirectResponse
{
$action = __FUNCTION__;
//Transaction Start
$this->getService()->getModel()->transStart();
try {
$this->action = __FUNCTION__;
$this->fields = [$field];
//데이터 검증
$this->formDatas = $this->doValidate($this->action, $this->fields);
$this->entity = $this->toggle_process($uid);
//데이터가 있는경우 Field만 처리하기위해
$fields = [$field];
//입력값정의
$formDatas = [$this->request->getVar($field)];
//기존 Entity 가져오기
$entity = $this->getService()->getEntity($uid);
$this->entity = $this->toggle_process($action, $entity, $fields, $formDatas);
$this->getService()->getModel()->transCommit();
$this->getMyLogService()->save($this->getService(), __FUNCTION__, $this->getMyAuth(), MESSAGES["SUCCESS"]);
return $this->getResultPageByActon($this->action);
return $this->getResultPageByActon($action);
} catch (\Exception $e) {
$this->getService()->getModel()->transRollback();
LogCollector::debug($e->getMessage());
$this->getMyLogService()->save($this->getService(), __FUNCTION__, $this->getMyAuth(), MESSAGES["FAILED"]);
if (env('app.debug.' . $action)) {
echo $e->getMessage();
exit;
} else {
return redirect()->back()->withInput()->with('error', $e->getMessage());
}
}
//일괄처리작업
protected function batchjob_process(array $entities): array
{
$temps = [];
foreach ($entities as $entity) {
$temps[] = $this->getService()->modify($entity, $this->formDatas);
}
return $temps;
//일괄처리작업
protected function batchjob_process(string $action, mixed $entity, array $fields, array $formDatas = []): array
{
$this->field_rules = $this->getFieldRules($action, $fields);
//데이터 검증
$validatedFormDatas = $this->doValidate($action, $fields, $formDatas);
return $this->getService()->modify($entity, $validatedFormDatas);
}
final public function batchjob(): RedirectResponse
{
$action = __FUNCTION__;
//Transaction Start
$this->getService()->getModel()->transStart();
try {
$this->init(__FUNCTION__);
//변경할 UIDS
$uids = $this->request->getVar('batchjob_uids[]');
if (!is_array($uids) || !count($uids)) {
throw new \Exception("적용할 리스트를 선택하셔야합니다.");
}
//데이터가 있는경우 Field만 처리하기위해
$fields = [];
foreach ($this->batchjob_fields as $field) {
if ($this->request->getVar($field)) {
$formDatas = [];
foreach ($this->getBatchJobFields() as $field) {
$value = $this->request->getVar($field);
if ($value) {
$fields[] = $field;
$formDatas[] = $this->request->getVar($field);
}
}
if (!count($fields)) {
throw new \Exception("변경할 정보를 선택하셔야합니다.");
}
$this->fields = $fields;
//변경할 UIDS
$uids = $this->request->getVar('batchjob_uids[]');
if (!is_array($uids) || !count($uids)) {
throw new \Exception("적용할 리스트를 선택하셔야합니다.");
}
$entities = [];
foreach ($uids as $uid) {
//기존 Entity 가져오기
$entity = $this->getService()->getEntity($uid);
$entities[] = $entity;
$entities[] = $this->batchjob_process($action, $entity, $fields, $formDatas);
}
//데이터 검증
$this->formDatas = $this->doValidate($this->action, $this->fields);
$this->entities = $this->batchjob_process($entities);
$this->entities = $entities;
$this->getService()->getModel()->transCommit();
$this->getMyLogService()->save($this->getService(), __FUNCTION__, $this->getMyAuth(), MESSAGES["SUCCESS"]);
return $this->getResultPageByActon($this->action);
return $this->getResultPageByActon($action);
} catch (\Exception $e) {
$this->getService()->getModel()->transRollback();
LogCollector::debug($e->getMessage());
$this->getMyLogService()->save($this->getService(), __FUNCTION__, $this->getMyAuth(), MESSAGES["FAILED"]);
if (env('app.debug.' . $action)) {
echo $e->getMessage();
exit;
} else {
return redirect()->back()->withInput()->with('error', $e->getMessage());
}
}
}
//삭제,일괄삭제 공통사용
protected function delete_process(mixed $entity): mixed
{
$result = $this->getService()->delete($entity);
if (!$result) {
throw new \Exception("[{$entity->getTitle()}] 삭제실패");
LogCollector::error("[{$entity->getTitle()}] 삭제실패");
}
return $entity;
}
final public function delete(mixed $uid): RedirectResponse|string
{
$action = __FUNCTION__;
//Transaction Start
$this->getService()->getModel()->transStart();
try {
$this->init(__FUNCTION__);
//기존 Entity 가져오기
$entity = $this->getService()->getEntity($uid);
$this->entity = $this->delete_process($entity);
$this->getService()->getModel()->transCommit();
$this->getMyLogService()->save($this->getService(), __FUNCTION__, $this->getMyAuth(), MESSAGES["SUCCESS"]);
return $this->getResultPageByActon($this->action);
return $this->getResultPageByActon($action);
} catch (\Exception $e) {
$this->getService()->getModel()->transRollback();
LogCollector::debug($e->getMessage());
$this->getMyLogService()->save($this->getService(), __FUNCTION__, $this->getMyAuth(), MESSAGES["FAILED"]);
if (env('app.debug.' . $action)) {
echo $e->getMessage();
exit;
} else {
return redirect()->back()->withInput()->with('error', $e->getMessage());
}
}
}
//일괄삭제
protected function batchjob_delete_process(array $entities): int
protected function batchjob_delete_process(mixed $entity): mixed
{
$cnt = 0;
foreach ($entities as $entity) {
$result = $this->getService()->delete($entity);
if (!$result) {
LogCollector::error("[{$entity->getTitle()}] 삭제실패");
$cnt++;
}
}
return $cnt;
return $entity;
}
final public function batchjob_delete(): RedirectResponse|string
{
$action = __FUNCTION__;
//Transaction Start
$this->getService()->getModel()->transStart();
try {
$this->init(__FUNCTION__);
//변경할 UIDS
$uids = $this->request->getVar('batchjob_uids[]');
if (!is_array($uids) || !count($uids)) {
@ -403,55 +494,59 @@ abstract class CommonController extends BaseController
}
$entities = [];
foreach ($uids as $uid) {
//기존 Entity 가져오기
$entity = $this->getService()->getEntity($uid);
$entities[] = $entity;
}
$cnt = $this->batchjob_delete_process($entities);
if ($cnt) {
$message = "총:" . count($entities) . "중에 " . $cnt . "개를 실패";
LogCollector::error($message);
throw new \Exception($message);
$entities[] = $this->batchjob_delete_process($entity);
}
$this->entities = $entities;
$this->getService()->getModel()->transCommit();
$this->getMyLogService()->save($this->getService(), __FUNCTION__, $this->getMyAuth(), MESSAGES["SUCCESS"]);
return $this->getResultPageByActon($this->action);
return $this->getResultPageByActon($action);
} catch (\Exception $e) {
$this->getService()->getModel()->transRollback();
LogCollector::debug($e->getMessage());
$this->getMyLogService()->save($this->getService(), __FUNCTION__, $this->getMyAuth(), MESSAGES["FAILED"]);
if (env('app.debug.' . $action)) {
echo $e->getMessage();
exit;
} else {
return redirect()->back()->withInput()->with('error', $e->getMessage());
}
}
}
//View
protected function view_process($uid): mixed
protected function view_process(string $action, mixed $entity, array $fields): mixed
{
//자신정보정의
$entity = $this->getService()->getEntity($uid);
if (!$entity) {
throw new \Exception("해당 사용자정보를 찾을수 없습니다.");
}
$this->field_rules = $this->getFieldRules($action, $fields);
return $entity;
}
final public function view(string $uid): RedirectResponse|string
{
$action = __FUNCTION__;
try {
helper(['form']);
$this->init(__FUNCTION__);
$this->entity = $this->view_process($uid);
//기존 Entity 가져오기
$entity = $this->getService()->getEntity($uid);
$this->entity = $this->view_process($action, $entity, $this->getViewFields());
$this->forms = ['attributes' => ['method' => "post",], 'hiddens' => []];
return $this->getResultPageByActon($this->action);
return $this->getResultPageByActon($action);
} catch (\Exception $e) {
if (env('app.debug.index')) {
echo $e->getMessage();
exit;
} else {
return redirect()->back()->withInput()->with('error', $e->getMessage());
}
}
}
//리스트
//List 조건절 처리
final protected function setConditionForList(array $filter_fields): void
final protected function setConditionForList(): void
{
//조건절 처리
foreach ($filter_fields as $field) {
foreach ($this->getFilterFields() as $field) {
$this->$field = $this->request->getVar($field);
if ($this->$field !== null && $this->$field !== '') {
if ($field === 'role') {
@ -516,16 +611,17 @@ abstract class CommonController extends BaseController
$this->total_page = $pager->getPageCount($pager_group);
return $pager->links($pager_group, $template);
}
protected function index_process(): array
protected function index_process(string $action, array $fields): array
{
$this->field_rules = $this->getFieldRules($action, $fields);
//조건절 처리
$this->setConditionForList($this->filter_fields);
$this->setConditionForList();
//TotalCount
$this->total_count = intval($this->getService()->getModel()->selectCount('*', 'cnt')->get()->getRow()->cnt);
//Pagination 처리
$this->pagination = $this->getPaginationForList();
//조건절 , OrcerBy , Limit 처리
$this->setConditionForList($this->filter_fields);
$this->setConditionForList();
$this->setOrderByForList();
$this->getService()->getModel()->limit($this->per_page);
$this->getService()->getModel()->offset(($this->page - 1) * $this->per_page);
@ -533,17 +629,22 @@ abstract class CommonController extends BaseController
}
public function index()
{
$action = __FUNCTION__;
try {
// 현재 URL을 스택에 저장
$this->getMyAuth()->pushCurrentUrl($this->request->getUri()->getPath() . ($this->request->getUri()->getQuery() ? "?" . $this->request->getUri()->getQuery() : ""));
helper(['form']);
$this->init(__FUNCTION__);
$this->entities = $this->index_process();
return $this->getResultPageByActon($this->action);
$this->entities = $this->index_process($action, $this->getIndexFields());
return $this->getResultPageByActon($action);
} catch (\Exception $e) {
if (env('app.debug.' . $action)) {
echo $e->getMessage();
exit;
} else {
return redirect()->back()->withInput()->with('error', $e->getMessage());
}
}
}
//OUPUT Document 관련
private function download_document(string $document_type, mixed $loaded_data): array
@ -566,16 +667,15 @@ abstract class CommonController extends BaseController
// Download
final public function download(string $output_type, mixed $uid = false): DownloadResponse|RedirectResponse
{
$this->init(__FUNCTION__);
$action = __FUNCTION__;
try {
helper(['form']);
//URL처리
$this->uri = $this->request->getUri();
// $this->uri = $this->request->getUri();
switch ($output_type) {
case 'excel':
case 'pdf':
// string buffer에서 읽어오는 경우
$this->entities = $this->index_process();
$this->entities = $this->index_process($action, $this->getIndexFields());
$html = view('templates' . DIRECTORY_SEPARATOR . 'common' . DIRECTORY_SEPARATOR . __FUNCTION__, ['viewDatas' => $this->getViewDatas()]);
//data loading
$reader = new Html();
@ -594,7 +694,12 @@ abstract class CommonController extends BaseController
}
return $this->response->download($full_path, null)->setFileName($file_name);
} catch (\Exception $e) {
if (env('app.debug.' . $action)) {
echo $e->getMessage();
exit;
} else {
return redirect()->back()->withInput()->with('error', $e->getMessage());
}
}
}
}

File diff suppressed because one or more lines are too long

View File

@ -4,13 +4,13 @@
"settings": {
"width": 3000,
"height": 3000,
"scrollTop": -895.2786,
"scrollLeft": -1742,
"scrollTop": -1225.2786,
"scrollLeft": -419.3704,
"zoomLevel": 0.76,
"show": 511,
"database": 4,
"databaseName": "",
"canvasType": "@dineug/erd-editor/builtin-schema-sql",
"canvasType": "ERD",
"language": 1,
"tableNameCase": 4,
"columnNameCase": 2,
@ -64,7 +64,6 @@
"6Gx9n7rUrSbXGbvE39xnm",
"anhMCXytE7rcE_drKBPWz",
"Wma86GpS3BhikEaHSamgX",
"1rYupb5yiEWocrmmCxTAV",
"I80TuGxKm3tXIO_EO2PSm"
],
"indexIds": [],
@ -207,7 +206,6 @@
"comment": "서버정보",
"columnIds": [
"F9EPb6nsDx6Tf3GG8rvP1",
"TA8YG5vV7QmJxAXVpP8Tc",
"9F6QpQqxeEggZ0FHM81O1",
"54iuIW4knok06vP4JH-oN",
"bh-W1plz0vCW2rURDnfDR",
@ -254,7 +252,7 @@
"color": ""
},
"meta": {
"updateAt": 1749008061426,
"updateAt": 1749015086720,
"createAt": 1745819764137
}
},
@ -657,15 +655,15 @@
"ixmBlLhmVt4et6tZEwLPC"
],
"ui": {
"x": 2409.6893,
"y": 1860.5267,
"x": 2416.2682,
"y": 1875.0004,
"zIndex": 1118,
"widthName": 60,
"widthComment": 60,
"color": ""
},
"meta": {
"updateAt": 1749008012233,
"updateAt": 1749015481650,
"createAt": 1747808548333
}
},
@ -793,7 +791,6 @@
"columnIds": [
"N_yJVoCN4oUEDhYqdzApb",
"NzxkmndrTbH7xb6fbnGV7",
"Fx2k158yi9P2l5An09ae1",
"_UFwKNcesG423815BIYBi",
"Gb6fmS40Q3wvnvD1HMTqR",
"uuDbJDSDQLey7Km1W9hlJ",
@ -838,7 +835,7 @@
"color": ""
},
"meta": {
"updateAt": 1748856657666,
"updateAt": 1749083403230,
"createAt": 1748485662214
}
},
@ -888,6 +885,7 @@
"columnIds": [
"goZoW_pUw3n5ZLMQzWgFd",
"TerqekzImISduE6ewW1b5",
"RdC0qfV8xczStXW9cLOe8",
"NfZNTuHX_ZzyIuhI7DTJE",
"Yoi_Exlpp4kDz8xumGHgZ",
"5OcpSdnrgDxZ9eZ7_pQr9",
@ -902,6 +900,7 @@
"seqColumnIds": [
"goZoW_pUw3n5ZLMQzWgFd",
"TerqekzImISduE6ewW1b5",
"RdC0qfV8xczStXW9cLOe8",
"NfZNTuHX_ZzyIuhI7DTJE",
"Yoi_Exlpp4kDz8xumGHgZ",
"5OcpSdnrgDxZ9eZ7_pQr9",
@ -911,7 +910,8 @@
"2-eG3lx3U3LRKw_qRA9qI",
"pxuIGPFD7CNh-bnlYRsy6",
"s1P-DaXO-MWos67f0R__G",
"XydKmlBJZHPj4xqkxUH24"
"XydKmlBJZHPj4xqkxUH24",
"mzjynvHZERYSmrLQ3_gX7"
],
"ui": {
"x": 145.0137,
@ -922,7 +922,7 @@
"color": ""
},
"meta": {
"updateAt": 1748508763702,
"updateAt": 1749083388529,
"createAt": 1748507247933
}
},
@ -6316,7 +6316,7 @@
"default": "",
"options": 0,
"ui": {
"keys": 2,
"keys": 0,
"widthName": 73,
"widthComment": 62,
"widthDataType": 60,
@ -6474,7 +6474,7 @@
"comment": "",
"dataType": "INT",
"default": "",
"options": 0,
"options": 8,
"ui": {
"keys": 2,
"widthName": 73,
@ -6483,9 +6483,49 @@
"widthDefault": 60
},
"meta": {
"updateAt": 1749009006732,
"updateAt": 1749015073231,
"createAt": 1749008230147
}
},
"mzjynvHZERYSmrLQ3_gX7": {
"id": "mzjynvHZERYSmrLQ3_gX7",
"tableId": "0WXrjcyXXGeoAVM2VB8s2",
"name": "",
"comment": "",
"dataType": "",
"default": "",
"options": 0,
"ui": {
"keys": 0,
"widthName": 60,
"widthComment": 60,
"widthDataType": 60,
"widthDefault": 60
},
"meta": {
"updateAt": 1749083363362,
"createAt": 1749083357575
}
},
"RdC0qfV8xczStXW9cLOe8": {
"id": "RdC0qfV8xczStXW9cLOe8",
"tableId": "0WXrjcyXXGeoAVM2VB8s2",
"name": "code",
"comment": "",
"dataType": "VARCHAR(20)",
"default": "",
"options": 0,
"ui": {
"keys": 0,
"widthName": 60,
"widthComment": 60,
"widthDataType": 75,
"widthDefault": 60
},
"meta": {
"updateAt": 1749083398020,
"createAt": 1749083385992
}
}
},
"relationshipEntities": {
@ -6639,7 +6679,7 @@
"columnIds": [
"_AcWUYKzNJd-V0fRHq8Cx"
],
"x": 1747.9584,
"x": 1880.7084,
"y": 1024.0747999999999,
"direction": 8
},
@ -6761,7 +6801,7 @@
"NzxkmndrTbH7xb6fbnGV7"
],
"x": 1442.3741,
"y": 1254.1363,
"y": 1242.1363,
"direction": 2
},
"meta": {
@ -6780,7 +6820,7 @@
"N_yJVoCN4oUEDhYqdzApb"
],
"x": 934.3741,
"y": 1254.1363,
"y": 1242.1363,
"direction": 1
},
"end": {
@ -6789,7 +6829,7 @@
"TerqekzImISduE6ewW1b5"
],
"x": 662.0137,
"y": 1536.9949,
"y": 1548.9949,
"direction": 2
},
"meta": {
@ -6797,39 +6837,11 @@
"createAt": 1748507336370
}
},
"1rYupb5yiEWocrmmCxTAV": {
"id": "1rYupb5yiEWocrmmCxTAV",
"identification": false,
"relationshipType": 16,
"startRelationshipType": 1,
"start": {
"tableId": "6ajvOCaGuXU9pzV0Y9jEi",
"columnIds": [
"_AcWUYKzNJd-V0fRHq8Cx"
],
"x": 2013.4584,
"y": 1024.0747999999999,
"direction": 8
},
"end": {
"tableId": "B4qGh3KZsXHQ3_4EOgwJZ",
"columnIds": [
"TA8YG5vV7QmJxAXVpP8Tc"
],
"x": 1956.0505,
"y": 1429.6758,
"direction": 4
},
"meta": {
"updateAt": 1748508421471,
"createAt": 1748508421471
}
},
"I80TuGxKm3tXIO_EO2PSm": {
"id": "I80TuGxKm3tXIO_EO2PSm",
"identification": false,
"relationshipType": 16,
"startRelationshipType": 1,
"startRelationshipType": 2,
"start": {
"tableId": "6ajvOCaGuXU9pzV0Y9jEi",
"columnIds": [

View File

@ -11,8 +11,8 @@ abstract class CustomerEntity extends CommonEntity
parent::__construct($data);
}
final public function getClientInfoUID()
final public function getClientInfoUID(): int
{
return $this->attributes['clientinfo_uid'];
return intval($this->attributes['clientinfo_uid']);
}
}

View File

@ -12,7 +12,6 @@ class ServiceEntity extends CustomerEntity
{
return $this->attributes[$type] ?? [];
}
public function setItemEntities(string $type, array $partEntities): void
{
if (!isset($this->attributes[$type])) {

View File

@ -37,7 +37,6 @@ class AuthFilter implements FilterInterface
}
//User Role 비교 // 회원 ROLES이 필요ROLE($arguments) 목록에 존재하지 않으면(ACL)
if (!$auth->isAccessRole($arguments)) {
// dd($auth->popPreviousUrl());
return redirect()->back()->with(
'error',
"회원[{$auth->getNameByAuthInfo()}]님은 접속에 필요한 권한이 없습니다. "

View File

@ -253,12 +253,26 @@ class CommonHelper
$extra_class = isset($extras['class']) ? $extras['class'] . ' tinymce' : 'tinymce';
$form = form_textarea($field, $value ?? "", ['id' => $field, 'class' => $extra_class, ...array_diff_key($extras, ['class' => ''])]);
break;
case 'status':
if (in_array($viewDatas['action'], ['create_form', 'modify_form'])) {
$forms = [];
foreach ($viewDatas['field_options'][$field] as $key => $label) {
$forms[] = form_radio($label, $key, $key == $value) . $label;
}
$form = implode(" ", $forms);
} else {
$formOptions = ["" => lang($viewDatas['class_path'] . '.label.' . $field) . ' 선택'];
foreach ($viewDatas['field_options'][$field] as $key => $label) {
$formOptions[$key] = $label;
}
$form = form_dropdown($field, $formOptions, $value, $extras);
}
break;
default:
if (in_array($field, $viewDatas['filter_fields'])) {
if (!is_array($viewDatas['field_options'][$field])) {
throw new \Exception(__METHOD__ . "에서 {$field}의 field_options가 array형태가 아닙니다.");
}
$extras['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;
@ -367,7 +381,7 @@ class CommonHelper
$viewDatas['cnt'],
$action,
[
"data-src" => current_url() . '/' . $action . '/' . $viewDatas['entity']->getPK(),
"data-src" => current_url() . '/' . $action . '/' . $viewDatas['entity']->getPK() . '?' . $this->request->getUri()->getQuery(),
"data-bs-toggle" => "modal",
"data-bs-target" => "#index_action_form",
...$extras

View File

@ -15,26 +15,23 @@ class ServiceItemHelper extends CustomerHelper
}
//ItemType에 따른 조건부 추가 Index Page
public function getFieldFormByItemType(array $viewDatas): string
public function getFieldFormByItemType(string $field, mixed $value, array $viewDatas, array $extras = []): string
{
$form = "";
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 ($viewDatas['item_type']) {
case 'DOMAIN':
$form = "";
if (in_array($viewDatas['action'], ['create', 'create_form'])) {
$form = form_label(
'추가',
'domain_create_popup',
[
"data-src" => '/admin/equipment/domain?',
"data-bs-toggle" => "modal",
"data-bs-target" => "#create_action_form",
"class" => "btn btn-outline btn-primary btn-circle",
"target" => "_self"
]
);
if (in_array($viewDatas['action'], ['create', 'create_form', 'modify', 'modify_form'])) {
$form = form_input($field, $value ?? "", ["placeholder" => "예)example.com", ...$extras]);
} else {
$form = parent::getFieldForm($field, $value, $viewDatas, $extras);
}
break;
default:
$form = parent::getFieldForm($field, $value, $viewDatas, $extras);
break;
}
return $form;
}
@ -45,9 +42,7 @@ class ServiceItemHelper extends CustomerHelper
}
switch ($field) {
case 'item_uid':
// echo $viewDatas['item_type'] . ':' . $viewDatas['action'];
$form = parent::getFieldForm($field, $value, $viewDatas, $extras);
$form .= $this->getFieldFormByItemType($viewDatas);
$form = $this->getFieldFormByItemType($field, $value, $viewDatas, $extras);
break;
default:
$form = parent::getFieldForm($field, $value, $viewDatas, $extras);

View File

@ -5,7 +5,6 @@ return [
'clientinfo_uid' => "고객명",
'location' => "위치",
'switch' => "스위치코드",
'code' => "서버코드",
'type' => "형식",
'raid' => "RAID",
'billing_at' => "청구일",
@ -38,21 +37,6 @@ return [
"R35P10" => "R35P10",
"R45P20" => "R45P20",
],
"CODE" => [
"JPN130" => "JPN130",
"JPN140" => "JPN140",
"JPN138" => "JPN138",
"R45P20" => "R45P20",
"X1508C" => "X1508C",
"X1508D" => "X1508D",
"X2001A" => "X2001A",
"X2001B" => "X2001B",
"X2001C" => "X2001C",
"X2001D" => "X2001D",
"X2001E" => "X2001E",
"P2404I510" => "P2404I510",
"P2404I710" => "P2404I710",
],
"TYPE" => [
"default" => "일반",
"defence" => "방어",

View File

@ -3,6 +3,7 @@ return [
'title' => "서비스항목정보",
'label' => [
'serviceinfo_uid' => "서비스명",
'code' => "서버코드",
'item_type' => "항목형식",
'item_uid' => "항목",
'billing_cycle' => "청구방식",
@ -20,6 +21,21 @@ return [
'type' => "default",
'status' => 'default'
],
"CODE" => [
"JPN130" => "JPN130",
"JPN140" => "JPN140",
"JPN138" => "JPN138",
"R45P20" => "R45P20",
"X1508C" => "X1508C",
"X1508D" => "X1508D",
"X2001A" => "X2001A",
"X2001B" => "X2001B",
"X2001C" => "X2001C",
"X2001D" => "X2001D",
"X2001E" => "X2001E",
"P2404I510" => "P2404I510",
"P2404I710" => "P2404I710",
],
"ITEM_TYPE" => [
"LINE" => "라인",
"IP" => "IP주소",

View File

@ -2,7 +2,6 @@
return [
'title' => "서버장비정보",
'label' => [
'clientinfo_uid' => "고객명",
'model' => "모델",
'price' => "금액",
'description' => "설명",
@ -13,17 +12,6 @@ return [
'DEFAULTS' => [
'status' => 'default',
],
"MODEL" => [
"HP DL360 Gen 6" => "HP DL360 Gen 6",
"HP DL360 Gen 7" => "HP DL360 Gen 7",
"HP DL360 Gen 8" => "HP DL360 Gen 8",
"HP DL360 Gen 9" => "HP DL360 Gen 9",
"3,4,5세대 PC" => "3,4,5세대 PC",
"6,7,8세대 PC" => "6,7,8세대 PC",
"9,10,11세대 PC" => "9,10,11세대 PC",
"12,13,14세대 PC" => "12,13,14세대 PC",
"12,13,14세대 MiniPC" => "12,13,14세대 MiniPC",
],
"STATUS" => [
'default' => "사용가능",
"pause" => "일시정지",

View File

@ -14,6 +14,7 @@ class ServiceItemModel extends CustomerModel
protected $returnType = ServiceItemEntity::class;
protected $allowedFields = [
"serviceinfo_uid",
"code",
"item_type",
"item_uid",
"billing_cycle",

View File

@ -16,7 +16,6 @@ class ServiceModel extends CustomerModel
"clientinfo_uid",
"switch",
"location",
"code",
"type",
"raid",
"billing_at",
@ -39,7 +38,6 @@ class ServiceModel extends CustomerModel
$rule = "required|numeric";
break;
case "switch":
case "code":
case "type":
case "status":
$rule = "required|trim|string";

View File

@ -29,7 +29,7 @@ class DomainModel extends EquipmentModel
}
switch ($field) {
case "clientinfo_uid":
$rule = "if_exist|numeric";
$rule = "required|numeric";
break;
case "price":
$rule = "required|numeric";

View File

@ -13,7 +13,6 @@ class ServerModel extends EquipmentModel
protected $primaryKey = self::PK;
protected $returnType = ServerEntity::class;
protected $allowedFields = [
'clientinfo_uid',
"model",
"description",
"status",
@ -29,9 +28,6 @@ class ServerModel extends EquipmentModel
throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true));
}
switch ($field) {
case "clientinfo_uid":
$rule = "if_exist|numeric";
break;
case "model":
$rule = "required|trim|string";
break;

View File

@ -36,6 +36,19 @@ abstract class AuthService extends CommonService
return $authInfo;
}
public function getFormFields(): array
{
return ['id', 'passwd'];
}
public function getFilterFields(): array
{
return [];
}
public function getBatchJobFields(): array
{
return [];
}
final public function getUIDByAuthInfo(): string
{
return $this->getAuthInfo('uid');

View File

@ -33,19 +33,6 @@ class GoogleService extends AuthService
return new UserEntity();
}
public function getFields(): array
{
return ['id', 'passwd'];
}
public function getFilterFields(): array
{
return [];
}
public function getBatchJobFields(): array
{
return [];
}
public function checkUser(string $access_code): UserEntity
{
try {

View File

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

View File

@ -17,9 +17,17 @@ abstract class CommonService
}
abstract public function getModelClass(): mixed;
abstract public function getEntityClass(): mixed;
abstract public function getFields(): array;
abstract public function getFormFields(): array;
abstract public function getFilterFields(): array;
abstract public function getBatchJobFields(): array;
public function getIndexFields(): array
{
return $this->getFormFields();
}
public function getViewFields(): array
{
return $this->getModel()->getFields();
}
final public function __get($name)
{
if (!array_key_exists($name, $this->_serviceDatas)) {
@ -65,13 +73,6 @@ abstract class CommonService
if ($where) {
$this->getModel()->where($where);
}
// QueryBuilder 객체 가져오기
// $builder = $this->getModel()->builder();
// $builder->select(implode(',', $columns));;
// if (env('app.debug.index')) {
// echo $builder->getCompiledSelect() . "<BR>";
// // exit;
// }
$entitys = [];
foreach ($this->getModel()->select(implode(',', $columns))->findAll() as $entity) {
$entitys[$entity->getPK()] = $entity;

View File

@ -22,7 +22,7 @@ class AccountService extends CustomerService
{
return new AccountEntity();
}
public function getFields(): array
public function getFormFields(): array
{
return [
"clientinfo_uid",

View File

@ -24,7 +24,7 @@ class ClientService extends CustomerService
{
return new ClientEntity();
}
public function getFields(): array
public function getFormFields(): array
{
return ['name', 'email', 'phone', 'role'];
}
@ -36,6 +36,27 @@ class ClientService extends CustomerService
{
return ['status'];
}
public function getIndexFields(): array
{
return ['name', 'email', 'phone', 'role', 'account_balance', 'coupon_balance', 'point_balance', 'status'];
}
//압금(쿠폰:추가)처리
public function deposit(ClientEntity $entity, string $field, int $amount): ClientEntity
{
if ($amount < 0) {
throw new \Exception("입금액 , 쿠폰 추가갯수가 0보다 작습니다.");
}
return $this->getClientService()->modify($entity, [$field => $entity->getAccountBalance() + $amount]);
}
//출금(쿠폰:사용)처리
public function withdrawal(ClientEntity $entity, string $field, int $amount): ClientEntity
{
if ($entity->getAccountBalance() < $amount) {
throw new \Exception("잔여액,잔여 쿠폰갯수:{$entity->getAccountBalance()} < 출금액 , 사용쿠폰갯수: {$amount}보다 작습니다.");
}
return $this->getClientService()->modify($entity, [$field => $entity->getAccountBalance() - $amount]);
}
public function create(array $formDatas, mixed $entity = new ClientEntity()): ClientEntity
{
$formDatas['role'] = implode(DEFAULTS["DELIMITER_ROLE"], $formDatas['role']);

View File

@ -22,7 +22,7 @@ class CouponService extends CustomerService
{
return new CouponEntity();
}
public function getFields(): array
public function getFormFields(): array
{
return [
"clientinfo_uid",

View File

@ -22,7 +22,7 @@ class PointService extends CustomerService
{
return new PointEntity();
}
public function getFields(): array
public function getFormFields(): array
{
return [
"clientinfo_uid",

View File

@ -22,13 +22,15 @@ class ServiceItemService extends CustomerService
{
return new ServiceItemEntity();
}
public function getFields(): array
public function getFormFields(): array
{
return [
"serviceinfo_uid",
"code",
"item_type",
"item_uid",
"billing_cycle",
"price",
"amount",
"start_at",
"status",
@ -36,10 +38,14 @@ class ServiceItemService extends CustomerService
}
public function getFilterFields(): array
{
return ["serviceinfo_uid", 'item_type', 'item_uid', 'billing_cycle', 'status'];
return ["serviceinfo_uid", 'code', 'item_type', 'item_uid', 'billing_cycle', 'status'];
}
public function getBatchJobFields(): array
{
return ['status'];
}
public function getIndexFields(): array
{
return ['serviceinfo_uid', 'code', 'item_type', 'item_uid', 'billing_cycle', 'price', 'amount', 'start_at', 'status'];
}
}

View File

@ -22,13 +22,12 @@ class ServiceService extends CustomerService
{
return new ServiceEntity();
}
public function getFields(): array
public function getFormFields(): array
{
return [
"clientinfo_uid",
"switch",
"location",
"code",
"type",
"raid",
"billing_at",
@ -39,10 +38,14 @@ class ServiceService extends CustomerService
}
public function getFilterFields(): array
{
return ["clientinfo_uid", 'location', 'switch', 'code', 'type', 'raid', 'status'];
return ["clientinfo_uid", 'location', 'switch', 'type', 'raid', 'status'];
}
public function getBatchJobFields(): array
{
return ['status'];
}
public function getIndexFields(): array
{
return ['clientinfo_uid', 'location', 'switch', 'type', 'raid', 'billing_at', 'start_at', 'status'];
}
}

View File

@ -22,7 +22,7 @@ class DomainService extends EquipmentService
{
return new DomainEntity();
}
public function getFields(): array
public function getFormFields(): array
{
return [
"clientinfo_uid",
@ -38,4 +38,9 @@ class DomainService extends EquipmentService
{
return ['status'];
}
public function getIndexFields(): array
{
return ['clientinfo_uid', 'domain', 'status'];
}
}

View File

@ -22,7 +22,7 @@ class CpuService extends PartService
{
return new CpuEntity();
}
final public function getFields(): array
final public function getFormFields(): array
{
return [
"model",
@ -37,4 +37,8 @@ class CpuService extends PartService
{
return ['status'];
}
public function getIndexFields(): array
{
return ['model', 'status'];
}
}

View File

@ -22,7 +22,7 @@ class DefenceService extends PartService
{
return new DefenceEntity();
}
public function getFields(): array
public function getFormFields(): array
{
return [
"type",
@ -41,4 +41,8 @@ class DefenceService extends PartService
{
return ["type", 'status'];
}
public function getIndexFields(): array
{
return ['type', 'ip', 'accountid', 'domain', 'status'];
}
}

View File

@ -23,7 +23,7 @@ class IpService extends PartService
{
return new IpEntity();
}
public function getFields(): array
public function getFormFields(): array
{
return [
"lineinfo_uid",
@ -39,6 +39,10 @@ class IpService extends PartService
{
return ['status'];
}
public function getIndexFields(): array
{
return ['lineinfo_uid', 'ip', 'status'];
}
public function createByLineInfo(LineEntity $entity, string $ip): IpEntity
{

View File

@ -22,7 +22,7 @@ class LineService extends PartService
{
return new LineEntity();
}
public function getFields(): array
public function getFormFields(): array
{
return [
"clientinfo_uid",
@ -41,4 +41,8 @@ class LineService extends PartService
{
return ['status'];
}
public function getIndexFields(): array
{
return ['clientinfo_uid', 'type', 'title', 'bandwith', 'status', "start_at"];
}
}

View File

@ -22,7 +22,7 @@ class RamService extends PartService
{
return new RamEntity();
}
final public function getFields(): array
final public function getFormFields(): array
{
return [
"model",
@ -37,4 +37,8 @@ class RamService extends PartService
{
return ['status'];
}
public function getIndexFields(): array
{
return ['model', 'status'];
}
}

View File

@ -22,7 +22,7 @@ class SoftwareService extends PartService
{
return new SoftwareEntity();
}
public function getFields(): array
public function getFormFields(): array
{
return [
"type",
@ -39,4 +39,8 @@ class SoftwareService extends PartService
{
return ['type', 'status'];
}
public function getIndexFields(): array
{
return ['type', 'model', 'status'];
}
}

View File

@ -22,7 +22,7 @@ class StorageService extends PartService
{
return new StorageEntity();
}
final public function getFields(): array
final public function getFormFields(): array
{
return [
"model",
@ -37,4 +37,8 @@ class StorageService extends PartService
{
return ['status'];
}
public function getIndexFields(): array
{
return ['model', 'status'];
}
}

View File

@ -23,10 +23,9 @@ class ServerService extends EquipmentService
{
return new ServerEntity();
}
public function getFields(): array
public function getFormFields(): array
{
return [
"clientinfo_uid",
"model",
"status",
"description",
@ -34,9 +33,13 @@ class ServerService extends EquipmentService
}
public function getFilterFields(): array
{
return ["clientinfo_uid", 'model', 'status'];
return ['status'];
}
public function getBatchJobFields(): array
{
return ['status'];
}
public function getIndexFields(): array
{
return ['model', 'status'];
}

View File

@ -24,7 +24,7 @@ class MyLogService extends CommonService
return new MyLogEntity();
}
public function getFields(): array
public function getFormFields(): array
{
return [
"user_uid",
@ -43,7 +43,10 @@ class MyLogService extends CommonService
{
return ['status'];
}
public function getIndexFields(): array
{
return ['user_uid', 'class_name', 'method_name', 'title', 'status', 'created_at', 'content'];
}
public function save($service, string $method, AuthService $myauth, string $title): MyLogEntity
{
$formDatas = [

View File

@ -23,7 +23,7 @@ class UserSNSService extends CommonService
{
return new UserSNSEntity();
}
public function getFields(): array
public function getFormFields(): array
{
return [
"site",
@ -35,7 +35,6 @@ class UserSNSService extends CommonService
"status",
];
}
public function getFilterFields(): array
{
return [];

View File

@ -23,9 +23,9 @@ class UserService extends CommonService
return new UserEntity();
}
public function getFields(): array
public function getFormFields(): array
{
return ['id', 'passwd', 'confirmpassword', $this->getModel()->getTitleField(), 'email', 'mobile', 'role'];
return ['id', 'passwd', 'confirmpassword', 'name', 'email', 'mobile', 'role'];
}
public function getFilterFields(): array
{
@ -35,7 +35,10 @@ class UserService extends CommonService
{
return ['status'];
}
public function getIndexFields(): array
{
return ['id', 'name', 'email', 'mobile', 'role', 'status'];
}
public function create(array $formDatas, mixed $entity = null): UserEntity
{
$formDatas['role'] = implode(DEFAULTS["DELIMITER_ROLE"], $formDatas['role']);

View File

@ -14,7 +14,7 @@
<?= 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): ?>
<?php foreach ($viewDatas['form_fields'] as $field): ?>
<tr>
<th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel($field, $viewDatas) ?></th>
<td nowrap class="text-start">

View File

@ -22,7 +22,7 @@
<thead>
<tr>
<th class="index_head_short_column">번호</th>
<?php foreach ($viewDatas['fields'] as $field): ?>
<?php foreach ($viewDatas['index_fields'] as $field): ?>
<th data-rtc-resizable="<?= $field ?>"><?= $viewDatas['helper']->getListLabel($field, $viewDatas) ?></th>
<?php endforeach ?>
<th class="index_head_short_column">작업</th>
@ -35,7 +35,7 @@
<tr <?= $viewDatas['helper']->getListRowColor($entity) ?>>
<?php $viewDatas['cnt'] = $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt); ?>
<td><?= $viewDatas['helper']->getListButton('modify', $viewDatas) ?></td>
<?php foreach ($viewDatas['fields'] as $field): ?>
<?php foreach ($viewDatas['index_fields'] as $field): ?>
<td><?= $viewDatas['helper']->getFieldView($field, $viewDatas) ?></td>
<?php endforeach ?>
<td nowrap>

View File

@ -14,7 +14,7 @@
<?= 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): ?>
<?php foreach ($viewDatas['form_fields'] as $field): ?>
<tr>
<th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel($field, $viewDatas) ?></th>
<td nowrap class="text-start">

View File

@ -11,7 +11,7 @@
<thead>
<tr>
<th class="index_head_short_column">번호</th>
<?php foreach ($viewDatas['fields'] as $field): ?>
<?php foreach ($viewDatas['index_fields'] as $field): ?>
<th data-rtc-resizable="<?= $field ?>"><?= $viewDatas['helper']->getListLabel($field, $viewDatas) ?></th>
<?php endforeach ?>
<th class="index_head_short_column">작업</th>
@ -24,7 +24,7 @@
<tr <?= $viewDatas['helper']->getListRowColor($entity) ?>>
<?php $viewDatas['cnt'] = $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt); ?>
<td><?= $viewDatas['helper']->getListButton('modify', $viewDatas) ?></td>
<?php foreach ($viewDatas['fields'] as $field): ?>
<?php foreach ($viewDatas['index_fields'] as $field): ?>
<td><?= $viewDatas['helper']->getFieldView($field, $viewDatas) ?></td>
<?php endforeach ?>
<td><?= $viewDatas['helper']->getListButton('delete', $viewDatas) ?></td>

View File

@ -22,7 +22,7 @@
<thead>
<tr>
<th class="index_head_short_column">번호</th>
<?php foreach ($viewDatas['fields'] as $field): ?>
<?php foreach ($viewDatas['index_fields'] as $field): ?>
<th data-rtc-resizable="<?= $field ?>"><?= $viewDatas['helper']->getListLabel($field, $viewDatas) ?></th>
<?php endforeach ?>
<th class="index_head_short_column">작업</th>
@ -35,7 +35,7 @@
<tr <?= $viewDatas['helper']->getListRowColor($entity) ?>>
<?php $viewDatas['cnt'] = $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt); ?>
<td><?= $viewDatas['helper']->getListButton('modify', $viewDatas) ?></td>
<?php foreach ($viewDatas['fields'] as $field): ?>
<?php foreach ($viewDatas['index_fields'] as $field): ?>
<td><?= $viewDatas['helper']->getFieldView($field, $viewDatas) ?></td>
<?php endforeach ?>
<td nowrap>

View File

@ -5,7 +5,7 @@
<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): ?>
<?php foreach ($viewDatas['view_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>

View File

@ -24,7 +24,7 @@
<a href="/admin/equipment/part/cpu"><?= ICONS['SETUP'] ?>CPU정보</a>
</div>
<div class="accordion-item">
<a href="/admin/equipment/part/ram"><?= ICONS['SETUP'] ?>메모리정보</a>
<a href="/admin/equipment/part/ram"><?= ICONS['SETUP'] ?>메모리정보</a>
</div>
<div class="accordion-item">
<a href="/admin/equipment/part/storage"><?= ICONS['SETUP'] ?>저장장치정보</a>