dbmsv2 init...1
This commit is contained in:
parent
4d898df50a
commit
383e3e4ac9
@ -24,9 +24,9 @@ $routes->group('cli', ['namespace' => 'App\Controllers\CLI'], function ($routes)
|
||||
$routes->group('', ['namespace' => 'App\Controllers'], function ($routes) {
|
||||
$routes->get('/', 'Home::index');
|
||||
$routes->group('auth', ['namespace' => 'App\Controllers\Auth'], function ($routes) {
|
||||
$routes->get('login', 'LocalController::create_form');
|
||||
$routes->post('login', 'LocalController::create');
|
||||
$routes->get('google_login', 'GoogleController::create');
|
||||
$routes->get('login', 'LocalController::login_form');
|
||||
$routes->post('login', 'LocalController::login');
|
||||
$routes->get('google_login', 'GoogleController::login');
|
||||
$routes->get('logout', 'LocalController::logout');
|
||||
});
|
||||
});
|
||||
@ -45,8 +45,8 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au
|
||||
$routes->post('batchjob', 'UserController::batchjob', ['filter' => 'authFilter:master']);
|
||||
$routes->post('batchjob_delete', 'UserController::batchjob_delete', ['filter' => 'authFilter:master']);
|
||||
$routes->get('download/(:alpha)', 'UserController::download/$1', ['filter' => 'authFilter:master']);
|
||||
$routes->get('profile_modify/(:num)', 'UserController::profile_modify_form/$1', ['filter' => 'authFilter:manager']);
|
||||
$routes->post('profile_modify/(:num)', 'UserController::profile_modify/$1', ['filter' => 'authFilter:manager']);
|
||||
$routes->get('profile/(:num)', 'UserController::profile_form/$1', ['filter' => 'authFilter:manager']);
|
||||
$routes->post('profile/(:num)', 'UserController::profile/$1', ['filter' => 'authFilter:manager']);
|
||||
});
|
||||
$routes->group('mylog', ['namespace' => 'App\Controllers\Admin'], function ($routes) {
|
||||
$routes->get('/', 'MyLogController::index');
|
||||
|
||||
@ -61,7 +61,7 @@ class ClientController extends CustomerController
|
||||
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
|
||||
return parent::modify_process($entity, $formDatas);
|
||||
}
|
||||
protected function doValidation_process(Validation $validation, string $field, string $rule): Validation
|
||||
protected function doValidation(Validation $validation, string $field, string $rule): Validation
|
||||
{
|
||||
switch ($field) {
|
||||
case 'role':
|
||||
@ -69,7 +69,7 @@ class ClientController extends CustomerController
|
||||
$validation->setRule("{$field}.*", $field, $rule);
|
||||
break;
|
||||
default:
|
||||
$validation = parent::doValidation_process($validation, $field, $rule);
|
||||
$validation = parent::doValidation($validation, $field, $rule);
|
||||
break;
|
||||
}
|
||||
return $validation;
|
||||
|
||||
@ -48,7 +48,7 @@ class PaymentController extends CustomerController
|
||||
}
|
||||
return $this->_clientService;
|
||||
}
|
||||
protected function getResultSuccess_process(string $message = MESSAGES["SUCCESS"], ?string $actionTemplate = null): RedirectResponse|string
|
||||
protected function getResultSuccess(string $message = MESSAGES["SUCCESS"], ?string $actionTemplate = null): RedirectResponse|string
|
||||
{
|
||||
switch ($this->getAction()) {
|
||||
case 'invoice':
|
||||
@ -63,7 +63,7 @@ class PaymentController extends CustomerController
|
||||
$result = view($view_file, ['viewDatas' => $this->getViewDatas()]);
|
||||
break;
|
||||
default:
|
||||
$result = parent::getResultSuccess_process($message, $actionTemplate);
|
||||
$result = parent::getResultSuccess($message, $actionTemplate);
|
||||
break;
|
||||
}
|
||||
return $result;
|
||||
@ -141,9 +141,9 @@ class PaymentController extends CustomerController
|
||||
//각 Field 초기화
|
||||
$this->initAction($this->getService()->getFormFields());
|
||||
$this->invoice_process();
|
||||
return $this->getResultSuccess_process();
|
||||
return $this->getResultSuccess();
|
||||
} catch (\Exception $e) {
|
||||
return $this->getResultFail_process($e->getMessage());
|
||||
return $this->getResultFail($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -37,7 +37,7 @@ class ServerController extends EquipmentController
|
||||
return $this->_helper;
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
protected function getResultSuccess_process(string $message = MESSAGES["SUCCESS"], ?string $actionTemplate = null): RedirectResponse|string
|
||||
protected function getResultSuccess(string $message = MESSAGES["SUCCESS"], ?string $actionTemplate = null): RedirectResponse|string
|
||||
{
|
||||
switch ($this->getAction()) {
|
||||
case 'create_form':
|
||||
@ -54,7 +54,7 @@ class ServerController extends EquipmentController
|
||||
$result = view($view_file, ['viewDatas' => $this->getViewDatas()]);
|
||||
break;
|
||||
default:
|
||||
$result = parent::getResultSuccess_process($message, $actionTemplate);
|
||||
$result = parent::getResultSuccess($message, $actionTemplate);
|
||||
break;
|
||||
}
|
||||
return $result;
|
||||
@ -66,7 +66,13 @@ class ServerController extends EquipmentController
|
||||
if (!$format) {
|
||||
throw new \Exception(__METHOD__ . "에서 code의 format[Server.Prefix.code.format]이 정의되지 않았습니다.");
|
||||
}
|
||||
$this->setFieldDefaultValue('code', $this->getService()->getLastestCode($format, (int)env("Server.Default.code", 0)));
|
||||
//기본값정의
|
||||
$this->setFormDatas([
|
||||
'code' => $this->getService()->getLastestCode(
|
||||
$format,
|
||||
(int)env("Server.Default.code", 0)
|
||||
)
|
||||
]);
|
||||
parent::create_form_process();
|
||||
}
|
||||
//생성
|
||||
|
||||
@ -44,7 +44,7 @@ class Home extends AdminController
|
||||
}
|
||||
return $this->_PaymentService;
|
||||
}
|
||||
protected function getResultSuccess_process(string $message = MESSAGES["SUCCESS"], ?string $actionTemplate = null): RedirectResponse|string
|
||||
protected function getResultSuccess(string $message = MESSAGES["SUCCESS"], ?string $actionTemplate = null): RedirectResponse|string
|
||||
{
|
||||
switch ($this->getAction()) {
|
||||
case 'index':
|
||||
@ -59,7 +59,7 @@ class Home extends AdminController
|
||||
$result = view($view_file, ['viewDatas' => $this->getViewDatas()]);
|
||||
break;
|
||||
default:
|
||||
$result = parent::getResultSuccess_process($message, $actionTemplate);
|
||||
$result = parent::getResultSuccess($message, $actionTemplate);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
@ -68,10 +68,7 @@ class Home extends AdminController
|
||||
//Index,FieldForm관련
|
||||
public function index(): RedirectResponse|string
|
||||
{
|
||||
//각 Field 초기화
|
||||
$this->setAction(__FUNCTION__);
|
||||
//각 Field 초기화
|
||||
$this->initAction($this->getService()->getIndexFields());
|
||||
//Total 서버 현황
|
||||
$this->totalCounts = $this->getService()->getTotalCountsByType();
|
||||
//interval을 기준으로 최근 신규 서비스정보 가져오기
|
||||
@ -82,6 +79,6 @@ class Home extends AdminController
|
||||
$this->unPaids = $this->getPaymentService()->getUnPaidCount();
|
||||
$this->unPaidCount = count($this->unPaids);
|
||||
helper(['form']);
|
||||
return $this->getResultSuccess_process();
|
||||
return $this->getResultSuccess();
|
||||
}
|
||||
}
|
||||
|
||||
@ -36,14 +36,14 @@ class SearchController extends AdminController
|
||||
}
|
||||
return $this->_helper;
|
||||
}
|
||||
protected function getResultSuccess_process(string $message = MESSAGES["SUCCESS"], ?string $actionTemplate = null): RedirectResponse|string
|
||||
protected function getResultSuccess(string $message = MESSAGES["SUCCESS"], ?string $actionTemplate = null): RedirectResponse|string
|
||||
{
|
||||
switch ($this->getAction()) {
|
||||
case 'index':
|
||||
$result = parent::getResultSuccess_process($message, $this->request->getVar('ActionTemplate') ?? $actionTemplate ?? 'search');
|
||||
$result = parent::getResultSuccess($message, $this->request->getVar('ActionTemplate') ?? $actionTemplate ?? 'search');
|
||||
break;
|
||||
default:
|
||||
$result = parent::getResultSuccess_process($message, $actionTemplate);
|
||||
$result = parent::getResultSuccess($message, $actionTemplate);
|
||||
break;
|
||||
}
|
||||
return $result;
|
||||
|
||||
@ -41,7 +41,7 @@ class UserController extends AdminController
|
||||
return $this->_helper;
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
protected function getResultSuccess_process(string $message = MESSAGES["SUCCESS"], ?string $actionTemplate = null): RedirectResponse|string
|
||||
protected function getResultSuccess(string $message = MESSAGES["SUCCESS"], ?string $actionTemplate = null): RedirectResponse|string
|
||||
{
|
||||
switch ($this->getAction()) {
|
||||
case 'profile_modify':
|
||||
@ -60,12 +60,12 @@ class UserController extends AdminController
|
||||
$result = view($view_file, ['viewDatas' => $this->getViewDatas()]);
|
||||
break;
|
||||
default:
|
||||
$result = parent::getResultSuccess_process($message, $actionTemplate);
|
||||
$result = parent::getResultSuccess($message, $actionTemplate);
|
||||
break;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
protected function doValidation_process(Validation $validation, string $field, string $rule): Validation
|
||||
protected function doValidation(Validation $validation, string $field, string $rule): Validation
|
||||
{
|
||||
switch ($field) {
|
||||
case 'role':
|
||||
@ -73,56 +73,59 @@ class UserController extends AdminController
|
||||
$validation->setRule("{$field}.*", $field, $rule);
|
||||
break;
|
||||
default:
|
||||
$validation = parent::doValidation_process($validation, $field, $rule);
|
||||
$validation = parent::doValidation($validation, $field, $rule);
|
||||
break;
|
||||
}
|
||||
return $validation;
|
||||
}
|
||||
//Index,FieldForm관련.
|
||||
final public function profile_modify_form(mixed $uid): RedirectResponse|string
|
||||
final public function profile_form(mixed $uid): RedirectResponse|string
|
||||
{
|
||||
try {
|
||||
//각 Field 초기화
|
||||
$this->setAction(__FUNCTION__);
|
||||
$this->initAction([
|
||||
'fields' => ['id', 'passwd', 'confirmpassword', 'name', 'email', 'mobile'],
|
||||
]);
|
||||
helper(['form']);
|
||||
$this->setFormFields();
|
||||
$this->setFormFilters();
|
||||
$this->setFormRules();
|
||||
$this->setFormOptions();
|
||||
//기본값정의
|
||||
$this->setFormDatas($this->request->getGet());
|
||||
//기존 Entity 가져오기
|
||||
$entity = $this->getService()->getEntity($uid);
|
||||
if (!$entity) {
|
||||
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
|
||||
}
|
||||
$this->modify_form_process($entity);
|
||||
$this->entity = $entity;
|
||||
helper(['form']);
|
||||
$this->forms = ['attributes' => ['method' => "post",], 'hiddens' => []];
|
||||
return $this->getResultSuccess_process();
|
||||
return $this->getResultSuccess();
|
||||
} catch (\Exception $e) {
|
||||
return $this->getResultFail_process($e->getMessage());
|
||||
return $this->getResultFail($e->getMessage());
|
||||
}
|
||||
}
|
||||
final public function profile_modify(int $uid): RedirectResponse|string
|
||||
final public function profile(int $uid): RedirectResponse|string
|
||||
{
|
||||
//Transaction Start
|
||||
$db = \Config\Database::connect();
|
||||
$this->_db->transStart();
|
||||
try {
|
||||
//각 Field 초기화
|
||||
$this->setAction(__FUNCTION__);
|
||||
$this->initAction([
|
||||
'fields' => ['id', 'passwd', 'confirmpassword', 'name', 'email', 'mobile'],
|
||||
]);
|
||||
//전달값받기
|
||||
$formDatas = $this->getFormDatas($this->getControlDatas('actionFields'), $this->request->getPost());
|
||||
$this->setFormFields();
|
||||
$this->setFormFilters();
|
||||
$this->setFormRules();
|
||||
//전달값정의
|
||||
$this->setFormDatas($this->request->getPost());
|
||||
$this->doValidations();
|
||||
//기존 Entity 가져오기
|
||||
$entity = $this->getService()->getEntity($uid);
|
||||
if (!$entity) {
|
||||
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
|
||||
}
|
||||
$this->modify_process($entity, $formDatas);
|
||||
$this->entity = $this->modify_process($entity, $this->getFormDatas());
|
||||
$this->_db->transCommit();
|
||||
return $this->getResultSuccess_process();
|
||||
return $this->getResultSuccess();
|
||||
} catch (\Exception $e) {
|
||||
$this->_db->transRollback();
|
||||
return $this->getResultFail_process($e->getMessage());
|
||||
return $this->getResultFail($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@ namespace App\Controllers\Auth;
|
||||
|
||||
use App\Controllers\CommonController;
|
||||
|
||||
use App\Entities\UserEntity;
|
||||
use App\Helpers\AuthHelper;
|
||||
use CodeIgniter\HTTP\RedirectResponse;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
@ -22,6 +23,7 @@ abstract class AuthController extends CommonController
|
||||
$this->content_title = "사용자인증";
|
||||
}
|
||||
abstract protected function getSNSButton(): string;
|
||||
abstract protected function login_process(array $formDatas): UserEntity;
|
||||
final public function getHelper(): mixed
|
||||
{
|
||||
if (!$this->_helper) {
|
||||
@ -29,21 +31,21 @@ abstract class AuthController extends CommonController
|
||||
}
|
||||
return $this->_helper;
|
||||
}
|
||||
protected function getResultFail_process(string $message = MESSAGES["FAILED"]): RedirectResponse
|
||||
protected function getResultFail(string $message = MESSAGES["FAILED"]): RedirectResponse
|
||||
{
|
||||
if ($this->request->getMethod() === 'POST') {
|
||||
return redirect()->back()->withInput()->with('error', $message);
|
||||
}
|
||||
return redirect()->to($this->getMyAuth()->popPreviousUrl())->with('error', $message);
|
||||
}
|
||||
protected function getResultSuccess_process(string $message = MESSAGES["SUCCESS"], ?string $actionTemplate = null): RedirectResponse|string
|
||||
protected function getResultSuccess(string $message = MESSAGES["SUCCESS"], ?string $actionTemplate = null): RedirectResponse|string
|
||||
{
|
||||
switch ($this->getAction()) {
|
||||
case 'create': //Login처리
|
||||
$result = redirect()->to($this->getMyAuth()->popPreviousUrl())->with('error', $message);
|
||||
break;
|
||||
default:
|
||||
$result = parent::getResultSuccess_process($message, $actionTemplate);
|
||||
$result = parent::getResultSuccess($message, $actionTemplate);
|
||||
break;
|
||||
}
|
||||
return $result;
|
||||
@ -53,10 +55,51 @@ abstract class AuthController extends CommonController
|
||||
return $formDatas;
|
||||
}
|
||||
//로그인화면
|
||||
public function create_form_process(): void
|
||||
public function login_form_process(): void
|
||||
{
|
||||
$this->sns_buttoh = $this->getSNSButton();
|
||||
}
|
||||
public function login_form(): RedirectResponse|string
|
||||
{
|
||||
try {
|
||||
$this->setAction(__FUNCTION__);
|
||||
$this->setFormFields();
|
||||
$this->setFormFilters();
|
||||
$this->setFormRules();
|
||||
$this->setFormOptions();
|
||||
//기본값정의
|
||||
$this->setFormDatas($this->request->getGet());
|
||||
$this->login_form_process();
|
||||
helper(['form']);
|
||||
$this->forms = ['attributes' => ['method' => "post",], 'hiddens' => []];
|
||||
return $this->getResultSuccess();
|
||||
} catch (\Exception $e) {
|
||||
dd($e->getMessage());
|
||||
return $this->getResultFail($e->getMessage());
|
||||
}
|
||||
}
|
||||
//로그인처리
|
||||
public function login(): RedirectResponse|string
|
||||
{
|
||||
//Transaction Start
|
||||
$db = \Config\Database::connect();
|
||||
$db->transStart();
|
||||
try {
|
||||
$this->setAction(__FUNCTION__);
|
||||
$this->setFormFields();
|
||||
$this->setFormFilters();
|
||||
$this->setFormRules();
|
||||
//전달값정의
|
||||
$this->setFormDatas($this->request->getPost());
|
||||
$this->doValidations();
|
||||
$this->entity = $this->login_process($this->getFormDatas());
|
||||
$db->transCommit();
|
||||
return $this->getResultSuccess();
|
||||
} catch (\Exception $e) {
|
||||
$db->transRollback();
|
||||
return $this->getResultFail($e->getMessage());
|
||||
}
|
||||
}
|
||||
//로그아웃
|
||||
final public function logout(): RedirectResponse
|
||||
{
|
||||
|
||||
@ -41,7 +41,7 @@ class GoogleController extends AuthController
|
||||
}
|
||||
|
||||
//로그인처리
|
||||
protected function create_process(array $formDatas): UserEntity
|
||||
protected function login_process(array $formDatas): UserEntity
|
||||
{
|
||||
if (!array_key_exists('access_code', $formDatas) || !$formDatas['access_code']) {
|
||||
throw new \Exception("구글 로그인 실패");
|
||||
|
||||
@ -29,7 +29,7 @@ class LocalController extends AuthController
|
||||
return "";
|
||||
}
|
||||
//로그인처리
|
||||
protected function create_process(array $formDatas): UserEntity
|
||||
protected function login_process(array $formDatas): UserEntity
|
||||
{
|
||||
return $this->getService()->login($formDatas);
|
||||
}
|
||||
|
||||
@ -21,7 +21,6 @@ use Psr\Log\LoggerInterface;
|
||||
|
||||
abstract class CommonController extends BaseController
|
||||
{
|
||||
private $_db;
|
||||
private $_myAuth = null;
|
||||
private ?MyLogService $_myLogService = null;
|
||||
private $_viewDatas = [];
|
||||
@ -38,7 +37,6 @@ abstract class CommonController extends BaseController
|
||||
$this->myAuthName = $this->getMyAuth()->getNameByAuthInfo();
|
||||
$this->myAuthUID = $this->getMyAuth()->getUIDByAuthInfo();
|
||||
}
|
||||
$this->_db = \Config\Database::connect();
|
||||
}
|
||||
final public function __get($name)
|
||||
{
|
||||
@ -95,81 +93,104 @@ abstract class CommonController extends BaseController
|
||||
}
|
||||
return $this->_control['action'];
|
||||
}
|
||||
final protected function initAction(array $actionFields): void
|
||||
//FormFields정의
|
||||
final protected function getFormFields($fields = []): array
|
||||
{
|
||||
//Fields 정의
|
||||
$this->setControlDatas('actionFields', array_key_exists('fields', $actionFields) ? $actionFields['fields'] : []);
|
||||
//Filters 정의
|
||||
$this->setControlDatas('actionFilters', array_key_exists('filters', $actionFields) ? $actionFields['filters'] : []);
|
||||
//Field Rule정의
|
||||
foreach ($this->getControlDatas('actionFields') as $field) {
|
||||
$this->setFormFielRule($field, $this->getFormFieldRule_process($this->getAction(), $field));
|
||||
return array_merge($fields, $this->getControlDatas('actionFields'));
|
||||
}
|
||||
final protected function setFormFields(?array $fields = null): void
|
||||
{
|
||||
switch ($this->getAction()) {
|
||||
case 'index':
|
||||
$actionFields = $this->getService()->getIndexFields();
|
||||
break;
|
||||
case 'view':
|
||||
$actionFields = $this->getService()->getViewFields();
|
||||
break;
|
||||
default:
|
||||
$actionFields = $this->getService()->getFormFields();
|
||||
break;
|
||||
}
|
||||
//Form용 Options정의
|
||||
foreach ($this->getControlDatas('actionFilters') as $field) {
|
||||
$options = [];
|
||||
foreach ($this->getFormFieldOption_process($field) as $entity) {
|
||||
$options[$entity->getPK()] = $entity;
|
||||
}
|
||||
$this->setFormFieldOptions($field, $options);
|
||||
$this->setControlDatas('actionFields', is_array($fields) ? $fields : $actionFields);
|
||||
}
|
||||
final protected function getFormFilters($filters = []): array
|
||||
{
|
||||
return array_merge($filters, $this->getControlDatas('actionFilters'));
|
||||
}
|
||||
final protected function setFormFilters(?array $filters = null): void
|
||||
{
|
||||
switch ($this->getAction()) {
|
||||
case 'index':
|
||||
$actionFilters = $this->getService()->getIndexFilters();
|
||||
break;
|
||||
case 'view':
|
||||
$actionFilters = $this->getService()->getViewFilters();
|
||||
break;
|
||||
default:
|
||||
$actionFilters = $this->getService()->getFormFilters();
|
||||
break;
|
||||
}
|
||||
//일괄작업용 Fields정의
|
||||
$this->setControlDatas(
|
||||
'batchjob_fields',
|
||||
array_key_exists('batchjob_fields', $actionFields) ? $actionFields['batchjob_fields'] : $this->getService()->getBatchjobFields()
|
||||
);
|
||||
//일괄작업용 버튼정의
|
||||
$this->setControlDatas(
|
||||
'batchjob_buttions',
|
||||
array_key_exists('batchjob_buttions', $actionFields) ? $actionFields['batchjob_buttions'] : $this->getService()->getBatchjobButtons()
|
||||
);
|
||||
$this->setControlDatas('actionFilters', is_array($filters) ? $filters : $actionFilters);
|
||||
}
|
||||
//FormRules정의
|
||||
final protected function setFormFielRule($field, string $rule)
|
||||
final protected function getFormRules(array $rules = []): array
|
||||
{
|
||||
//기존 Filter Rules 가져와서 field에 해당하는 rule이 없으면 field를 filter_rules 전체 적용
|
||||
$allRules = $this->getControlDatas('field_rules') ?? [];
|
||||
$allRules[$field] = $rule;
|
||||
$this->setControlDatas('field_rules', $allRules);
|
||||
foreach ($this->getControlDatas('field_rules') as $field => $rule) {
|
||||
$rules[$field] = $rule;
|
||||
}
|
||||
return $rules;
|
||||
}
|
||||
final protected function setFormRules(): void
|
||||
{
|
||||
$rules = [];
|
||||
foreach ($this->getControlDatas('actionFields') as $field) {
|
||||
$rules = $this->getFormRule($field, $rules);
|
||||
}
|
||||
$this->setControlDatas('field_rules', $rules);
|
||||
}
|
||||
//FormOptions정의
|
||||
final protected function setFormFieldOptions($field, array $options)
|
||||
final protected function getFormOptions(array $options = []): array
|
||||
{
|
||||
foreach ($this->getControlDatas('field_optons') as $field => $option) {
|
||||
$options[$field] = $option;
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
final protected function setFormOptions(): void
|
||||
{
|
||||
//기존 Filter Options 가져와서 field에 해당하는 option이 없으면 field를 key로 배열추가 후 다시 filter_options 전체 적용
|
||||
$allOptions = $this->getControlDatas('filter_optons') ?? [];
|
||||
$allOptions[$field] = $options;
|
||||
$this->setControlDatas('filter_optons', $allOptions);
|
||||
$options = [];
|
||||
foreach ($this->getControlDatas('actionFilters') as $field) {
|
||||
$options[$field] = $this->getFormOption($field, $options);
|
||||
}
|
||||
$this->setControlDatas('field_optons', $options);
|
||||
}
|
||||
//전체 FormDatas 전달값받기
|
||||
final protected function getFormDatas(array $fields, array $requestDatas, array $formDatas = []): array
|
||||
//FormDatas 전달값,Default값
|
||||
final protected function getFormDatas($formDatas = []): array
|
||||
{
|
||||
foreach ($fields as $field) {
|
||||
//Post값이 null이면 formDatas에서 해당하는 default값이 있는지 확인후 넣고,없으면 최종적으로 null
|
||||
$datas = $requestDatas[$field] ?? null;
|
||||
if ($datas !== null) {
|
||||
$formDatas[$field] = $datas;
|
||||
} else {
|
||||
$formDatas = $this->getFormData_process($field, $requestDatas, $formDatas);
|
||||
}
|
||||
foreach ($this->getControlDatas('form_datas') as $field => $value) {
|
||||
$formDatas[$field] = $value;
|
||||
}
|
||||
return $formDatas;
|
||||
}
|
||||
final protected function setFieldDefaultValue(string $field, mixed $default): void
|
||||
final protected function setFormDatas(array $requestDatas, array $formDatas = []): void
|
||||
{
|
||||
if (array_key_exists('field_default_values', $this->_control)) {
|
||||
$this->_control['field_default_values'] = [];
|
||||
foreach ($this->getControlDatas('actionFields') as $field) {
|
||||
$formDatas = $this->getFormData($field, $requestDatas, $formDatas);
|
||||
}
|
||||
$this->_control['field_default_values'][$field] = $default;
|
||||
// echo var_dump($requestDatas);
|
||||
// dd($formDatas);
|
||||
$this->setControlDatas('form_datas', $formDatas);
|
||||
}
|
||||
//FormDatas 검증
|
||||
final protected function doValidation(array $formDatas): void
|
||||
final protected function doValidations(): void
|
||||
{
|
||||
//변경할 값 확인 : Upload된 파일 검증시 $this->request->getPOST()보다 먼처 체크필요
|
||||
$validation = service('validation');
|
||||
foreach ($this->getControlDatas('field_rules') as $field => $rule) {
|
||||
$validation = $this->doValidation_process($validation, $field, $rule);
|
||||
$validation = $this->doValidation($validation, $field, $rule);
|
||||
}
|
||||
if (!$validation->run($formDatas)) {
|
||||
if (!$validation->run($this->getFormDatas())) {
|
||||
throw new \Exception("{$this->getService()->getClassName()} 작업 데이터 검증 오류발생\n" . implode(
|
||||
"\n",
|
||||
$validation->getErrors()
|
||||
@ -177,309 +198,28 @@ abstract class CommonController extends BaseController
|
||||
}
|
||||
// return $validation->getValidated();
|
||||
}
|
||||
//생성 기본기능
|
||||
final public function create_form(): RedirectResponse|string
|
||||
{
|
||||
try {
|
||||
//각 Field 초기화
|
||||
$this->setAction(__FUNCTION__);
|
||||
//각 Field 초기화
|
||||
$this->initAction($this->getService()->getFormFields());
|
||||
$this->create_form_process();
|
||||
//actionFilters에 해당하는 값이 있을 경우 정의
|
||||
helper(['form']);
|
||||
$this->forms = ['attributes' => ['method' => "post",], 'hiddens' => []];
|
||||
return $this->getResultSuccess_process();
|
||||
} catch (\Exception $e) {
|
||||
return $this->getResultFail_process($e->getMessage());
|
||||
}
|
||||
}
|
||||
final public function create(): RedirectResponse|string
|
||||
{
|
||||
$this->_db->transStart();
|
||||
try {
|
||||
//각 Field 초기화
|
||||
$this->setAction(__FUNCTION__);
|
||||
//각 Field 초기화
|
||||
$this->initAction($this->getService()->getFormFields());
|
||||
//전달값받기
|
||||
$formDatas = $this->getFormDatas($this->getControlDatas('actionFields'), $this->request->getPost());
|
||||
$formDatas = $this->create_validate_process($formDatas);
|
||||
$this->entity = $this->create_process($formDatas);
|
||||
$this->_db->transCommit();
|
||||
return $this->getResultSuccess_process();
|
||||
} catch (\Exception $e) {
|
||||
$this->_db->transRollback();
|
||||
return $this->getResultFail_process($e->getMessage());
|
||||
}
|
||||
}
|
||||
//수정 기본기능
|
||||
final public function modify_form(mixed $uid): RedirectResponse|string
|
||||
{
|
||||
try {
|
||||
//각 Field 초기화
|
||||
$this->setAction(__FUNCTION__);
|
||||
//각 Field 초기화
|
||||
$this->initAction($this->getService()->getFormFields());
|
||||
//기존 Entity 가져오기
|
||||
$entity = $this->getService()->getEntity($uid);
|
||||
if (!$entity) {
|
||||
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
|
||||
}
|
||||
$this->entity = $this->modify_form_process($entity);
|
||||
helper(['form']);
|
||||
$this->forms = ['attributes' => ['method' => "post",], 'hiddens' => []];
|
||||
return $this->getResultSuccess_process();
|
||||
} catch (\Exception $e) {
|
||||
return $this->getResultFail_process($e->getMessage());
|
||||
}
|
||||
}
|
||||
final public function modify(int $uid): RedirectResponse|string
|
||||
{
|
||||
//Transaction Start
|
||||
$this->_db->transStart();
|
||||
try {
|
||||
//각 Field 초기화
|
||||
$this->setAction(__FUNCTION__);
|
||||
//각 Field 초기화
|
||||
$this->initAction($this->getService()->getFormFields());
|
||||
//기존 Entity 가져오기
|
||||
$entity = $this->getService()->getEntity($uid);
|
||||
if (!$entity) {
|
||||
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
|
||||
}
|
||||
//전달값받기
|
||||
$formDatas = $this->getFormDatas($this->getControlDatas('actionFields'), $this->request->getPost());
|
||||
$formDatas = $this->modify_validate_process($formDatas);
|
||||
$this->entity = $this->modify_process($entity, $formDatas);
|
||||
$this->_db->transCommit();
|
||||
return $this->getResultSuccess_process();
|
||||
} catch (\Exception $e) {
|
||||
$this->_db->transRollback();
|
||||
return $this->getResultFail_process($e->getMessage());
|
||||
}
|
||||
}
|
||||
//단일필드작업기능
|
||||
final public function toggle(mixed $uid, string $field): RedirectResponse|string
|
||||
{
|
||||
//Transaction Start
|
||||
$this->_db->transStart();
|
||||
try {
|
||||
//각 Field 초기화
|
||||
$this->setAction(__FUNCTION__);
|
||||
//각 Field 초기화:조건항목 Field는 한개만 존재하므로 Field와 Rule을 정의
|
||||
$this->initAction(['fields' => [$field], 'filters' => [$field]]);
|
||||
//기존 Entity 가져오기
|
||||
$entity = $this->getService()->getEntity($uid);
|
||||
if (!$entity) {
|
||||
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
|
||||
}
|
||||
//전달값받기
|
||||
$formDatas = $this->getFormDatas($this->getControlDatas('actionFields'), $this->request->getVar());
|
||||
$formDatas = $this->toggle_validate_process($formDatas);
|
||||
// echo var_dump($this->getControlDatas());
|
||||
// dd($formDatas);
|
||||
$this->entity = $this->toggle_process($entity, $formDatas);
|
||||
$this->_db->transCommit();
|
||||
return $this->getResultSuccess_process();
|
||||
} catch (\Exception $e) {
|
||||
$this->_db->transRollback();
|
||||
return $this->getResultFail_process($e->getMessage());
|
||||
}
|
||||
}
|
||||
//일괄처리작업기능
|
||||
protected function batchjob_pre_process(): array
|
||||
{
|
||||
$selectedFields = [];
|
||||
//getBatchJobFields를 이용해서 선택된 Field 와 값정의
|
||||
$formDatas = [];
|
||||
foreach ($this->getService()->getBatchjobFields() as $field) {
|
||||
$value = $this->request->getPost($field);
|
||||
if ($value) {
|
||||
$selectedFields[] = $field;
|
||||
$formDatas[$field] = $value;
|
||||
}
|
||||
}
|
||||
if (!count($selectedFields)) {
|
||||
throw new \Exception("변경할 조건항목을 선택하셔야합니다.");
|
||||
}
|
||||
//변경할 UIDS 정의
|
||||
$uids = $this->request->getPost('batchjob_uids[]');
|
||||
if (!is_array($uids) || !count($uids)) {
|
||||
throw new \Exception("적용할 리스트을 선택하셔야합니다.");
|
||||
}
|
||||
return [$selectedFields, $formDatas, $uids];
|
||||
}
|
||||
final public function batchjob(): RedirectResponse|string
|
||||
{
|
||||
//Transaction Start
|
||||
$this->_db->transStart();
|
||||
try {
|
||||
//각 Field 초기화
|
||||
$this->setAction(__FUNCTION__);
|
||||
list($selectedFields, $formDatas, $uids) = $this->batchjob_pre_process();
|
||||
//각 Field 초기화:조건항목 Field와 Rule을 정의
|
||||
$this->initAction(['fields' => $selectedFields, 'filters' => $selectedFields]);
|
||||
//전달값받기
|
||||
$formDatas = $this->getFormDatas($this->getControlDatas('actionFields'), $this->request->getPost());
|
||||
$formDatas = $this->batchjob_validate_process($formDatas);
|
||||
$entities = [];
|
||||
foreach ($uids as $uid) {
|
||||
//기존 Entity 가져오기
|
||||
$entity = $this->getService()->getEntity($uid);
|
||||
if (!$entity) {
|
||||
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
|
||||
}
|
||||
$entities[] = $this->batchjob_process($entity, $formDatas);
|
||||
}
|
||||
$this->entities = $entities;
|
||||
$this->_db->transCommit();
|
||||
LogCollector::debug(sprintf("%s에서 총 %s개중 %s개 일괄작업을 완료하였습니다.", __METHOD__, count($uids), count($this->entities)));
|
||||
return $this->getResultSuccess_process();
|
||||
} catch (\Exception $e) {
|
||||
$this->_db->transRollback();
|
||||
return $this->getResultFail_process($e->getMessage());
|
||||
}
|
||||
}
|
||||
final public function delete(mixed $uid): RedirectResponse|string
|
||||
{
|
||||
//Transaction Start
|
||||
$this->_db->transStart();
|
||||
try {
|
||||
//Action 정의:삭제는 다른 초기화 필요없음
|
||||
$this->setAction(__FUNCTION__);
|
||||
//기존 Entity 가져오기
|
||||
$entity = $this->getService()->getEntity($uid);
|
||||
if (!$entity) {
|
||||
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
|
||||
}
|
||||
$this->delete_process($entity);
|
||||
$this->_db->transCommit();
|
||||
return $this->getResultSuccess_process();
|
||||
} catch (\Exception $e) {
|
||||
$this->_db->transRollback();
|
||||
return $this->getResultFail_process($e->getMessage());
|
||||
}
|
||||
}
|
||||
//일괄삭제
|
||||
final public function batchjob_delete(): RedirectResponse|string
|
||||
{
|
||||
//Transaction Start
|
||||
$this->_db->transStart();
|
||||
try {
|
||||
//Action 정의:삭제는 다른 초기화 필요없음
|
||||
$this->setAction(__FUNCTION__);
|
||||
//변경할 UIDS
|
||||
$uids = $this->request->getPost('batchjob_uids[]');
|
||||
if (!is_array($uids) || !count($uids)) {
|
||||
throw new \Exception("적용할 리스트를 선택하셔야합니다.");
|
||||
}
|
||||
$entities = [];
|
||||
foreach ($uids as $uid) {
|
||||
//기존 Entity 가져오기
|
||||
$entity = $this->getService()->getEntity($uid);
|
||||
if (!$entity) {
|
||||
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
|
||||
}
|
||||
$entities[] = $this->batchjob_delete_process($entity);
|
||||
}
|
||||
$this->entities = $entities;
|
||||
$this->_db->transCommit();
|
||||
LogCollector::debug(sprintf("%s에서 총 %s개중 %s개 일괄삭제를 완료하였습니다.", __METHOD__, count($uids), count($this->entities)));
|
||||
return $this->getResultSuccess_process();
|
||||
} catch (\Exception $e) {
|
||||
$this->_db->transRollback();
|
||||
return $this->getResultFail_process($e->getMessage());
|
||||
}
|
||||
}
|
||||
final public function view(string $uid): RedirectResponse|string
|
||||
{
|
||||
try {
|
||||
//Action 정의
|
||||
//각 Field 초기화
|
||||
$this->setAction(__FUNCTION__);
|
||||
//각 Field 초기화
|
||||
$this->initAction($this->getService()->getViewFields());
|
||||
//기존 Entity 가져오기
|
||||
$entity = $this->getService()->getEntity($uid);
|
||||
if (!$entity) {
|
||||
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
|
||||
}
|
||||
$this->entity = $this->view_process($entity);
|
||||
helper(['form']);
|
||||
$this->forms = ['attributes' => ['method' => "post",], 'hiddens' => []];
|
||||
return $this->getResultSuccess_process();
|
||||
} catch (\Exception $e) {
|
||||
return $this->getResultFail_process($e->getMessage());
|
||||
}
|
||||
}
|
||||
//OUPUT Document 관련
|
||||
private function download_document(string $document_type, mixed $loaded_data): array
|
||||
{
|
||||
$full_path = WRITEPATH . DIRECTORY_SEPARATOR . "excel";
|
||||
switch ($document_type) {
|
||||
case 'excel':
|
||||
$file_name = sprintf("%s_%s.xlsx", $this->getService()->getClassName(), date('Y-m-d_Hm'));
|
||||
$writer = IOFactory::createWriter($loaded_data, 'Xlsx');
|
||||
$writer->save($full_path . DIRECTORY_SEPARATOR . $file_name);
|
||||
break;
|
||||
case 'pdf':
|
||||
$file_name = sprintf("%s_%s.pdf", $this->getService()->getClassName(), date('Y-m-d_Hm'));
|
||||
$writer = new Mpdf($loaded_data);
|
||||
$writer->save($full_path . DIRECTORY_SEPARATOR . $file_name);
|
||||
break;
|
||||
}
|
||||
return array($full_path, $file_name);
|
||||
}
|
||||
// Download
|
||||
final public function download(string $output_type, mixed $uid = false): DownloadResponse|RedirectResponse|string
|
||||
{
|
||||
try {
|
||||
//각 Field 초기화
|
||||
$this->setAction(__FUNCTION__);
|
||||
//각 Field 초기화
|
||||
$this->initAction($this->getService()->getIndexFields());
|
||||
//URL처리
|
||||
// $this->uri = $this->request->getUri();
|
||||
switch ($output_type) {
|
||||
case 'excel':
|
||||
case 'pdf':
|
||||
helper(['form']);
|
||||
$this->index_process();
|
||||
$html = $this->getResultSuccess_process();
|
||||
//data loading
|
||||
$reader = new Html();
|
||||
$loaded_data = $reader->loadFromString($html);
|
||||
list($full_path, $file_name) = $this->download_document($output_type, $loaded_data);
|
||||
$full_path .= DIRECTORY_SEPARATOR . $file_name;
|
||||
break;
|
||||
default:
|
||||
if (!$uid) {
|
||||
throw new \Exception("{$output_type}은 반드시 uid의 값이 필요합니다.");
|
||||
}
|
||||
$entity = $this->getService()->getEntity($uid);
|
||||
if (!$entity) {
|
||||
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
|
||||
}
|
||||
$this->entity = $entity;
|
||||
list($file_name, $uploaded_filename) = $entity->getDownlaodFile();
|
||||
$full_path = WRITEPATH . DIRECTORY_SEPARATOR . "uploads" . DIRECTORY_SEPARATOR . $uploaded_filename;
|
||||
break;
|
||||
}
|
||||
return $this->response->download($full_path, null)->setFileName($file_name);
|
||||
} catch (\Exception $e) {
|
||||
return $this->getResultFail_process($e->getMessage());
|
||||
}
|
||||
}
|
||||
//공통 기본 기능
|
||||
|
||||
//추가 개별 처리 기능
|
||||
//공통 필수기능
|
||||
//FieldForm관련용
|
||||
protected function getFormFieldOption_process(string $field, array $options = []): array
|
||||
protected function getFormRule(string $field, array $rules = []): array
|
||||
{
|
||||
if (is_array($field)) {
|
||||
throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true));
|
||||
}
|
||||
switch ($field) {
|
||||
default:
|
||||
$rules[$field] = $this->getService()->getFormRule($this->getAction(), $field);
|
||||
break;
|
||||
}
|
||||
if (!is_array($rules)) {
|
||||
throw new \Exception(__FUNCTION__ . "에서 {$field}의 Rules 값이 array가 아닙니다.\n" . var_export($rules, true));
|
||||
}
|
||||
return $rules;
|
||||
}
|
||||
protected function getFormOption(string $field, array $options = []): array
|
||||
{
|
||||
switch ($field) {
|
||||
default:
|
||||
$options = $this->getService()->getFormFieldOption($field, $options);
|
||||
$options = $this->getService()->getFormOption($field, $options);
|
||||
break;
|
||||
}
|
||||
if (!is_array($options)) {
|
||||
@ -487,24 +227,17 @@ abstract class CommonController extends BaseController
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
protected function getFormFieldRule_process(string $action, string $field): string
|
||||
//FormData Field별 전달값 처리
|
||||
protected function getFormData(string $field, array $requestDatas, array $formDatas): array
|
||||
{
|
||||
if (is_array($field)) {
|
||||
throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true));
|
||||
}
|
||||
switch ($field) {
|
||||
default:
|
||||
$rule = $this->getService()->getFormFieldRule($action, $field);
|
||||
$formDatas[$field] = $requestDatas[$field] ?? null;
|
||||
break;
|
||||
}
|
||||
return $rule;
|
||||
}
|
||||
//FormData Field별 전달값 처리
|
||||
protected function getFormData_process(string $field, array $requestDatas, array $formDatas): array
|
||||
{
|
||||
return $formDatas;
|
||||
}
|
||||
protected function doValidation_process(Validation $validation, string $field, string $rule): Validation
|
||||
protected function doValidation(Validation $validation, string $field, string $rule): Validation
|
||||
{
|
||||
switch ($field) {
|
||||
default:
|
||||
@ -514,7 +247,7 @@ abstract class CommonController extends BaseController
|
||||
return $validation;
|
||||
}
|
||||
//Process Result처리
|
||||
protected function getResultFail_process(string $message = MESSAGES["FAILED"]): RedirectResponse
|
||||
protected function getResultFail(string $message = MESSAGES["FAILED"]): RedirectResponse
|
||||
{
|
||||
LogCollector::debug($message);
|
||||
$this->getMyLogService()->save($this->getService()->getClassName(), $this->getAction(), $message, $this->getMyAuth()->getUIDByAuthInfo());
|
||||
@ -523,7 +256,7 @@ abstract class CommonController extends BaseController
|
||||
}
|
||||
return redirect()->to($this->getMyAuth()->popPreviousUrl())->with('error', $message);
|
||||
}
|
||||
protected function getResultSuccess_process(string $message = MESSAGES["SUCCESS"], ?string $actionTemplate = null): RedirectResponse|string
|
||||
protected function getResultSuccess(string $message = MESSAGES["SUCCESS"], ?string $actionTemplate = null): RedirectResponse|string
|
||||
{
|
||||
helper(['form']);
|
||||
switch ($this->getControlDatas('action')) {
|
||||
@ -555,90 +288,294 @@ abstract class CommonController extends BaseController
|
||||
return $result;
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
//생성관련
|
||||
//생성 기본기능
|
||||
protected function create_form_process(): void {}
|
||||
protected function create_validate_process(array $formDatas): array
|
||||
public function create_form(): RedirectResponse|string
|
||||
{
|
||||
$this->doValidation($formDatas);
|
||||
return $formDatas;
|
||||
try {
|
||||
$this->setAction(__FUNCTION__);
|
||||
$this->setFormFields();
|
||||
$this->setFormFilters();
|
||||
$this->setFormRules();
|
||||
$this->setFormOptions();
|
||||
//기본값정의
|
||||
$this->setFormDatas($this->request->getGet());
|
||||
$this->create_form_process();
|
||||
helper(['form']);
|
||||
$this->forms = ['attributes' => ['method' => "post",], 'hiddens' => []];
|
||||
return $this->getResultSuccess();
|
||||
} catch (\Exception $e) {
|
||||
// dd($e->getMessage());
|
||||
return $this->getResultFail($e->getMessage());
|
||||
}
|
||||
}
|
||||
protected function create_process(array $formDatas): mixed
|
||||
{
|
||||
return $this->getService()->create($formDatas);
|
||||
}
|
||||
//수정관련
|
||||
public function create(): RedirectResponse|string
|
||||
{
|
||||
$db = \Config\Database::connect();
|
||||
$db->transStart();
|
||||
try {
|
||||
$this->setAction(__FUNCTION__);
|
||||
$this->setFormFields();
|
||||
$this->setFormFilters();
|
||||
$this->setFormRules();
|
||||
//전달값정의
|
||||
$this->setFormDatas($this->request->getPost());
|
||||
$this->doValidations();
|
||||
$this->entity = $this->create_process($this->getFormDatas());
|
||||
$db->transCommit();
|
||||
return $this->getResultSuccess();
|
||||
} catch (\Exception $e) {
|
||||
$db->transRollback();
|
||||
return $this->getResultFail($e->getMessage());
|
||||
}
|
||||
}
|
||||
//수정 기본기능
|
||||
protected function modify_form_process(mixed $entity): mixed
|
||||
{
|
||||
return $entity;
|
||||
}
|
||||
protected function modify_validate_process(array $formDatas): array
|
||||
public function modify_form(mixed $uid): RedirectResponse|string
|
||||
{
|
||||
$this->doValidation($formDatas);
|
||||
return $formDatas;
|
||||
try {
|
||||
$this->setAction(__FUNCTION__);
|
||||
$this->setFormFields();
|
||||
$this->setFormFilters();
|
||||
$this->setFormRules();
|
||||
$this->setFormOptions();
|
||||
//기본값정의
|
||||
$this->setFormDatas($this->request->getGet());
|
||||
//기존 Entity 가져오기
|
||||
$entity = $this->getService()->getEntity($uid);
|
||||
if (!$entity) {
|
||||
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
|
||||
}
|
||||
$this->entity = $this->modify_form_process($uid);
|
||||
helper(['form']);
|
||||
$this->forms = ['attributes' => ['method' => "post",], 'hiddens' => []];
|
||||
return $this->getResultSuccess();
|
||||
} catch (\Exception $e) {
|
||||
return $this->getResultFail($e->getMessage());
|
||||
}
|
||||
}
|
||||
protected function modify_process(mixed $entity, array $formDatas): mixed
|
||||
{
|
||||
return $this->getService()->modify($entity, $formDatas);
|
||||
}
|
||||
//단일필드작업기능
|
||||
protected function toggle_validate_process(array $formDatas): array
|
||||
public function modify(int $uid): RedirectResponse|string
|
||||
{
|
||||
$this->doValidation($formDatas);
|
||||
return $formDatas;
|
||||
//Transaction Start
|
||||
$db = \Config\Database::connect();
|
||||
$db->transStart();
|
||||
try {
|
||||
$this->setAction(__FUNCTION__);
|
||||
$this->setFormFields();
|
||||
$this->setFormFilters();
|
||||
$this->setFormRules();
|
||||
//전달값정의
|
||||
$this->setFormDatas($this->request->getPost());
|
||||
$this->doValidations();
|
||||
//기존 Entity 가져오기
|
||||
$entity = $this->getService()->getEntity($uid);
|
||||
if (!$entity) {
|
||||
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
|
||||
}
|
||||
$this->entity = $this->modify_process($entity, $this->getFormDatas());
|
||||
$db->transCommit();
|
||||
return $this->getResultSuccess();
|
||||
} catch (\Exception $e) {
|
||||
$db->transRollback();
|
||||
return $this->getResultFail($e->getMessage());
|
||||
}
|
||||
}
|
||||
//단일필드작업기능
|
||||
protected function toggle_process(mixed $entity, array $formDatas): mixed
|
||||
{
|
||||
return $this->getService()->modify($entity, $formDatas);
|
||||
}
|
||||
//일괄처리작업기능
|
||||
protected function batchjob_validate_process(array $formDatas): array
|
||||
public function toggle(mixed $uid, string $field): RedirectResponse|string
|
||||
{
|
||||
$this->doValidation($formDatas);
|
||||
return $formDatas;
|
||||
//Transaction Start
|
||||
$db = \Config\Database::connect();
|
||||
$db->transStart();
|
||||
try {
|
||||
$this->setAction(__FUNCTION__);
|
||||
$this->setFormFields([$field]);
|
||||
$this->setFormFilters([$field]);
|
||||
$this->setFormRules();
|
||||
//기본값정의
|
||||
$this->setFormDatas($this->request->getGet());
|
||||
//기존 Entity 가져오기
|
||||
$entity = $this->getService()->getEntity($uid);
|
||||
if (!$entity) {
|
||||
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
|
||||
}
|
||||
$this->entity = $this->toggle_process($entity, $this->getFormDatas());
|
||||
$db->transCommit();
|
||||
return $this->getResultSuccess();
|
||||
} catch (\Exception $e) {
|
||||
$db->transRollback();
|
||||
return $this->getResultFail($e->getMessage());
|
||||
}
|
||||
}
|
||||
protected function batchjob_process($entity, array $formDatas): mixed
|
||||
//일괄처리작업기능
|
||||
protected function batchjob_process(mixed $entity, array $formDatas): mixed
|
||||
{
|
||||
return $this->getService()->modify($entity, $formDatas);
|
||||
}
|
||||
protected function batchjob_pre_process(): array
|
||||
{
|
||||
$selectedFields = [];
|
||||
//getBatchJobFields를 이용해서 선택된 Field 와 값정의
|
||||
$formDatas = [];
|
||||
foreach ($this->getService()->getBatchjobFields() as $field) {
|
||||
$value = $this->request->getPost($field);
|
||||
if ($value) {
|
||||
$selectedFields[] = $field;
|
||||
$formDatas[$field] = $value;
|
||||
}
|
||||
}
|
||||
if (!count($selectedFields)) {
|
||||
throw new \Exception("변경할 조건항목을 선택하셔야합니다.");
|
||||
}
|
||||
//변경할 UIDS 정의
|
||||
$uids = $this->request->getPost('batchjob_uids[]');
|
||||
if (!is_array($uids) || !count($uids)) {
|
||||
throw new \Exception("적용할 리스트을 선택하셔야합니다.");
|
||||
}
|
||||
return [$selectedFields, $formDatas, $uids];
|
||||
}
|
||||
public function batchjob(): RedirectResponse|string
|
||||
{
|
||||
//Transaction Start
|
||||
$db = \Config\Database::connect();
|
||||
$db->transStart();
|
||||
try {
|
||||
$this->setAction(__FUNCTION__);
|
||||
list($selectedFields, $formDatas, $uids) = $this->batchjob_pre_process();
|
||||
$this->setFormFields($selectedFields);
|
||||
$this->setFormFilters($selectedFields);
|
||||
$this->setFormRules();
|
||||
//기본값정의
|
||||
$this->setFormDatas($this->request->getGet());
|
||||
$entities = [];
|
||||
foreach ($uids as $uid) {
|
||||
//기존 Entity 가져오기
|
||||
$entity = $this->getService()->getEntity($uid);
|
||||
if (!$entity) {
|
||||
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
|
||||
}
|
||||
$entities[] = $this->batchjob_process($entity, $formDatas);
|
||||
}
|
||||
$this->entities = $entities;
|
||||
$db->transCommit();
|
||||
LogCollector::debug(sprintf("%s에서 총 %s개중 %s개 일괄작업을 완료하였습니다.", __METHOD__, count($uids), count($this->entities)));
|
||||
return $this->getResultSuccess();
|
||||
} catch (\Exception $e) {
|
||||
$db->transRollback();
|
||||
return $this->getResultFail($e->getMessage());
|
||||
}
|
||||
}
|
||||
//삭제관련
|
||||
protected function delete_process(mixed $entity): mixed
|
||||
{
|
||||
return $this->getService()->delete($entity);
|
||||
}
|
||||
public function delete(mixed $uid): RedirectResponse|string
|
||||
{
|
||||
//Transaction Start
|
||||
$db = \Config\Database::connect();
|
||||
$db->transStart();
|
||||
try {
|
||||
$this->setAction(__FUNCTION__);
|
||||
//기존 Entity 가져오기
|
||||
$entity = $this->getService()->getEntity($uid);
|
||||
if (!$entity) {
|
||||
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
|
||||
}
|
||||
$this->delete_process($entity);
|
||||
$db->transCommit();
|
||||
return $this->getResultSuccess();
|
||||
} catch (\Exception $e) {
|
||||
$db->transRollback();
|
||||
return $this->getResultFail($e->getMessage());
|
||||
}
|
||||
}
|
||||
//일괄삭제관련
|
||||
protected function batchjob_delete_process(mixed $entity, array $entities = []): mixed
|
||||
protected function batchjob_delete_process(mixed $entity): mixed
|
||||
{
|
||||
return $this->getService()->delete($entity);
|
||||
}
|
||||
protected function batchjob_delete_pre_process(): array
|
||||
{
|
||||
//변경할 UIDS
|
||||
$uids = $this->request->getPost('batchjob_uids[]');
|
||||
if (!is_array($uids) || !count($uids)) {
|
||||
throw new \Exception("적용할 리스트를 선택하셔야합니다.");
|
||||
}
|
||||
return $uids;
|
||||
}
|
||||
public function batchjob_delete(): RedirectResponse|string
|
||||
{
|
||||
//Transaction Start
|
||||
$db = \Config\Database::connect();
|
||||
$db->transStart();
|
||||
try {
|
||||
$this->setAction(__FUNCTION__);
|
||||
$uids = $this->batchjob_delete_pre_process();
|
||||
$entities = [];
|
||||
foreach ($uids as $uid) {
|
||||
//기존 Entity 가져오기
|
||||
$entity = $this->getService()->getEntity($uid);
|
||||
if (!$entity) {
|
||||
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
|
||||
}
|
||||
$entities[] = $this->batchjob_delete_process($entity);
|
||||
}
|
||||
$this->entities = $entities;
|
||||
$db->transCommit();
|
||||
LogCollector::debug(sprintf("%s에서 총 %s개중 %s개 일괄삭제를 완료하였습니다.", __METHOD__, count($uids), count($this->entities)));
|
||||
return $this->getResultSuccess();
|
||||
} catch (\Exception $e) {
|
||||
$db->transRollback();
|
||||
return $this->getResultFail($e->getMessage());
|
||||
}
|
||||
}
|
||||
//View 관련
|
||||
protected function view_process(mixed $entity): mixed
|
||||
{
|
||||
return $entity;
|
||||
}
|
||||
public function view(string $uid): RedirectResponse|string
|
||||
{
|
||||
try {
|
||||
$this->setAction(__FUNCTION__);
|
||||
$this->setFormFields();
|
||||
$this->setFormFilters();
|
||||
$this->setFormRules();
|
||||
$this->setFormOptions();
|
||||
//기본값정의
|
||||
$this->setFormDatas($this->request->getGet());
|
||||
//기존 Entity 가져오기
|
||||
$entity = $this->getService()->getEntity($uid);
|
||||
if (!$entity) {
|
||||
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
|
||||
}
|
||||
$this->entity = $this->view_process($entity);
|
||||
helper(['form']);
|
||||
$this->forms = ['attributes' => ['method' => "post",], 'hiddens' => []];
|
||||
return $this->getResultSuccess();
|
||||
} catch (\Exception $e) {
|
||||
return $this->getResultFail($e->getMessage());
|
||||
}
|
||||
}
|
||||
//리스트관련
|
||||
//조건절 처리
|
||||
//Filter Field별 전달값 처리
|
||||
protected function index_condition_filterfield_process(string $field, $filter_values = []): array
|
||||
{
|
||||
switch ($field) {
|
||||
default:
|
||||
$filter_value = $this->request->getVar($field);
|
||||
if ($filter_value !== null && $filter_value !== '') {
|
||||
$this->getService()->index_condition_filterField($field, $filter_value);
|
||||
$filter_values[$field] = $filter_value;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return $filter_values;
|
||||
}
|
||||
protected function index_condition_process(): void
|
||||
{
|
||||
//Paramter로 전달된 Filter값을 정의용
|
||||
$filter_values = [];
|
||||
foreach ($this->getControlDatas('actionFilters') as $field) {
|
||||
$filter_values = $this->index_condition_filterfield_process($field, $filter_values);
|
||||
}
|
||||
$this->setControlDatas('filter_values', $filter_values);
|
||||
//검색어조건절 처리
|
||||
$this->word = $this->request->getVar('word');
|
||||
if ($this->word !== null && $this->word !== '') {
|
||||
@ -687,10 +624,17 @@ abstract class CommonController extends BaseController
|
||||
public function index(): RedirectResponse|string
|
||||
{
|
||||
try {
|
||||
//각 Field 초기화
|
||||
$this->setAction(__FUNCTION__);
|
||||
//각 Field 초기화
|
||||
$this->initAction($this->getService()->getIndexFields());
|
||||
$this->setFormFields();
|
||||
$this->setFormFilters();
|
||||
$this->setFormRules();
|
||||
//기본값정의
|
||||
$this->setFormDatas($this->request->getGet());
|
||||
$this->setFormOptions();
|
||||
//일괄작업용 Fields정의
|
||||
$this->setControlDatas('batchjob_fields', $this->getService()->getBatchjobFields());
|
||||
//일괄작업용 버튼정의
|
||||
$this->setControlDatas('batchjob_buttions', $this->getService()->getBatchjobButtons());
|
||||
helper(['form']);
|
||||
//Return Url정의
|
||||
$this->getMyAuth()->pushCurrentUrl($this->request->getUri()->getPath() . ($this->request->getUri()->getQuery() ? "?" . $this->request->getUri()->getQuery() : ""));
|
||||
@ -711,10 +655,69 @@ abstract class CommonController extends BaseController
|
||||
$this->getService()->setOffset(($this->page - 1) * $this->per_page);
|
||||
$this->index_condition_process();
|
||||
$this->entities = $this->index_process();
|
||||
return $this->getResultSuccess_process();
|
||||
return $this->getResultSuccess();
|
||||
} catch (\Exception $e) {
|
||||
return $e->getMessage();
|
||||
// return $this->getResultFail_process($e->getMessage());
|
||||
// return $this->getResultFail($e->getMessage());
|
||||
}
|
||||
}
|
||||
//OUPUT Document 관련
|
||||
private function download_process(string $document_type, mixed $loaded_data): array
|
||||
{
|
||||
$full_path = WRITEPATH . DIRECTORY_SEPARATOR . "excel";
|
||||
switch ($document_type) {
|
||||
case 'excel':
|
||||
$file_name = sprintf("%s_%s.xlsx", $this->getService()->getClassName(), date('Y-m-d_Hm'));
|
||||
$writer = IOFactory::createWriter($loaded_data, 'Xlsx');
|
||||
$writer->save($full_path . DIRECTORY_SEPARATOR . $file_name);
|
||||
break;
|
||||
case 'pdf':
|
||||
$file_name = sprintf("%s_%s.pdf", $this->getService()->getClassName(), date('Y-m-d_Hm'));
|
||||
$writer = new Mpdf($loaded_data);
|
||||
$writer->save($full_path . DIRECTORY_SEPARATOR . $file_name);
|
||||
break;
|
||||
}
|
||||
return array($full_path, $file_name);
|
||||
}
|
||||
// Download
|
||||
public function download(string $output_type, mixed $uid = false): DownloadResponse|RedirectResponse|string
|
||||
{
|
||||
try {
|
||||
$this->setAction(__FUNCTION__);
|
||||
$this->setFormFields();
|
||||
$this->setFormFilters();
|
||||
$this->setFormRules();
|
||||
$this->setFormOptions();
|
||||
//URL처리
|
||||
// $this->uri = $this->request->getUri();
|
||||
switch ($output_type) {
|
||||
case 'excel':
|
||||
case 'pdf':
|
||||
helper(['form']);
|
||||
$this->index_process();
|
||||
$html = $this->getResultSuccess();
|
||||
//data loading
|
||||
$reader = new Html();
|
||||
$loaded_data = $reader->loadFromString($html);
|
||||
list($full_path, $file_name) = $this->download_process($output_type, $loaded_data);
|
||||
$full_path .= DIRECTORY_SEPARATOR . $file_name;
|
||||
break;
|
||||
default:
|
||||
if (!$uid) {
|
||||
throw new \Exception("{$output_type}은 반드시 uid의 값이 필요합니다.");
|
||||
}
|
||||
$entity = $this->getService()->getEntity($uid);
|
||||
if (!$entity) {
|
||||
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
|
||||
}
|
||||
$this->entity = $entity;
|
||||
list($file_name, $uploaded_filename) = $entity->getDownlaodFile();
|
||||
$full_path = WRITEPATH . DIRECTORY_SEPARATOR . "uploads" . DIRECTORY_SEPARATOR . $uploaded_filename;
|
||||
break;
|
||||
}
|
||||
return $this->response->download($full_path, null)->setFileName($file_name);
|
||||
} catch (\Exception $e) {
|
||||
return $this->getResultFail($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -217,13 +217,13 @@ class CommonHelper
|
||||
$extra .= sprintf(" %s=\"%s\"", $extra_tag, htmlspecialchars($extra_value, ENT_QUOTES, 'UTF-8'));
|
||||
}
|
||||
// 필터 옵션이 없으면 빈 배열로 초기화
|
||||
if (!array_key_exists($field, $viewDatas['control']['filter_optons'])) {
|
||||
if (!array_key_exists($field, $viewDatas['control']['field_optons'])) {
|
||||
return $field; // 필터 옵션이 없으면 빈 문자열 반환
|
||||
}
|
||||
// $formOptions는 필터 옵션 배열로, key는 필터 엔티티의 PK, value는 필터 엔티티 객체
|
||||
$html = sprintf("<select name=\"%s\" %s>", $field, $extra);
|
||||
$html .= "<option value=\"\">" . lang("{$viewDatas['class_path']}.label.{$field}") . " 선택" . "</option>";
|
||||
foreach ($viewDatas['control']['filter_optons'][$field] as $key => $entity) {
|
||||
foreach ($viewDatas['control']['field_optons'][$field] as $key => $entity) {
|
||||
$isSelected = $key == $value ? ' selected' : '';
|
||||
$isDisabled = $entity->getStatus() === $entity::DEFAULT_STATUS ? '' : ' disabled';
|
||||
$html .= sprintf("<option value=\"%s\"%s%s>%s</option>", $key, $isSelected, $isDisabled, array_key_exists('isForm', $extras) ? $entity->getFormTitle() : $entity->getTitle());
|
||||
@ -242,13 +242,13 @@ class CommonHelper
|
||||
$form = form_input($field, $value ?? "", ["placeholder" => "예)010-0010-0010", ...$extras]);
|
||||
break;
|
||||
case 'role':
|
||||
if (!is_array($viewDatas['control']['filter_optons'][$field])) {
|
||||
if (!is_array($viewDatas['control']['field_optons'][$field])) {
|
||||
throw new \Exception(__METHOD__ . "에서 {$field}의 field_options가 array형태가 아닙니다.");
|
||||
}
|
||||
// create, modify, create_form, modify_form일때 checkbox로 표시
|
||||
if (in_array($viewDatas['control']['action'], ['create_form', 'modify_form'])) {
|
||||
$forms = [];
|
||||
foreach ($viewDatas['control']['filter_optons'][$field] as $key => $filterEntity) {
|
||||
foreach ($viewDatas['control']['field_optons'][$field] as $key => $filterEntity) {
|
||||
if ($key !== '') { // 빈값은 제외
|
||||
$values = is_array($value) ? $value : explode(DEFAULTS["DELIMITER_ROLE"], $value);
|
||||
//form_check에는 "class" => "form-control" 쓰면 않되거나 form-check를 써야함
|
||||
@ -298,12 +298,12 @@ class CommonHelper
|
||||
{
|
||||
switch ($field) {
|
||||
case 'user_uid':
|
||||
$value = array_key_exists($value, $viewDatas['control']['filter_optons'][$field]) && $viewDatas['control']['filter_optons'][$field][$value] ? $viewDatas['control']['filter_optons'][$field][$value]->getTitle() : "";
|
||||
$value = array_key_exists($value, $viewDatas['control']['field_optons'][$field]) && $viewDatas['control']['field_optons'][$field][$value] ? $viewDatas['control']['field_optons'][$field][$value]->getTitle() : "";
|
||||
break;
|
||||
case 'role':
|
||||
$roles = [];
|
||||
foreach (explode(DEFAULTS["DELIMITER_ROLE"], $value) as $key) {
|
||||
$roles[] = $viewDatas['control']['filter_optons'][$field][$key]->getTitle() ?? "";
|
||||
$roles[] = $viewDatas['control']['field_optons'][$field][$key]->getTitle() ?? "";
|
||||
}
|
||||
$value = implode(" , ", $roles);
|
||||
break;
|
||||
@ -334,7 +334,7 @@ class CommonHelper
|
||||
);
|
||||
$value = $this->getFieldForm($field, $value, $viewDatas, $extras);
|
||||
} else {
|
||||
$value = array_key_exists($value, $viewDatas['control']['filter_optons'][$field]) ? $viewDatas['control']['filter_optons'][$field][$value]->getTitle() : "";
|
||||
$value = array_key_exists($value, $viewDatas['control']['field_optons'][$field]) ? $viewDatas['control']['field_optons'][$field][$value]->getTitle() : "";
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -347,14 +347,14 @@ class CommonHelper
|
||||
}
|
||||
public function getListFilter(string $field, mixed $value, array $viewDatas, array $extras = []): string
|
||||
{
|
||||
if (!array_key_exists($field, $viewDatas['control']['filter_optons'])) {
|
||||
if (!array_key_exists($field, $viewDatas['control']['field_optons'])) {
|
||||
throw new \Exception(__METHOD__ . "에서 {$field}의 field_options가 정의되지 않았습니다.");
|
||||
}
|
||||
if (!is_array($viewDatas['control']['filter_optons'][$field])) {
|
||||
if (!is_array($viewDatas['control']['field_optons'][$field])) {
|
||||
throw new \Exception(__METHOD__ . "에서 {$field}의 field_options가 array형태가 아닙니다.");
|
||||
}
|
||||
$options = ["" => lang("{$viewDatas['class_path']}.label.{$field}") . " 선택"];
|
||||
foreach ($viewDatas['control']['filter_optons'][$field] as $key => $entity) {
|
||||
foreach ($viewDatas['control']['field_optons'][$field] as $key => $entity) {
|
||||
$options[$key] = $entity->getTitle();
|
||||
}
|
||||
return form_dropdown($field, $options, $value, $extras);;
|
||||
|
||||
@ -16,7 +16,7 @@ class AccountHelper extends CustomerHelper
|
||||
switch ($field) {
|
||||
default:
|
||||
if (in_array($field, $viewDatas['control']['actionFilters'])) {
|
||||
$value = array_key_exists($value, $viewDatas['control']['filter_optons'][$field]) ? $viewDatas['control']['filter_optons'][$field][$value]->getTitle() : "";
|
||||
$value = array_key_exists($value, $viewDatas['control']['field_optons'][$field]) ? $viewDatas['control']['field_optons'][$field][$value]->getTitle() : "";
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@ -16,7 +16,7 @@ class CouponHelper extends CustomerHelper
|
||||
switch ($field) {
|
||||
default:
|
||||
if (in_array($field, $viewDatas['control']['actionFilters'])) {
|
||||
$value = array_key_exists($value, $viewDatas['control']['filter_optons'][$field]) ? $viewDatas['control']['filter_optons'][$field][$value]->getTitle() : "";
|
||||
$value = array_key_exists($value, $viewDatas['control']['field_optons'][$field]) ? $viewDatas['control']['field_optons'][$field][$value]->getTitle() : "";
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@ -20,12 +20,12 @@ class PaymentHelper extends CustomerHelper
|
||||
break;
|
||||
case 'item_uid':
|
||||
//ItemType에 따라 필터옵션에서 Title을 가져옴
|
||||
$value = $viewDatas['control']['filter_optons'][$viewDatas['entity']->getItemType()][$value]->getTitle();
|
||||
$value = $viewDatas['control']['field_optons'][$viewDatas['entity']->getItemType()][$value]->getTitle();
|
||||
break;
|
||||
case 'serviceinfo_uid':
|
||||
case 'clientinfo_uid':
|
||||
case 'billing_method':
|
||||
$value = array_key_exists($value, $viewDatas['control']['filter_optons'][$field]) && $viewDatas['control']['filter_optons'][$field][$value] ? $viewDatas['control']['filter_optons'][$field][$value]->getTitle() : "";
|
||||
$value = array_key_exists($value, $viewDatas['control']['field_optons'][$field]) && $viewDatas['control']['field_optons'][$field][$value] ? $viewDatas['control']['field_optons'][$field][$value]->getTitle() : "";
|
||||
break;
|
||||
default:
|
||||
$value = parent::getFieldView($field, $value, $viewDatas, $extras);
|
||||
|
||||
@ -17,7 +17,7 @@ class PointHelper extends CustomerHelper
|
||||
switch ($field) {
|
||||
default:
|
||||
if (in_array($field, $viewDatas['control']['actionFilters'])) {
|
||||
$value = array_key_exists($value, $viewDatas['control']['filter_optons'][$field]) ? $viewDatas['control']['filter_optons'][$field][$value]->getTitle() : "";
|
||||
$value = array_key_exists($value, $viewDatas['control']['field_optons'][$field]) ? $viewDatas['control']['field_optons'][$field][$value]->getTitle() : "";
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@ -85,11 +85,11 @@ class ServiceHelper extends CustomerHelper
|
||||
case "DOMAIN":
|
||||
$temps = ["<ul>"];
|
||||
foreach ($viewDatas['entity']->getItemEntities($field) as $itemEntity) {
|
||||
// dd($viewDatas['control']['filter_optons'][$field]);
|
||||
// dd($viewDatas['control']['field_optons'][$field]);
|
||||
$temps[] = sprintf(
|
||||
"<li title=\"%s\">%s %s %s</li>",
|
||||
$itemEntity->getView_Price(),
|
||||
$viewDatas['control']['filter_optons'][$field][$itemEntity->getItemUid()]->getTitle(),
|
||||
$viewDatas['control']['field_optons'][$field][$itemEntity->getItemUid()]->getTitle(),
|
||||
$itemEntity->getView_BillingCycle(),
|
||||
$itemEntity->getView_Sale()
|
||||
);
|
||||
|
||||
@ -16,12 +16,12 @@ class HomeHelper extends CommonHelper
|
||||
{
|
||||
switch ($field) {
|
||||
case 'item_uid':
|
||||
$value = $viewDatas['control']['filter_optons'][$viewDatas['entity']->getItemType()][$value]->getTitle();
|
||||
$value = $viewDatas['control']['field_optons'][$viewDatas['entity']->getItemType()][$value]->getTitle();
|
||||
break;
|
||||
case 'type':
|
||||
// echo $value;
|
||||
// dd($viewDatas['control']['filter_optons'][$field]);
|
||||
$value = $viewDatas['control']['filter_optons'][$field][$value]->getTitle();
|
||||
// dd($viewDatas['control']['field_optons'][$field]);
|
||||
$value = $viewDatas['control']['field_optons'][$field][$value]->getTitle();
|
||||
break;
|
||||
case 'amount':
|
||||
$value = number_format($value) . "원";
|
||||
@ -43,14 +43,14 @@ class HomeHelper extends CommonHelper
|
||||
// }
|
||||
$temps = [];
|
||||
foreach ($viewDatas['entity']->getItemEntities($field) as $itemEntity) {
|
||||
$temps[] = $viewDatas['control']['filter_optons'][$field][$itemEntity->getItemUid()]->getTitle();
|
||||
$temps[] = $viewDatas['control']['field_optons'][$field][$itemEntity->getItemUid()]->getTitle();
|
||||
}
|
||||
$value = implode("<BR>", $temps);
|
||||
break;
|
||||
default:
|
||||
if (in_array($field, $viewDatas['control']['actionFilters'])) {
|
||||
if (array_key_exists($value, $viewDatas['control']['filter_optons'][$field])) {
|
||||
$value = $viewDatas['control']['filter_optons'][$field][$value]->getTitle();
|
||||
if (array_key_exists($value, $viewDatas['control']['field_optons'][$field])) {
|
||||
$value = $viewDatas['control']['field_optons'][$field][$value]->getTitle();
|
||||
} else {
|
||||
$value = "";
|
||||
}
|
||||
|
||||
@ -19,8 +19,8 @@ class MyLogHelper extends CommonHelper
|
||||
break;
|
||||
default:
|
||||
if (in_array($field, $viewDatas['control']['actionFilters'])) {
|
||||
if (array_key_exists($value, $viewDatas['control']['filter_optons'][$field])) {
|
||||
$value = $viewDatas['control']['filter_optons'][$field][$value]->getTitle();
|
||||
if (array_key_exists($value, $viewDatas['control']['field_optons'][$field])) {
|
||||
$value = $viewDatas['control']['field_optons'][$field][$value]->getTitle();
|
||||
} else {
|
||||
$value = "";
|
||||
}
|
||||
|
||||
@ -74,7 +74,7 @@ abstract class CommonModel extends Model
|
||||
return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4));
|
||||
}
|
||||
//기본 기능
|
||||
public function getFormFieldRule(string $action, string $field): string
|
||||
public function getFormRule(string $action, string $field): string
|
||||
{
|
||||
if (is_array($field)) {
|
||||
throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true));
|
||||
|
||||
@ -27,7 +27,7 @@ class AccountModel extends CustomerModel
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
public function getFormFieldRule(string $action, string $field): string
|
||||
public function getFormRule(string $action, string $field): string
|
||||
{
|
||||
if (is_array($field)) {
|
||||
throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true));
|
||||
@ -48,7 +48,7 @@ class AccountModel extends CustomerModel
|
||||
$rule = "required|valid_date";
|
||||
break;
|
||||
default:
|
||||
$rule = parent::getFormFieldRule($action, $field);
|
||||
$rule = parent::getFormRule($action, $field);
|
||||
break;
|
||||
}
|
||||
return $rule;
|
||||
|
||||
@ -32,7 +32,7 @@ class ClientModel extends CustomerModel
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
public function getFormFieldRule(string $action, string $field): string
|
||||
public function getFormRule(string $action, string $field): string
|
||||
{
|
||||
if (is_array($field)) {
|
||||
throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true));
|
||||
@ -62,7 +62,7 @@ class ClientModel extends CustomerModel
|
||||
$rule = "permit_empty|numeric";
|
||||
break;
|
||||
default:
|
||||
$rule = parent::getFormFieldRule($action, $field);
|
||||
$rule = parent::getFormRule($action, $field);
|
||||
break;
|
||||
}
|
||||
return $rule;
|
||||
|
||||
@ -24,7 +24,7 @@ class CouponModel extends CustomerModel
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
public function getFormFieldRule(string $action, string $field): string
|
||||
public function getFormRule(string $action, string $field): string
|
||||
{
|
||||
if (is_array($field)) {
|
||||
throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true));
|
||||
@ -40,7 +40,7 @@ class CouponModel extends CustomerModel
|
||||
$rule = "required|trim|string";
|
||||
break;
|
||||
default:
|
||||
$rule = parent::getFormFieldRule($action, $field);
|
||||
$rule = parent::getFormRule($action, $field);
|
||||
break;
|
||||
}
|
||||
return $rule;
|
||||
|
||||
@ -13,7 +13,7 @@ abstract class CustomerModel extends CommonModel
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function getFormFieldRule(string $action, string $field): string
|
||||
public function getFormRule(string $action, string $field): string
|
||||
{
|
||||
if (is_array($field)) {
|
||||
throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true));
|
||||
@ -35,7 +35,7 @@ abstract class CustomerModel extends CommonModel
|
||||
$rule = "permit_empty|trim|string";
|
||||
break;
|
||||
default:
|
||||
$rule = parent::getFormFieldRule($action, $field);
|
||||
$rule = parent::getFormRule($action, $field);
|
||||
break;
|
||||
}
|
||||
return $rule;
|
||||
|
||||
@ -29,7 +29,7 @@ class PaymentModel extends CustomerModel
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
public function getFormFieldRule(string $action, string $field): string
|
||||
public function getFormRule(string $action, string $field): string
|
||||
{
|
||||
if (is_array($field)) {
|
||||
throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true));
|
||||
@ -53,7 +53,7 @@ class PaymentModel extends CustomerModel
|
||||
$rule = "permit_empty|trim|string";
|
||||
break;
|
||||
default:
|
||||
$rule = parent::getFormFieldRule($action, $field);
|
||||
$rule = parent::getFormRule($action, $field);
|
||||
break;
|
||||
}
|
||||
return $rule;
|
||||
|
||||
@ -24,7 +24,7 @@ class PointModel extends CustomerModel
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
public function getFormFieldRule(string $action, string $field): string
|
||||
public function getFormRule(string $action, string $field): string
|
||||
{
|
||||
if (is_array($field)) {
|
||||
throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true));
|
||||
@ -40,7 +40,7 @@ class PointModel extends CustomerModel
|
||||
$rule = "required|trim|string";
|
||||
break;
|
||||
default:
|
||||
$rule = parent::getFormFieldRule($action, $field);
|
||||
$rule = parent::getFormRule($action, $field);
|
||||
break;
|
||||
}
|
||||
return $rule;
|
||||
|
||||
@ -33,7 +33,7 @@ class ServiceModel extends CustomerModel
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
public function getFormFieldRule(string $action, string $field): string
|
||||
public function getFormRule(string $action, string $field): string
|
||||
{
|
||||
if (is_array($field)) {
|
||||
throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true));
|
||||
@ -61,7 +61,7 @@ class ServiceModel extends CustomerModel
|
||||
$rule = "permit_empty|trim|string";
|
||||
break;
|
||||
default:
|
||||
$rule = parent::getFormFieldRule($action, $field);
|
||||
$rule = parent::getFormRule($action, $field);
|
||||
break;
|
||||
}
|
||||
return $rule;
|
||||
|
||||
@ -29,7 +29,7 @@ class CSModel extends EquipmentModel
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
public function getFormFieldRule(string $action, string $field): string
|
||||
public function getFormRule(string $action, string $field): string
|
||||
{
|
||||
if (is_array($field)) {
|
||||
throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true));
|
||||
@ -50,7 +50,7 @@ class CSModel extends EquipmentModel
|
||||
$rule = "permit_empty|trim|string";
|
||||
break;
|
||||
default:
|
||||
$rule = parent::getFormFieldRule($action, $field);
|
||||
$rule = parent::getFormRule($action, $field);
|
||||
break;
|
||||
}
|
||||
return $rule;
|
||||
|
||||
@ -11,7 +11,7 @@ abstract class EquipmentModel extends CommonModel
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function getFormFieldRule(string $action, string $field): string
|
||||
public function getFormRule(string $action, string $field): string
|
||||
{
|
||||
if (is_array($field)) {
|
||||
throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true));
|
||||
@ -33,7 +33,7 @@ abstract class EquipmentModel extends CommonModel
|
||||
$rule = "permit_empty|trim|string";
|
||||
break;
|
||||
default:
|
||||
$rule = parent::getFormFieldRule($action, $field);
|
||||
$rule = parent::getFormRule($action, $field);
|
||||
break;
|
||||
}
|
||||
return $rule;
|
||||
|
||||
@ -28,7 +28,7 @@ class IPModel extends EquipmentModel
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
public function getFormFieldRule(string $action, string $field): string
|
||||
public function getFormRule(string $action, string $field): string
|
||||
{
|
||||
if (is_array($field)) {
|
||||
throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true));
|
||||
@ -50,7 +50,7 @@ class IPModel extends EquipmentModel
|
||||
$rule .= in_array($action, ["create", "create_form"]) ? "|is_unique[{$this->table}.{$field}]" : "";
|
||||
break;
|
||||
default:
|
||||
$rule = parent::getFormFieldRule($action, $field);
|
||||
$rule = parent::getFormRule($action, $field);
|
||||
break;
|
||||
}
|
||||
return $rule;
|
||||
|
||||
@ -25,7 +25,7 @@ class LineModel extends EquipmentModel
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
public function getFormFieldRule(string $action, string $field): string
|
||||
public function getFormRule(string $action, string $field): string
|
||||
{
|
||||
if (is_array($field)) {
|
||||
throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true));
|
||||
@ -40,7 +40,7 @@ class LineModel extends EquipmentModel
|
||||
$rule = "permit_empty|valid_date";
|
||||
break;
|
||||
default:
|
||||
$rule = parent::getFormFieldRule($action, $field);
|
||||
$rule = parent::getFormRule($action, $field);
|
||||
break;
|
||||
}
|
||||
return $rule;
|
||||
|
||||
@ -23,7 +23,7 @@ class PartModel extends EquipmentModel
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
final public function getFormFieldRule(string $action, string $field): string
|
||||
final public function getFormRule(string $action, string $field): string
|
||||
{
|
||||
if (is_array($field)) {
|
||||
throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true));
|
||||
@ -37,7 +37,7 @@ class PartModel extends EquipmentModel
|
||||
$rule = "required|numeric";
|
||||
break;
|
||||
default:
|
||||
$rule = parent::getFormFieldRule($action, $field);
|
||||
$rule = parent::getFormRule($action, $field);
|
||||
break;
|
||||
}
|
||||
return $rule;
|
||||
|
||||
@ -30,7 +30,7 @@ class ServerModel extends EquipmentModel
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
public function getFormFieldRule(string $action, string $field): string
|
||||
public function getFormRule(string $action, string $field): string
|
||||
{
|
||||
if (is_array($field)) {
|
||||
throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true));
|
||||
@ -58,7 +58,7 @@ class ServerModel extends EquipmentModel
|
||||
$rule = "permit_empty|valid_date";
|
||||
break;
|
||||
default:
|
||||
$rule = parent::getFormFieldRule($action, $field);
|
||||
$rule = parent::getFormRule($action, $field);
|
||||
break;
|
||||
}
|
||||
return $rule;
|
||||
|
||||
@ -27,7 +27,7 @@ class ServerPartModel extends EquipmentModel
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
final public function getFormFieldRule(string $action, string $field): string
|
||||
final public function getFormRule(string $action, string $field): string
|
||||
{
|
||||
if (is_array($field)) {
|
||||
throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true));
|
||||
@ -47,7 +47,7 @@ class ServerPartModel extends EquipmentModel
|
||||
$rule = "required|trim|string";
|
||||
break;
|
||||
default:
|
||||
$rule = parent::getFormFieldRule($action, $field);
|
||||
$rule = parent::getFormRule($action, $field);
|
||||
break;
|
||||
}
|
||||
return $rule;
|
||||
|
||||
@ -25,7 +25,7 @@ class SwitchModel extends EquipmentModel
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
public function getFormFieldRule(string $action, string $field): string
|
||||
public function getFormRule(string $action, string $field): string
|
||||
{
|
||||
if (is_array($field)) {
|
||||
throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true));
|
||||
@ -35,7 +35,7 @@ class SwitchModel extends EquipmentModel
|
||||
$rule = "required|trim|string";
|
||||
break;
|
||||
default:
|
||||
$rule = parent::getFormFieldRule($action, $field);
|
||||
$rule = parent::getFormRule($action, $field);
|
||||
break;
|
||||
}
|
||||
return $rule;
|
||||
|
||||
@ -23,7 +23,7 @@ class MyLogModel extends CommonModel
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
public function getFormFieldRule(string $action, string $field): string
|
||||
public function getFormRule(string $action, string $field): string
|
||||
{
|
||||
if (is_array($field)) {
|
||||
throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true));
|
||||
@ -42,7 +42,7 @@ class MyLogModel extends CommonModel
|
||||
$rule = "permit_empty|trim|string";
|
||||
break;
|
||||
default:
|
||||
$rule = parent::getFormFieldRule($action, $field);
|
||||
$rule = parent::getFormRule($action, $field);
|
||||
break;
|
||||
}
|
||||
return $rule;
|
||||
|
||||
@ -26,7 +26,7 @@ class UserModel extends CommonModel
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
public function getFormFieldRule(string $action, string $field): string
|
||||
public function getFormRule(string $action, string $field): string
|
||||
{
|
||||
if (is_array($field)) {
|
||||
throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true));
|
||||
@ -50,7 +50,7 @@ class UserModel extends CommonModel
|
||||
$rule = "required|trim|string";
|
||||
break;
|
||||
default:
|
||||
$rule = parent::getFormFieldRule($action, $field);
|
||||
$rule = parent::getFormRule($action, $field);
|
||||
break;
|
||||
}
|
||||
return $rule;
|
||||
|
||||
@ -28,7 +28,7 @@ class UserSNSModel extends CommonModel
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
public function getFormFieldRule(string $action, string $field): string
|
||||
public function getFormRule(string $action, string $field): string
|
||||
{
|
||||
switch ($field) {
|
||||
case "id":
|
||||
@ -47,7 +47,7 @@ class UserSNSModel extends CommonModel
|
||||
$rule = "required|trim|string";
|
||||
break;
|
||||
default:
|
||||
$rule = parent::getFormFieldRule($action, $field);
|
||||
$rule = parent::getFormRule($action, $field);
|
||||
break;
|
||||
}
|
||||
return $rule;
|
||||
|
||||
@ -25,17 +25,11 @@ class GoogleService extends AuthService
|
||||
}
|
||||
public function getFormFields(): array
|
||||
{
|
||||
return [
|
||||
'fields' => ["access_code"],
|
||||
'filters' => [],
|
||||
];
|
||||
return ["access_code"];
|
||||
}
|
||||
public function getIndexFields(): array
|
||||
public function getFormFilters(): array
|
||||
{
|
||||
return [
|
||||
'fields' => ["access_code"],
|
||||
'filters' => [],
|
||||
];
|
||||
return ["access_code"];
|
||||
}
|
||||
public function getBatchjobButtons(): array
|
||||
{
|
||||
|
||||
@ -14,28 +14,11 @@ class LocalService extends AuthService
|
||||
}
|
||||
public function getFormFields(): array
|
||||
{
|
||||
return [
|
||||
'fields' => [
|
||||
"id",
|
||||
"passwd",
|
||||
],
|
||||
'filters' => [],
|
||||
];
|
||||
return ["id", "passwd",];
|
||||
}
|
||||
public function getIndexFields(): array
|
||||
public function getFormFilters(): array
|
||||
{
|
||||
return [
|
||||
'fields' => [
|
||||
"id",
|
||||
"passwd",
|
||||
"status",
|
||||
],
|
||||
'filters' => [],
|
||||
];
|
||||
}
|
||||
public function getBatchjobFields(): array
|
||||
{
|
||||
return ['status'];
|
||||
return [];
|
||||
}
|
||||
public function getBatchjobButtons(): array
|
||||
{
|
||||
@ -44,7 +27,10 @@ class LocalService extends AuthService
|
||||
//기본기능
|
||||
public function login(array $formDatas): UserEntity
|
||||
{
|
||||
$entity = $this->getEntity(['id' => $formDatas['id'], 'status' => UserEntity::DEFAULT_STATUS], false);
|
||||
$entity = $this->getEntity([
|
||||
'id' => $formDatas['id'],
|
||||
'status' => UserEntity::DEFAULT_STATUS
|
||||
], false);
|
||||
if (!$entity) {
|
||||
throw new \Exception("{$formDatas['id']}에 대한 로그인 정보를 찾을수 없습니다.");
|
||||
}
|
||||
|
||||
@ -16,7 +16,7 @@ abstract class CommonService
|
||||
$this->_model = $model;
|
||||
}
|
||||
abstract public function getFormFields(): array;
|
||||
abstract public function getIndexFields(): array;
|
||||
abstract public function getFormFilters(): array;
|
||||
//기본 기능부분
|
||||
final public function __get($name)
|
||||
{
|
||||
@ -160,9 +160,21 @@ abstract class CommonService
|
||||
{
|
||||
return $this->getFormFields();
|
||||
}
|
||||
public function getViewFilters(): array
|
||||
{
|
||||
return $this->getFormFilters();
|
||||
}
|
||||
public function getIndexFields(): array
|
||||
{
|
||||
return $this->getFormFields();
|
||||
}
|
||||
public function getIndexFilters(): array
|
||||
{
|
||||
return $this->getFormFilters();
|
||||
}
|
||||
public function getBatchjobFields(): array
|
||||
{
|
||||
return [];
|
||||
return $this->getIndexFilters();
|
||||
}
|
||||
public function getBatchjobButtons(): array
|
||||
{
|
||||
@ -171,7 +183,7 @@ abstract class CommonService
|
||||
'batchjob_delete' => '일괄 삭제',
|
||||
];
|
||||
}
|
||||
public function getFormFieldOption(string $field, array $options = []): array
|
||||
public function getFormOption(string $field, array $options = []): array
|
||||
{
|
||||
switch ($field) {
|
||||
default:
|
||||
@ -185,16 +197,19 @@ abstract class CommonService
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (!is_array($options)) {
|
||||
throw new \Exception(__FUNCTION__ . "에서 {$field}의 options 값이 array가 아닙니다.\n" . var_export($options, true));
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
public function getFormFieldRule(string $action, string $field): string
|
||||
public function getFormRule(string $action, string $field): string
|
||||
{
|
||||
if (is_array($field)) {
|
||||
throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true));
|
||||
}
|
||||
switch ($field) {
|
||||
default:
|
||||
$rule = $this->getModel()->getFormFieldRule($action, $field);
|
||||
$rule = $this->getModel()->getFormRule($action, $field);
|
||||
break;
|
||||
}
|
||||
return $rule;
|
||||
|
||||
@ -16,39 +16,21 @@ class AccountService extends CustomerService
|
||||
public function getFormFields(): array
|
||||
{
|
||||
return [
|
||||
'fields' => [
|
||||
"clientinfo_uid",
|
||||
"bank",
|
||||
"title",
|
||||
"alias",
|
||||
"issue_at",
|
||||
"amount",
|
||||
"status",
|
||||
],
|
||||
'filters' => [
|
||||
"clientinfo_uid",
|
||||
"bank",
|
||||
"status",
|
||||
],
|
||||
"clientinfo_uid",
|
||||
"bank",
|
||||
"title",
|
||||
"alias",
|
||||
"issue_at",
|
||||
"amount",
|
||||
"status",
|
||||
];
|
||||
}
|
||||
public function getIndexFields(): array
|
||||
public function getFormFilters(): array
|
||||
{
|
||||
return [
|
||||
'fields' => [
|
||||
"clientinfo_uid",
|
||||
"bank",
|
||||
"title",
|
||||
"alias",
|
||||
"issue_at",
|
||||
"amount",
|
||||
"status",
|
||||
],
|
||||
'filters' => [
|
||||
"clientinfo_uid",
|
||||
"bank",
|
||||
"status",
|
||||
],
|
||||
"clientinfo_uid",
|
||||
"bank",
|
||||
"status",
|
||||
];
|
||||
}
|
||||
public function getBatchjobFields(): array
|
||||
|
||||
@ -15,41 +15,35 @@ class ClientService extends CustomerService
|
||||
public function getFormFields(): array
|
||||
{
|
||||
return [
|
||||
'fields' => [
|
||||
'site',
|
||||
'name',
|
||||
'email',
|
||||
'phone',
|
||||
'role',
|
||||
],
|
||||
'filters' => [
|
||||
'site',
|
||||
'role',
|
||||
'status',
|
||||
],
|
||||
'site',
|
||||
'name',
|
||||
'email',
|
||||
'phone',
|
||||
'role',
|
||||
];
|
||||
}
|
||||
public function getFormFilters(): array
|
||||
{
|
||||
return [
|
||||
'site',
|
||||
'role',
|
||||
'status',
|
||||
];
|
||||
}
|
||||
public function getIndexFields(): array
|
||||
{
|
||||
return [
|
||||
'fields' => [
|
||||
'site',
|
||||
'name',
|
||||
'email',
|
||||
'phone',
|
||||
'role',
|
||||
'account_balance',
|
||||
'coupon_balance',
|
||||
'point_balance',
|
||||
'status',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
],
|
||||
'filters' => [
|
||||
'site',
|
||||
'role',
|
||||
'status',
|
||||
],
|
||||
'site',
|
||||
'name',
|
||||
'email',
|
||||
'phone',
|
||||
'role',
|
||||
'account_balance',
|
||||
'coupon_balance',
|
||||
'point_balance',
|
||||
'status',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
}
|
||||
public function getBatchjobFields(): array
|
||||
|
||||
@ -16,31 +16,17 @@ class CouponService extends CustomerService
|
||||
public function getFormFields(): array
|
||||
{
|
||||
return [
|
||||
'fields' => [
|
||||
"clientinfo_uid",
|
||||
"title",
|
||||
"cnt",
|
||||
"status",
|
||||
],
|
||||
'filters' => [
|
||||
"clientinfo_uid",
|
||||
"status",
|
||||
],
|
||||
"clientinfo_uid",
|
||||
"title",
|
||||
"cnt",
|
||||
"status",
|
||||
];
|
||||
}
|
||||
public function getIndexFields(): array
|
||||
public function getFormFilters(): array
|
||||
{
|
||||
return [
|
||||
'fields' => [
|
||||
"clientinfo_uid",
|
||||
"title",
|
||||
"cnt",
|
||||
"status",
|
||||
],
|
||||
'filters' => [
|
||||
"clientinfo_uid",
|
||||
"status",
|
||||
],
|
||||
"clientinfo_uid",
|
||||
"status",
|
||||
];
|
||||
}
|
||||
public function getBatchjobFields(): array
|
||||
|
||||
@ -52,7 +52,7 @@ abstract class CustomerService extends CommonService
|
||||
//ServiceItemController,ServiceController에서 사용
|
||||
//기본기능
|
||||
//FieldForm관련용
|
||||
public function getFormFieldOption(string $field, array $options = []): array
|
||||
public function getFormOption(string $field, array $options = []): array
|
||||
{
|
||||
switch ($field) {
|
||||
case 'user_uid':
|
||||
@ -68,7 +68,7 @@ abstract class CustomerService extends CommonService
|
||||
$options = $this->getServerService()->getEntities();
|
||||
break;
|
||||
default:
|
||||
$options = parent::getFormFieldOption($field, $options);
|
||||
$options = parent::getFormOption($field, $options);
|
||||
break;
|
||||
}
|
||||
return $options;
|
||||
|
||||
@ -25,47 +25,39 @@ class PaymentService extends CustomerService
|
||||
public function getFormFields(): array
|
||||
{
|
||||
return [
|
||||
'fields' => [
|
||||
"clientinfo_uid",
|
||||
"serviceinfo_uid",
|
||||
"title",
|
||||
"amount",
|
||||
"billing",
|
||||
"billing_at",
|
||||
"pay",
|
||||
"status"
|
||||
],
|
||||
'filters' => [
|
||||
'clientinfo_uid',
|
||||
'billing',
|
||||
'pay',
|
||||
'status',
|
||||
'user_uid'
|
||||
],
|
||||
"clientinfo_uid",
|
||||
"serviceinfo_uid",
|
||||
"title",
|
||||
"amount",
|
||||
"billing",
|
||||
"billing_at",
|
||||
"pay",
|
||||
"status",
|
||||
];
|
||||
}
|
||||
public function getFormFilters(): array
|
||||
{
|
||||
return [
|
||||
'clientinfo_uid',
|
||||
'billing',
|
||||
'pay',
|
||||
'status',
|
||||
'user_uid',
|
||||
];
|
||||
}
|
||||
public function getIndexFields(): array
|
||||
{
|
||||
return [
|
||||
'fields' => [
|
||||
'clientinfo_uid',
|
||||
'billing',
|
||||
'title',
|
||||
'amount',
|
||||
'billing_at',
|
||||
'pay',
|
||||
'status',
|
||||
'updated_at',
|
||||
'countdown',
|
||||
'user_uid'
|
||||
],
|
||||
'filters' => [
|
||||
'clientinfo_uid',
|
||||
'billing',
|
||||
'pay',
|
||||
'status',
|
||||
'user_uid'
|
||||
],
|
||||
'clientinfo_uid',
|
||||
'billing',
|
||||
'title',
|
||||
'amount',
|
||||
'billing_at',
|
||||
'pay',
|
||||
'status',
|
||||
'updated_at',
|
||||
'countdown',
|
||||
'user_uid',
|
||||
];
|
||||
}
|
||||
public function getBatchjobFields(): array
|
||||
@ -80,7 +72,7 @@ class PaymentService extends CustomerService
|
||||
}
|
||||
//기본 기능부분
|
||||
//FieldForm관련용
|
||||
public function getFormFieldOption(string $field, array $options = []): array
|
||||
public function getFormOption(string $field, array $options = []): array
|
||||
{
|
||||
switch ($field) {
|
||||
case 'user_uid':
|
||||
@ -93,7 +85,7 @@ class PaymentService extends CustomerService
|
||||
$options = $this->getServiceService()->getEntities();
|
||||
break;
|
||||
default:
|
||||
$options = parent::getFormFieldOption($field, $options);
|
||||
$options = parent::getFormOption($field, $options);
|
||||
break;
|
||||
}
|
||||
return $options;
|
||||
|
||||
@ -16,31 +16,17 @@ class PointService extends CustomerService
|
||||
public function getFormFields(): array
|
||||
{
|
||||
return [
|
||||
'fields' => [
|
||||
"clientinfo_uid",
|
||||
"title",
|
||||
"amount",
|
||||
"status",
|
||||
],
|
||||
'filters' => [
|
||||
"clientinfo_uid",
|
||||
"status",
|
||||
],
|
||||
"clientinfo_uid",
|
||||
"title",
|
||||
"amount",
|
||||
"status",
|
||||
];
|
||||
}
|
||||
public function getIndexFields(): array
|
||||
public function getFormFilters(): array
|
||||
{
|
||||
return [
|
||||
'fields' => [
|
||||
"clientinfo_uid",
|
||||
"title",
|
||||
"amount",
|
||||
"status",
|
||||
],
|
||||
'filters' => [
|
||||
"clientinfo_uid",
|
||||
"status",
|
||||
],
|
||||
"clientinfo_uid",
|
||||
"status",
|
||||
];
|
||||
}
|
||||
public function getBatchjobFields(): array
|
||||
|
||||
@ -17,53 +17,44 @@ class ServiceService extends CustomerService
|
||||
public function getFormFields(): array
|
||||
{
|
||||
return [
|
||||
'fields' => [
|
||||
"clientinfo_uid",
|
||||
"type",
|
||||
"location",
|
||||
"serverinfo_uid",
|
||||
"billing_at",
|
||||
"amount",
|
||||
"start_at",
|
||||
"end_at",
|
||||
"history",
|
||||
"status",
|
||||
],
|
||||
'filters' => [
|
||||
'site',
|
||||
'clientinfo_uid',
|
||||
'serverinfo_uid',
|
||||
'type',
|
||||
'location',
|
||||
'status'
|
||||
],
|
||||
"clientinfo_uid",
|
||||
"type",
|
||||
"location",
|
||||
"serverinfo_uid",
|
||||
"billing_at",
|
||||
"amount",
|
||||
"start_at",
|
||||
"end_at",
|
||||
"history",
|
||||
"status",
|
||||
];
|
||||
}
|
||||
public function getFormFilters(): array
|
||||
{
|
||||
return [
|
||||
'site',
|
||||
'clientinfo_uid',
|
||||
'serverinfo_uid',
|
||||
'type',
|
||||
'location',
|
||||
'status',
|
||||
];
|
||||
}
|
||||
public function getIndexFields(): array
|
||||
{
|
||||
return [
|
||||
'fields' => [
|
||||
'site',
|
||||
'clientinfo_uid',
|
||||
'type',
|
||||
'location',
|
||||
'serverinfo_uid',
|
||||
'billing_at',
|
||||
'amount',
|
||||
'start_at',
|
||||
'end_at',
|
||||
'updated_at',
|
||||
'status',
|
||||
'user_uid'
|
||||
],
|
||||
'filters' => [
|
||||
'site',
|
||||
'clientinfo_uid',
|
||||
'serverinfo_uid',
|
||||
'type',
|
||||
'location',
|
||||
'status'
|
||||
],
|
||||
'site',
|
||||
'clientinfo_uid',
|
||||
'type',
|
||||
'location',
|
||||
'serverinfo_uid',
|
||||
'billing_at',
|
||||
'amount',
|
||||
'start_at',
|
||||
'end_at',
|
||||
'updated_at',
|
||||
'status',
|
||||
'user_uid'
|
||||
];
|
||||
}
|
||||
public function getBatchjobFields(): array
|
||||
|
||||
@ -13,46 +13,39 @@ class CSService extends EquipmentService
|
||||
$this->addClassName('CS');
|
||||
}
|
||||
public function getFormFields(): array
|
||||
{
|
||||
return [
|
||||
"serverinfo_uid",
|
||||
"type",
|
||||
"ip",
|
||||
"accountid",
|
||||
"domain",
|
||||
"price",
|
||||
"amount",
|
||||
"status",
|
||||
];
|
||||
}
|
||||
public function getFormFilters(): array
|
||||
{
|
||||
return [
|
||||
'fields' => [
|
||||
"serverinfo_uid",
|
||||
"type",
|
||||
"ip",
|
||||
"accountid",
|
||||
"domain",
|
||||
"price",
|
||||
"amount",
|
||||
"status",
|
||||
],
|
||||
'filters' => [
|
||||
"clientinfo_uid",
|
||||
'serverinfo_uid',
|
||||
'type',
|
||||
'status'
|
||||
],
|
||||
"clientinfo_uid",
|
||||
'serverinfo_uid',
|
||||
'type',
|
||||
'status'
|
||||
];
|
||||
}
|
||||
public function getIndexFields(): array
|
||||
{
|
||||
return [
|
||||
'fields' => [
|
||||
"clientinfo_uid",
|
||||
'serverinfo_uid',
|
||||
'type',
|
||||
'ip',
|
||||
'accountid',
|
||||
'domain',
|
||||
'price',
|
||||
"amount",
|
||||
'status'
|
||||
],
|
||||
'filters' => [
|
||||
"clientinfo_uid",
|
||||
'serverinfo_uid',
|
||||
'type',
|
||||
'status'
|
||||
],
|
||||
"clientinfo_uid",
|
||||
'serverinfo_uid',
|
||||
'type',
|
||||
'ip',
|
||||
'accountid',
|
||||
'domain',
|
||||
'price',
|
||||
"amount",
|
||||
'status',
|
||||
];
|
||||
}
|
||||
public function getBatchjobFields(): array
|
||||
|
||||
@ -52,7 +52,7 @@ abstract class EquipmentService extends CommonService
|
||||
}
|
||||
//기본기능
|
||||
//FieldForm관련용
|
||||
public function getFormFieldOption(string $field, array $options = []): array
|
||||
public function getFormOption(string $field, array $options = []): array
|
||||
{
|
||||
switch ($field) {
|
||||
case 'user_uid':
|
||||
@ -68,7 +68,7 @@ abstract class EquipmentService extends CommonService
|
||||
$options = $this->getServerService()->getEntities();
|
||||
break;
|
||||
default:
|
||||
$options = parent::getFormFieldOption($field, $options);
|
||||
$options = parent::getFormOption($field, $options);
|
||||
break;
|
||||
}
|
||||
return $options;
|
||||
|
||||
@ -20,44 +20,35 @@ class IPService extends EquipmentService
|
||||
public function getFormFields(): array
|
||||
{
|
||||
return [
|
||||
'fields' => [
|
||||
"lineinfo_uid",
|
||||
"serverinfo_uid",
|
||||
"ip",
|
||||
"price",
|
||||
"amount",
|
||||
"status",
|
||||
],
|
||||
'filters' => [
|
||||
'old_clientinfo_uid',
|
||||
'clientinfo_uid',
|
||||
'serverinfo_uid',
|
||||
"lineinfo_uid",
|
||||
'status'
|
||||
],
|
||||
"lineinfo_uid",
|
||||
"serverinfo_uid",
|
||||
"ip",
|
||||
"price",
|
||||
"amount",
|
||||
"status",
|
||||
];
|
||||
}
|
||||
public function getFormFilters(): array
|
||||
{
|
||||
return [
|
||||
'old_clientinfo_uid',
|
||||
'clientinfo_uid',
|
||||
'serverinfo_uid',
|
||||
"lineinfo_uid",
|
||||
'status'
|
||||
];
|
||||
}
|
||||
public function getIndexFields(): array
|
||||
{
|
||||
return [
|
||||
'fields' => [
|
||||
'lineinfo_uid',
|
||||
'ip',
|
||||
'price',
|
||||
"amount",
|
||||
'status',
|
||||
'clientinfo_uid',
|
||||
'serverinfo_uid',
|
||||
'old_clientinfo_uid'
|
||||
],
|
||||
'filters' => [
|
||||
'old_clientinfo_uid',
|
||||
'clientinfo_uid',
|
||||
'serverinfo_uid',
|
||||
"lineinfo_uid",
|
||||
'status'
|
||||
],
|
||||
'batchjob_fields' => ['status'],
|
||||
'lineinfo_uid',
|
||||
'ip',
|
||||
'price',
|
||||
"amount",
|
||||
'status',
|
||||
'clientinfo_uid',
|
||||
'serverinfo_uid',
|
||||
'old_clientinfo_uid'
|
||||
];
|
||||
}
|
||||
public function getBatchjobFields(): array
|
||||
@ -73,7 +64,7 @@ class IPService extends EquipmentService
|
||||
}
|
||||
//기본기능
|
||||
//FieldForm관련용
|
||||
public function getFormFieldOption(string $field, $options = []): array
|
||||
public function getFormOption(string $field, $options = []): array
|
||||
{
|
||||
switch ($field) {
|
||||
case 'lineinfo_uid':
|
||||
@ -83,7 +74,7 @@ class IPService extends EquipmentService
|
||||
$options = $this->getClientService()->getEntities();
|
||||
break;
|
||||
default:
|
||||
$options = parent::getFormFieldOption($field, $options);
|
||||
$options = parent::getFormOption($field, $options);
|
||||
break;
|
||||
}
|
||||
return $options;
|
||||
|
||||
@ -14,35 +14,19 @@ class LineService extends EquipmentService
|
||||
public function getFormFields(): array
|
||||
{
|
||||
return [
|
||||
'fields' => [
|
||||
"type",
|
||||
"title",
|
||||
"bandwith",
|
||||
"start_at",
|
||||
"end_at",
|
||||
"status",
|
||||
],
|
||||
'filters' => [
|
||||
"type",
|
||||
'status',
|
||||
],
|
||||
"type",
|
||||
"title",
|
||||
"bandwith",
|
||||
"start_at",
|
||||
"end_at",
|
||||
"status",
|
||||
];
|
||||
}
|
||||
public function getIndexFields(): array
|
||||
public function getFormFilters(): array
|
||||
{
|
||||
return [
|
||||
'fields' => [
|
||||
'type',
|
||||
'title',
|
||||
'bandwith',
|
||||
"start_at",
|
||||
"end_at",
|
||||
'status'
|
||||
],
|
||||
'filters' => [
|
||||
"type",
|
||||
'status',
|
||||
],
|
||||
"type",
|
||||
'status',
|
||||
];
|
||||
}
|
||||
public function getBatchjobFields(): array
|
||||
|
||||
@ -14,32 +14,17 @@ class PartService extends EquipmentService
|
||||
public function getFormFields(): array
|
||||
{
|
||||
return [
|
||||
'fields' => [
|
||||
"type",
|
||||
"title",
|
||||
"price",
|
||||
"status",
|
||||
],
|
||||
'filters' => [
|
||||
"type",
|
||||
'status',
|
||||
],
|
||||
"type",
|
||||
"title",
|
||||
"price",
|
||||
"status",
|
||||
];
|
||||
}
|
||||
public function getIndexFields(): array
|
||||
public function getFormFilters(): array
|
||||
{
|
||||
return [
|
||||
'fields' => [
|
||||
'type',
|
||||
'title',
|
||||
'price',
|
||||
'status',
|
||||
'created_at'
|
||||
],
|
||||
'filters' => [
|
||||
"type",
|
||||
'status',
|
||||
],
|
||||
"type",
|
||||
'status',
|
||||
];
|
||||
}
|
||||
public function getBatchjobFields(): array
|
||||
|
||||
@ -18,27 +18,24 @@ class ServerPartService extends EquipmentService
|
||||
public function getFormFields(): array
|
||||
{
|
||||
return [
|
||||
'fields' => [
|
||||
"partinfo_uid",
|
||||
"serverinfo_uid",
|
||||
"serviceinfo_uid",
|
||||
"type",
|
||||
"billing",
|
||||
"amount",
|
||||
"cnt",
|
||||
"extra",
|
||||
],
|
||||
'filters' => [
|
||||
"partinfo_uid",
|
||||
"serverinfo_uid",
|
||||
"serviceinfo_uid",
|
||||
"type"
|
||||
],
|
||||
"partinfo_uid",
|
||||
"serverinfo_uid",
|
||||
"serviceinfo_uid",
|
||||
"type",
|
||||
"billing",
|
||||
"amount",
|
||||
"cnt",
|
||||
"extra",
|
||||
];
|
||||
}
|
||||
public function getIndexFields(): array
|
||||
public function getFormFilters(): array
|
||||
{
|
||||
return $this->getFormFields();
|
||||
return [
|
||||
"partinfo_uid",
|
||||
"serverinfo_uid",
|
||||
"serviceinfo_uid",
|
||||
"type"
|
||||
];
|
||||
}
|
||||
public function getBatchjobFields(): array
|
||||
{
|
||||
@ -63,7 +60,7 @@ class ServerPartService extends EquipmentService
|
||||
}
|
||||
//기본 기능부분
|
||||
// FieldForm관련용
|
||||
public function getFormFieldOption(string $field, array $options = []): array
|
||||
public function getFormOption(string $field, array $options = []): array
|
||||
{
|
||||
switch ($field) {
|
||||
case 'partinfo_uid_CPU':
|
||||
@ -88,7 +85,7 @@ class ServerPartService extends EquipmentService
|
||||
$options = $this->getPartService()->getEntities();
|
||||
break;
|
||||
default:
|
||||
$options = parent::getFormFieldOption($field, $options);
|
||||
$options = parent::getFormOption($field, $options);
|
||||
break;
|
||||
}
|
||||
return $options;
|
||||
|
||||
@ -18,69 +18,71 @@ class ServerService extends EquipmentService
|
||||
public function getFormFields(): array
|
||||
{
|
||||
return [
|
||||
'fields' => [
|
||||
"code",
|
||||
"type",
|
||||
"title",
|
||||
"price",
|
||||
"amount",
|
||||
"manufactur_at",
|
||||
"format_at",
|
||||
"status",
|
||||
"partinfo_uid_CPU",
|
||||
"serverinfopartinfo_uid_CPU_cnt",
|
||||
"partinfo_uid_RAM",
|
||||
"serverinfopartinfo_uid_RAM_cnt",
|
||||
"partinfo_uid_DISK",
|
||||
"serverinfopartinfo_uid_DISK_cnt",
|
||||
"serverinfopartinfo_uid_DISK_extra",
|
||||
"partinfo_uid_OS",
|
||||
"serverinfopartinfo_uid_OS_cnt",
|
||||
"partinfo_uid_SOFTWARE",
|
||||
"serverinfopartinfo_uid_SOFTWARE_cnt",
|
||||
"ipinfo_uid",
|
||||
"csinfo_uid",
|
||||
],
|
||||
'filters' => [
|
||||
"clientinfo_uid",
|
||||
"serviceinfo_uid",
|
||||
"type",
|
||||
"title",
|
||||
"partinfo_uid_CPU",
|
||||
"partinfo_uid_RAM",
|
||||
"partinfo_uid_DISK",
|
||||
"serverinfopartinfo_uid_DISK_extra",
|
||||
"partinfo_uid_OS",
|
||||
"partinfo_uid_SOFTWARE",
|
||||
"ipinfo_uid",
|
||||
"csinfo_uid",
|
||||
"status"
|
||||
],
|
||||
"code",
|
||||
"type",
|
||||
"title",
|
||||
"price",
|
||||
"amount",
|
||||
"manufactur_at",
|
||||
"format_at",
|
||||
"status",
|
||||
"partinfo_uid_CPU",
|
||||
"serverinfopartinfo_uid_CPU_cnt",
|
||||
"partinfo_uid_RAM",
|
||||
"serverinfopartinfo_uid_RAM_cnt",
|
||||
"partinfo_uid_DISK",
|
||||
"serverinfopartinfo_uid_DISK_cnt",
|
||||
"serverinfopartinfo_uid_DISK_extra",
|
||||
"partinfo_uid_OS",
|
||||
"serverinfopartinfo_uid_OS_cnt",
|
||||
"partinfo_uid_SOFTWARE",
|
||||
"serverinfopartinfo_uid_SOFTWARE_cnt",
|
||||
"ipinfo_uid",
|
||||
"csinfo_uid",
|
||||
];
|
||||
}
|
||||
public function getFormFilters(): array
|
||||
{
|
||||
return [
|
||||
"clientinfo_uid",
|
||||
"serviceinfo_uid",
|
||||
"type",
|
||||
"title",
|
||||
"partinfo_uid_CPU",
|
||||
"partinfo_uid_RAM",
|
||||
"partinfo_uid_DISK",
|
||||
"serverinfopartinfo_uid_DISK_extra",
|
||||
"partinfo_uid_OS",
|
||||
"partinfo_uid_SOFTWARE",
|
||||
"ipinfo_uid",
|
||||
"csinfo_uid",
|
||||
"status"
|
||||
];
|
||||
}
|
||||
public function getIndexFields(): array
|
||||
{
|
||||
return [
|
||||
'fields' => [
|
||||
'clientinfo_uid',
|
||||
'serviceinfo_uid',
|
||||
"type",
|
||||
'title',
|
||||
'price',
|
||||
'amount',
|
||||
'manufactur_at',
|
||||
"format_at",
|
||||
'status'
|
||||
],
|
||||
'filters' => [
|
||||
'clientinfo_uid',
|
||||
'serviceinfo_uid',
|
||||
'type',
|
||||
"ipinfo_uid",
|
||||
"csinfo_uid",
|
||||
'partinfo_uid_SOFTWARE',
|
||||
'status'
|
||||
],
|
||||
'clientinfo_uid',
|
||||
'serviceinfo_uid',
|
||||
"type",
|
||||
'title',
|
||||
'price',
|
||||
'amount',
|
||||
'manufactur_at',
|
||||
"format_at",
|
||||
'status'
|
||||
];
|
||||
}
|
||||
public function getIndexFilters(): array
|
||||
{
|
||||
return [
|
||||
'clientinfo_uid',
|
||||
'serviceinfo_uid',
|
||||
'type',
|
||||
"ipinfo_uid",
|
||||
"csinfo_uid",
|
||||
'partinfo_uid_SOFTWARE',
|
||||
'status'
|
||||
];
|
||||
}
|
||||
public function getBatchjobFields(): array
|
||||
@ -129,26 +131,26 @@ class ServerService extends EquipmentService
|
||||
return $entity;
|
||||
}
|
||||
//기본 기능부분
|
||||
public function getFormFieldOption(string $field, array $options = []): array
|
||||
public function getFormOption(string $field, array $options = []): array
|
||||
{
|
||||
switch ($field) {
|
||||
case 'partinfo_uid_CPU':
|
||||
$options = $this->getServerPartService()->getFormFieldOption('partinfo_uid_CPU');
|
||||
$options = $this->getServerPartService()->getFormOption('partinfo_uid_CPU');
|
||||
break;
|
||||
case 'partinfo_uid_RAM':
|
||||
$options = $this->getServerPartService()->getFormFieldOption('partinfo_uid_RAM');
|
||||
$options = $this->getServerPartService()->getFormOption('partinfo_uid_RAM');
|
||||
break;
|
||||
case 'partinfo_uid_DISK':
|
||||
$options = $this->getServerPartService()->getFormFieldOption('partinfo_uid_DISK');
|
||||
$options = $this->getServerPartService()->getFormOption('partinfo_uid_DISK');
|
||||
break;
|
||||
case 'partinfo_uid_OS':
|
||||
$options = $this->getServerPartService()->getFormFieldOption('partinfo_uid_OS');
|
||||
$options = $this->getServerPartService()->getFormOption('partinfo_uid_OS');
|
||||
break;
|
||||
case 'partinfo_uid_DB':
|
||||
$options = $this->getServerPartService()->getFormFieldOption('partinfo_uid_DB');
|
||||
$options = $this->getServerPartService()->getFormOption('partinfo_uid_DB');
|
||||
break;
|
||||
case 'partinfo_uid_SOFTWARE':
|
||||
$options = $this->getServerPartService()->getFormFieldOption('partinfo_uid_SOFTWARE');
|
||||
$options = $this->getServerPartService()->getFormOption('partinfo_uid_SOFTWARE');
|
||||
break;
|
||||
case 'ipinfo_uid': //수정때문에 전체가 필요
|
||||
$options = $this->getIPService()->getEntities();
|
||||
@ -157,7 +159,7 @@ class ServerService extends EquipmentService
|
||||
$options = $this->getCSService()->getEntities();
|
||||
break;
|
||||
default:
|
||||
$options = parent::getFormFieldOption($field, $options);
|
||||
$options = parent::getFormOption($field, $options);
|
||||
break;
|
||||
}
|
||||
return $options;
|
||||
|
||||
@ -16,35 +16,37 @@ class SwitchService extends EquipmentService
|
||||
public function getFormFields(): array
|
||||
{
|
||||
return [
|
||||
'fields' => [
|
||||
"serverinfo_uid",
|
||||
"code",
|
||||
"status",
|
||||
],
|
||||
'filters' => [
|
||||
'clientinfo_uid',
|
||||
'serviceinfo_uid',
|
||||
'serverinfo_uid',
|
||||
'status'
|
||||
],
|
||||
"serverinfo_uid",
|
||||
"code",
|
||||
"status",
|
||||
];
|
||||
}
|
||||
public function getFormFilters(): array
|
||||
{
|
||||
return [
|
||||
'clientinfo_uid',
|
||||
'serviceinfo_uid',
|
||||
'serverinfo_uid',
|
||||
'status'
|
||||
];
|
||||
}
|
||||
public function getIndexFields(): array
|
||||
{
|
||||
return [
|
||||
'fields' => [
|
||||
'code',
|
||||
'status',
|
||||
'clientinfo_uid',
|
||||
'serviceinfo_uid',
|
||||
'serverinfo_uid'
|
||||
],
|
||||
'filters' => [
|
||||
'clientinfo_uid',
|
||||
'serviceinfo_uid',
|
||||
'serverinfo_uid',
|
||||
'status'
|
||||
],
|
||||
'code',
|
||||
'status',
|
||||
'clientinfo_uid',
|
||||
'serviceinfo_uid',
|
||||
'serverinfo_uid'
|
||||
];
|
||||
}
|
||||
public function getIndexFilters(): array
|
||||
{
|
||||
return [
|
||||
'clientinfo_uid',
|
||||
'serviceinfo_uid',
|
||||
'serverinfo_uid',
|
||||
'status'
|
||||
];
|
||||
}
|
||||
public function getBatchjobFields(): array
|
||||
|
||||
@ -18,31 +18,17 @@ class MyLogService extends CommonService
|
||||
public function getFormFields(): array
|
||||
{
|
||||
return [
|
||||
'fields' => [
|
||||
"user_uid",
|
||||
"title",
|
||||
"content",
|
||||
"status",
|
||||
],
|
||||
'filters' => [
|
||||
'user_uid',
|
||||
'status'
|
||||
],
|
||||
"user_uid",
|
||||
"title",
|
||||
"content",
|
||||
"status",
|
||||
];
|
||||
}
|
||||
public function getIndexFields(): array
|
||||
public function getFormFilters(): array
|
||||
{
|
||||
return [
|
||||
'fields' => [
|
||||
'user_uid',
|
||||
'title',
|
||||
'status',
|
||||
'created_at'
|
||||
],
|
||||
'filters' => [
|
||||
'user_uid',
|
||||
'status'
|
||||
],
|
||||
'user_uid',
|
||||
'status'
|
||||
];
|
||||
}
|
||||
public function getBatchjobFields(): array
|
||||
@ -58,14 +44,14 @@ class MyLogService extends CommonService
|
||||
}
|
||||
//기본 기능부분
|
||||
//FieldForm관련용
|
||||
public function getFormFieldOption(string $field, array $options = []): array
|
||||
public function getFormOption(string $field, array $options = []): array
|
||||
{
|
||||
switch ($field) {
|
||||
case 'user_uid':
|
||||
$options = $this->getUserService()->getEntities();
|
||||
break;
|
||||
default:
|
||||
$options = parent::getFormFieldOption($field, $options);
|
||||
$options = parent::getFormOption($field, $options);
|
||||
break;
|
||||
}
|
||||
return $options;
|
||||
|
||||
@ -16,39 +16,21 @@ class UserSNSService extends CommonService
|
||||
public function getFormFields(): array
|
||||
{
|
||||
return [
|
||||
'fields' => [
|
||||
"site",
|
||||
"user_uid",
|
||||
"id",
|
||||
"name",
|
||||
"email",
|
||||
"detail",
|
||||
"status",
|
||||
],
|
||||
'filters' => [
|
||||
"site",
|
||||
"user_uid",
|
||||
"status",
|
||||
],
|
||||
"site",
|
||||
"user_uid",
|
||||
"id",
|
||||
"name",
|
||||
"email",
|
||||
"detail",
|
||||
"status",
|
||||
];
|
||||
}
|
||||
public function getIndexFields(): array
|
||||
public function getFormFilters(): array
|
||||
{
|
||||
return [
|
||||
'fields' => [
|
||||
"site",
|
||||
"user_uid",
|
||||
"id",
|
||||
"name",
|
||||
"email",
|
||||
"detail",
|
||||
"status",
|
||||
],
|
||||
'filters' => [
|
||||
"site",
|
||||
"user_uid",
|
||||
"status",
|
||||
],
|
||||
"site",
|
||||
"user_uid",
|
||||
"status",
|
||||
];
|
||||
}
|
||||
public function getBatchjobFields(): array
|
||||
|
||||
@ -15,53 +15,30 @@ class UserService extends CommonService
|
||||
public function getFormFields(): array
|
||||
{
|
||||
return [
|
||||
'fields' => [
|
||||
'id',
|
||||
'passwd',
|
||||
'confirmpassword',
|
||||
'name',
|
||||
'email',
|
||||
'mobile',
|
||||
'role'
|
||||
],
|
||||
'filters' => [
|
||||
'role',
|
||||
'status'
|
||||
],
|
||||
'id',
|
||||
'passwd',
|
||||
'confirmpassword',
|
||||
'name',
|
||||
'email',
|
||||
'mobile',
|
||||
'role'
|
||||
];
|
||||
}
|
||||
public function getViewFields(): array
|
||||
public function getFormFilters(): array
|
||||
{
|
||||
return [
|
||||
'fields' => [
|
||||
'id',
|
||||
'name',
|
||||
'email',
|
||||
'mobile',
|
||||
'role',
|
||||
'status'
|
||||
],
|
||||
'filters' => [
|
||||
'role',
|
||||
'status'
|
||||
],
|
||||
'role',
|
||||
'status'
|
||||
];
|
||||
}
|
||||
public function getIndexFields(): array
|
||||
{
|
||||
return [
|
||||
'fields' => [
|
||||
'id',
|
||||
'name',
|
||||
'email',
|
||||
'mobile',
|
||||
'role',
|
||||
'status'
|
||||
],
|
||||
'filters' => [
|
||||
'role',
|
||||
'status'
|
||||
],
|
||||
'id',
|
||||
'name',
|
||||
'email',
|
||||
'mobile',
|
||||
'role'
|
||||
];
|
||||
}
|
||||
public function getBatchjobFields(): array
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
<tr>
|
||||
<th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel($field, lang("{$viewDatas['class_path']}.label.{$field}"), $viewDatas) ?></th>
|
||||
<td nowrap class="text-start">
|
||||
<?= $viewDatas['helper']->getFieldForm($field, old($field) ?? ($viewDatas['control']['field_default_values'][$field] ?? null), $viewDatas) ?>
|
||||
<?= $viewDatas['helper']->getFieldForm($field, old($field) ?? ($viewDatas['control']['form_datas'][$field] ?? null), $viewDatas) ?>
|
||||
<span><?= validation_show_error($field); ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
<tr>
|
||||
<th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel($field, lang("{$viewDatas['class_path']}.label.{$field}"), $viewDatas) ?></th>
|
||||
<td nowrap class="text-start">
|
||||
<?= $viewDatas['helper']->getFieldForm($field, old($field) ?? ($viewDatas['control']['field_default_values'][$field] ?? null), $viewDatas) ?>
|
||||
<?= $viewDatas['helper']->getFieldForm($field, old($field) ?? ($viewDatas['control']['form_datas'][$field] ?? null), $viewDatas) ?>
|
||||
<span><?= validation_show_error($field); ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
<?php foreach (["code", "type", "title", "price", "amount", "manufactur_at", "format_at", "status",] as $field): ?>
|
||||
<th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel($field, lang("{$viewDatas['class_path']}.label.{$field}"), $viewDatas) ?></th>
|
||||
<td nowrap class="text-start">
|
||||
<?= $viewDatas['helper']->getFieldForm($field, old($field) ?? ($viewDatas['control']['field_default_values'][$field] ?? null), $viewDatas) ?>
|
||||
<?= $viewDatas['helper']->getFieldForm($field, old($field) ?? ($viewDatas['control']['form_datas'][$field] ?? null), $viewDatas) ?>
|
||||
<span><?= validation_show_error($field); ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
@ -30,12 +30,12 @@
|
||||
<tr>
|
||||
<th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel("partinfo_uid_{$partType}", lang("{$viewDatas['class_path']}.label.partinfo_uid_{$partType}"), $viewDatas) ?></th>
|
||||
<td nowrap class="text-start">
|
||||
<?= $viewDatas['helper']->getFieldForm("partinfo_uid_{$partType}", old("partinfo_uid_{$partType}") ?? ($viewDatas['control']['field_default_values']["partinfo_uid_{$partType}"] ?? null), $viewDatas) ?>
|
||||
<?= $viewDatas['helper']->getFieldForm("serverinfopartinfo_uid_{$partType}_cnt", old("serverinfopartinfo_uid_{$partType}_cnt") ?? ($viewDatas['control']['field_default_values']["serverinfopartinfo_uid_{$partType}_cnt"] ?? null), $viewDatas) ?>
|
||||
<?= $viewDatas['helper']->getFieldForm("partinfo_uid_{$partType}", old("partinfo_uid_{$partType}") ?? ($viewDatas['control']['form_datas']["partinfo_uid_{$partType}"] ?? null), $viewDatas) ?>
|
||||
<?= $viewDatas['helper']->getFieldForm("serverinfopartinfo_uid_{$partType}_cnt", old("serverinfopartinfo_uid_{$partType}_cnt") ?? ($viewDatas['control']['form_datas']["serverinfopartinfo_uid_{$partType}_cnt"] ?? null), $viewDatas) ?>
|
||||
<?php if ($partType === "DISK"): ?>
|
||||
<?= $viewDatas['helper']->getFieldForm("serverinfopartinfo_uid_{$partType}_extra", old("serverinfopartinfo_uid_{$partType}_extra") ?? ($viewDatas['control']['field_default_values']["serverinfopartinfo_uid_{$partType}_extra"] ?? null), $viewDatas) ?>
|
||||
<?= $viewDatas['helper']->getFieldForm("serverinfopartinfo_uid_{$partType}_extra", old("serverinfopartinfo_uid_{$partType}_extra") ?? ($viewDatas['control']['form_datas']["serverinfopartinfo_uid_{$partType}_extra"] ?? null), $viewDatas) ?>
|
||||
<?php endif ?>
|
||||
,금액 <?= $viewDatas['helper']->getFieldForm("serverinfopartinfo_uid_{$partType}_amount", old("serverinfopartinfo_uid_{$partType}_amount") ?? ($viewDatas['control']['field_default_values']["serverinfopartinfo_uid_{$partType}_amount"] ?? null), $viewDatas) ?>
|
||||
,금액 <?= $viewDatas['helper']->getFieldForm("serverinfopartinfo_uid_{$partType}_amount", old("serverinfopartinfo_uid_{$partType}_amount") ?? ($viewDatas['control']['form_datas']["serverinfopartinfo_uid_{$partType}_amount"] ?? null), $viewDatas) ?>
|
||||
<span><?= validation_show_error("partinfo_uid_{$partType}"); ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
@ -43,15 +43,15 @@
|
||||
<tr>
|
||||
<th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel("ipinfo_uid", lang("{$viewDatas['class_path']}.label.ipinfo_uid"), $viewDatas) ?></th>
|
||||
<td nowrap class="text-start">
|
||||
<?= $viewDatas['helper']->getFieldForm("ipinfo_uid", old("ipinfo_uid") ?? ($viewDatas['control']['field_default_values']["ipinfo_uid"] ?? null), $viewDatas) ?>
|
||||
,금액 <?= $viewDatas['helper']->getFieldForm("ipinfo_uid_amount", old("ipinfo_uid_amount") ?? ($viewDatas['control']['field_default_values']["ipinfo_uid_amount"] ?? null), $viewDatas) ?>
|
||||
<?= $viewDatas['helper']->getFieldForm("ipinfo_uid", old("ipinfo_uid") ?? ($viewDatas['control']['form_datas']["ipinfo_uid"] ?? null), $viewDatas) ?>
|
||||
,금액 <?= $viewDatas['helper']->getFieldForm("ipinfo_uid_amount", old("ipinfo_uid_amount") ?? ($viewDatas['control']['form_datas']["ipinfo_uid_amount"] ?? null), $viewDatas) ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel("csinfo_uid", lang("{$viewDatas['class_path']}.label.csinfo_uid"), $viewDatas) ?></th>
|
||||
<td nowrap class="text-start">
|
||||
<?= $viewDatas['helper']->getFieldForm("csinfo_uid", old("csinfo_uid") ?? ($viewDatas['control']['field_default_values']["csinfo_uid"] ?? null), $viewDatas) ?>
|
||||
,금액 <?= $viewDatas['helper']->getFieldForm("csinfo_uid_amount", old("csinfo_uid_amount") ?? ($viewDatas['control']['field_default_values']["csinfo_uid_amount"] ?? null), $viewDatas) ?>
|
||||
<?= $viewDatas['helper']->getFieldForm("csinfo_uid", old("csinfo_uid") ?? ($viewDatas['control']['form_datas']["csinfo_uid"] ?? null), $viewDatas) ?>
|
||||
,금액 <?= $viewDatas['helper']->getFieldForm("csinfo_uid_amount", old("csinfo_uid_amount") ?? ($viewDatas['control']['form_datas']["csinfo_uid_amount"] ?? null), $viewDatas) ?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@ -30,12 +30,12 @@
|
||||
<tr>
|
||||
<th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel("partinfo_uid_{$partType}", lang("{$viewDatas['class_path']}.label.partinfo_uid_{$partType}"), $viewDatas) ?></th>
|
||||
<td nowrap class="text-start">
|
||||
<?= $viewDatas['helper']->getFieldForm("partinfo_uid_{$partType}", old("partinfo_uid_{$partType}") ?? ($viewDatas['entity']->getServerPartEntity($partType) ? $viewDatas['entity']->getServerPartEntity($partType)->getPartInfoUID() : ($viewDatas['control']['field_default_values']["partinfo_uid_{$partType}"] ?? null)), $viewDatas) ?>
|
||||
<?= $viewDatas['helper']->getFieldForm("serverinfopartinfo_uid_{$partType}_cnt", old("serverinfopartinfo_uid_{$partType}_cnt") ?? ($viewDatas['entity']->getServerPartEntity($partType) ? $viewDatas['entity']->getServerPartEntity($partType)->getCnt() : ($viewDatas['control']['field_default_values']["serverinfopartinfo_uid_{$partType}_cnt"] ?? null)), $viewDatas) ?>
|
||||
<?= $viewDatas['helper']->getFieldForm("partinfo_uid_{$partType}", old("partinfo_uid_{$partType}") ?? ($viewDatas['entity']->getServerPartEntity($partType) ? $viewDatas['entity']->getServerPartEntity($partType)->getPartInfoUID() : ($viewDatas['control']['form_datas']["partinfo_uid_{$partType}"] ?? null)), $viewDatas) ?>
|
||||
<?= $viewDatas['helper']->getFieldForm("serverinfopartinfo_uid_{$partType}_cnt", old("serverinfopartinfo_uid_{$partType}_cnt") ?? ($viewDatas['entity']->getServerPartEntity($partType) ? $viewDatas['entity']->getServerPartEntity($partType)->getCnt() : ($viewDatas['control']['form_datas']["serverinfopartinfo_uid_{$partType}_cnt"] ?? null)), $viewDatas) ?>
|
||||
<?php if ($partType === "DISK"): ?>
|
||||
<?= $viewDatas['helper']->getFieldForm("serverinfopartinfo_uid_{$partType}_extra", old("serverinfopartinfo_uid_{$partType}_extra") ?? ($viewDatas['entity']->getServerPartEntity($partType) ? $viewDatas['entity']->getServerPartEntity($partType)->getExtra() : ($viewDatas['control']['field_default_values']["serverinfopartinfo_uid_{$partType}_extra"] ?? null)), $viewDatas) ?>
|
||||
<?= $viewDatas['helper']->getFieldForm("serverinfopartinfo_uid_{$partType}_extra", old("serverinfopartinfo_uid_{$partType}_extra") ?? ($viewDatas['entity']->getServerPartEntity($partType) ? $viewDatas['entity']->getServerPartEntity($partType)->getExtra() : ($viewDatas['control']['form_datas']["serverinfopartinfo_uid_{$partType}_extra"] ?? null)), $viewDatas) ?>
|
||||
<?php endif ?>
|
||||
,금액 <?= $viewDatas['helper']->getFieldForm("serverinfopartinfo_uid_{$partType}_amount", ($viewDatas['entity']->getServerPartEntity($partType) ? $viewDatas['entity']->getServerPartEntity($partType)->getAmount() : ($viewDatas['control']['field_default_values']["serverinfopartinfo_uid_{$partType}_amount"] ?? null)), $viewDatas) ?>
|
||||
,금액 <?= $viewDatas['helper']->getFieldForm("serverinfopartinfo_uid_{$partType}_amount", ($viewDatas['entity']->getServerPartEntity($partType) ? $viewDatas['entity']->getServerPartEntity($partType)->getAmount() : ($viewDatas['control']['form_datas']["serverinfopartinfo_uid_{$partType}_amount"] ?? null)), $viewDatas) ?>
|
||||
<span><?= validation_show_error("partinfo_uid_{$partType}"); ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
@ -44,8 +44,8 @@
|
||||
<th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel("ipinfo_uid", lang("{$viewDatas['class_path']}.label.ipinfo_uid"), $viewDatas) ?></th>
|
||||
<td nowrap class="text-start">
|
||||
<?php foreach ($viewDatas['entity']->getIPEntities() as $entity): ?>
|
||||
<?= $viewDatas['helper']->getFieldForm("ipinfo_uid", old("ipinfo_uid") ?? ($viewDatas['control']['field_default_values']["ipinfo_uid"] ?? null), $viewDatas) ?>
|
||||
,금액 <?= $viewDatas['helper']->getFieldForm("ipinfo_uid_amount", ($ipEntity ? $ipEntity->getAmount() : ($viewDatas['control']['field_default_values']["ipinfo_amount"] ?? null)), $viewDatas) ?>
|
||||
<?= $viewDatas['helper']->getFieldForm("ipinfo_uid", old("ipinfo_uid") ?? ($viewDatas['control']['form_datas']["ipinfo_uid"] ?? null), $viewDatas) ?>
|
||||
,금액 <?= $viewDatas['helper']->getFieldForm("ipinfo_uid_amount", ($ipEntity ? $ipEntity->getAmount() : ($viewDatas['control']['form_datas']["ipinfo_amount"] ?? null)), $viewDatas) ?>
|
||||
<?php endforeach ?>
|
||||
</td>
|
||||
</tr>
|
||||
@ -53,8 +53,8 @@
|
||||
<th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel("csinfo_uid", lang("{$viewDatas['class_path']}.label.csinfo_uid"), $viewDatas) ?></th>
|
||||
<td nowrap class="text-start">
|
||||
<?php foreach ($viewDatas['entity']->getCSEntities() as $entity): ?>
|
||||
<?= $viewDatas['helper']->getFieldForm("csinfo_uid", old("csinfo_uid") ?? ($viewDatas['control']['field_default_values']["csinfo_uid"] ?? null), $viewDatas) ?>
|
||||
,금액 <?= $viewDatas['helper']->getFieldForm("csinfo_uid_amount", ($entity ? $entity->getAmount() : ($viewDatas['control']['field_default_values']["csinfo_amount"] ?? null)), $viewDatas) ?>
|
||||
<?= $viewDatas['helper']->getFieldForm("csinfo_uid", old("csinfo_uid") ?? ($viewDatas['control']['form_datas']["csinfo_uid"] ?? null), $viewDatas) ?>
|
||||
,금액 <?= $viewDatas['helper']->getFieldForm("csinfo_uid_amount", ($entity ? $entity->getAmount() : ($viewDatas['control']['form_datas']["csinfo_amount"] ?? null)), $viewDatas) ?>
|
||||
<?php endforeach ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
<nav class="condition nav">
|
||||
조건:
|
||||
<?php foreach ($viewDatas['control']['actionFilters'] as $field): ?>
|
||||
<?= $viewDatas['helper']->getListFilter($field, $viewDatas['control']['filter_values'][$field] ?? old($field), $viewDatas, ['id' => $field]) ?>
|
||||
<?= $viewDatas['helper']->getListFilter($field, $viewDatas['control']['form_datas'][$field] ?? old($field), $viewDatas, ['id' => $field]) ?>
|
||||
<?php endforeach ?>
|
||||
</nav>
|
||||
<nav class="search nav justify-content-center">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user