dbmsv4 init...3
This commit is contained in:
parent
a1c5c3471b
commit
27ac89e228
@ -125,6 +125,7 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au
|
||||
$routes->get('changeServer/(:num)', 'ServiceController::alternative_modify/$1');
|
||||
$routes->get('terminateServer/(:num)', 'ServiceController::alternative_delete/$1');
|
||||
$routes->post('history/(:num)', 'ServiceController::history/$1');
|
||||
$routes->post('billingat/(:num)', 'ServiceController::billingat/$1');
|
||||
});
|
||||
$routes->group('wallet', ['namespace' => 'App\Controllers\Admin\Customer\Wallet'], function ($routes) {
|
||||
$routes->group('account', function ($routes) {
|
||||
|
||||
@ -39,10 +39,10 @@ abstract class AbstractCRUDController extends AbstractWebController
|
||||
return $this->action_redirect_process('error', static::class . '->' . __FUNCTION__ . "에서 {$this->getTitle()} 생성폼 오류:" . $e->getMessage());
|
||||
}
|
||||
}
|
||||
protected function create_process(): object
|
||||
protected function create_process(array $formDatas): object
|
||||
{
|
||||
// POST 데이터를 DTO 객체로 변환 (getPost()는 POST 요청 본문만 가져옵니다.)
|
||||
return $this->service->create($this->service->createDTO($this->request->getPost()));
|
||||
return $this->service->create($this->service->createDTO($formDatas));
|
||||
}
|
||||
|
||||
protected function create_result_process($entity, ?string $redirect_url = null): string|RedirectResponse
|
||||
@ -59,7 +59,7 @@ abstract class AbstractCRUDController extends AbstractWebController
|
||||
try {
|
||||
$action = __FUNCTION__;
|
||||
$this->action_init_process($action);
|
||||
$entity = $this->create_process();
|
||||
$entity = $this->create_process($this->request->getPost());
|
||||
// 💡 동적으로 가져온 Entity 클래스 이름으로 instanceof 검사
|
||||
$entityClass = $this->service->getEntityClass();
|
||||
if (!$entity instanceof $entityClass) {
|
||||
@ -99,10 +99,10 @@ abstract class AbstractCRUDController extends AbstractWebController
|
||||
}
|
||||
}
|
||||
|
||||
protected function modify_process($uid): object
|
||||
protected function modify_process($uid, array $formDatas): object
|
||||
{
|
||||
// POST 데이터를 DTO 객체로 변환
|
||||
return $this->service->modify($uid, $this->service->createDTO($this->request->getPost()));
|
||||
return $this->service->modify($uid, $this->service->createDTO($formDatas));
|
||||
}
|
||||
|
||||
protected function modify_result_process($entity, ?string $redirect_url = null): string|RedirectResponse
|
||||
@ -121,7 +121,7 @@ abstract class AbstractCRUDController extends AbstractWebController
|
||||
}
|
||||
$action = __FUNCTION__;
|
||||
$this->action_init_process($action);
|
||||
$entity = $this->modify_process($uid);
|
||||
$entity = $this->modify_process($uid, $this->request->getPost());
|
||||
$this->addViewDatas('entity', $entity);
|
||||
return $this->modify_result_process($entity);
|
||||
} catch (\Throwable $e) {
|
||||
|
||||
@ -45,16 +45,21 @@ class ServiceController extends CustomerController
|
||||
public function history(int $uid): RedirectResponse|string
|
||||
{
|
||||
try {
|
||||
$action = __FUNCTION__;
|
||||
$fields = ['history'];
|
||||
$this->service->getFormService()->setFormFields($fields);
|
||||
$this->service->getFormService()->setFormRules($action, $fields);
|
||||
$this->addViewDatas('entity', $this->service->modify($uid, $this->service->createDTO($this->request->getPost())));
|
||||
$this->addViewDatas('entity', parent::modify_process($uid, $this->request->getPost()));
|
||||
return $this->action_redirect_process('info', static::class . '->' . __FUNCTION__ . "에서 {$this->getTitle()} 비고설정이 완료되었습니다.");
|
||||
} catch (\Throwable $e) {
|
||||
return $this->action_redirect_process('error', static::class . '->' . __FUNCTION__ . "에서 {$this->getTitle()} 비고설정 오류:" . $e->getMessage());
|
||||
}
|
||||
}
|
||||
public function billingat(int $uid): RedirectResponse|string
|
||||
{
|
||||
try {
|
||||
$this->addViewDatas('entity', parent::modify_process($uid, $this->request->getPost()));
|
||||
return $this->action_redirect_process('info', static::class . '->' . __FUNCTION__ . "에서 {$this->getTitle()} 결제일 변경이 완료되었습니다.");
|
||||
} catch (\Throwable $e) {
|
||||
return $this->action_redirect_process('error', static::class . '->' . __FUNCTION__ . "에서 {$this->getTitle()} 결제일 변경 오류:" . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
//대체서버 추가
|
||||
public function alternative_create_form(int $uid): string|RedirectResponse
|
||||
|
||||
@ -17,9 +17,8 @@ abstract class CommonController extends AbstractCRUDController
|
||||
{
|
||||
// --- 일괄 작업 (Batch Job) ---
|
||||
|
||||
protected function batchjob_pre_process(array $postDatas = []): array
|
||||
protected function batchjob_pre_process(array $postDatas): array
|
||||
{
|
||||
$postDatas = $this->request->getPost();
|
||||
// 1. postDatas에서 선택된 uids 정보 추출
|
||||
$uids = $postDatas['batchjob_uids'] ?? [];
|
||||
if (empty($uids)) {
|
||||
@ -55,7 +54,7 @@ abstract class CommonController extends AbstractCRUDController
|
||||
try {
|
||||
$action = __FUNCTION__;
|
||||
// 사전작업 및 데이터 추출 초기화
|
||||
list($uids, $selectedFields, $formDatas) = $this->batchjob_pre_process();
|
||||
list($uids, $selectedFields, $formDatas) = $this->batchjob_pre_process($this->request->getPost());
|
||||
$this->service->getFormService()->setFormFields($selectedFields);
|
||||
$this->service->getFormService()->setFormRules($action, $selectedFields);
|
||||
$this->service->getFormService()->setFormFilters($selectedFields);
|
||||
@ -68,9 +67,8 @@ abstract class CommonController extends AbstractCRUDController
|
||||
}
|
||||
// --- 일괄 삭제 (Batch Job Delete) ---
|
||||
|
||||
protected function batchjob_delete_pre_process(): array
|
||||
protected function batchjob_delete_pre_process(array $postDatas): array
|
||||
{
|
||||
$postDatas = $this->request->getPost();
|
||||
$uids = $postDatas['batchjob_uids'] ?? [];
|
||||
if (empty($uids)) {
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 삭제할 리스트을 선택하셔야합니다.");
|
||||
@ -98,7 +96,7 @@ abstract class CommonController extends AbstractCRUDController
|
||||
final public function batchjob_delete(): string|RedirectResponse
|
||||
{
|
||||
try {
|
||||
$uids = $this->batchjob_delete_pre_process();
|
||||
$uids = $this->batchjob_delete_pre_process($this->request->getPost());
|
||||
$entities = $this->batchjob_delete_process($uids);
|
||||
return $this->batchjob_delete_result_process($uids, $entities);
|
||||
} catch (\Throwable $e) {
|
||||
|
||||
@ -106,14 +106,12 @@ abstract class CommonHelper
|
||||
switch ($field) {
|
||||
case 'email':
|
||||
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' form-control' : 'form-control';
|
||||
$extras['style'] = 'width:100%;';
|
||||
$extras['placeholder'] = '예)test@example.co.kr';
|
||||
$form = form_input($field, $value ?? "", $extras);
|
||||
break;
|
||||
case 'mobile':
|
||||
case 'phone':
|
||||
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' form-control' : 'form-control';
|
||||
$extras['style'] = 'width:100%;';
|
||||
$extras['placeholder'] = '예)010-0010-0010';
|
||||
$form = form_input($field, $value ?? "", $extras);
|
||||
break;
|
||||
@ -125,8 +123,7 @@ abstract class CommonHelper
|
||||
case 'updated_at':
|
||||
case 'created_at':
|
||||
case 'deleted_at':
|
||||
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' form-control calender' : 'form-control calender';
|
||||
$extras['style'] = 'width:100%;';
|
||||
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' calender' : 'calender';
|
||||
$form = form_input($field, $value ?? "", $extras);
|
||||
break;
|
||||
case 'description':
|
||||
@ -134,7 +131,6 @@ abstract class CommonHelper
|
||||
case 'detail':
|
||||
case 'history':
|
||||
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' form-control tinymce' : 'form-control tinymce';
|
||||
$extras['style'] = 'width:100%;';
|
||||
$form = form_textarea($field, html_entity_decode($value ?? "", ENT_QUOTES, 'UTF-8'), $extras);
|
||||
break;
|
||||
case 'status':
|
||||
@ -153,7 +149,6 @@ abstract class CommonHelper
|
||||
}
|
||||
$form = form_dropdown($field, $viewDatas['formOptions'][$field]['options'], $value, $extras);
|
||||
} else {
|
||||
$extras['style'] = 'width:100%;';
|
||||
$form = form_input($field, $value ?? "", $extras);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
<th style="width: 120px">서비스정보</th>
|
||||
<th>서버</th>
|
||||
<th style="width: 600px">서비스 비고</th>
|
||||
<th style="width: 200px">결제처리</th>
|
||||
<th style="width: 200px">결제관련사항</th>
|
||||
</tr>
|
||||
<?php foreach ($serviceCellDatas['entities'] as $entity): ?>
|
||||
<?php $serviceCellDatas['entity'] = $entity ?>
|
||||
|
||||
@ -1,10 +1,14 @@
|
||||
<table class="table m-0 p-0">
|
||||
<tr>
|
||||
<th class="fw-bold" nowrap>결제일</th>
|
||||
<td nowrap><?= $serviceEntity->getBillingAT() ?></td>
|
||||
<td colspan="2" nowrap class="text-start">
|
||||
<?= form_open("/admin/customer/service/billingat/{$serviceEntity->getPK()}", $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
|
||||
<span class="fw-bold">결제일</span> <?= $serviceCellDatas['helper']->getFieldForm('billing_at', $serviceEntity->getBillingAt(), ['entity' => $serviceEntity]) ?>
|
||||
<?= form_submit('', '변경', array("class" => "btn btn-outline btn-primary")); ?>
|
||||
<?= form_close(); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="fw-bold text-info" nowrap>결제금</th>
|
||||
<th class=" fw-bold text-info" nowrap>결제금</th>
|
||||
<td nowrap><?= number_format(intval($serviceEntity->getAmount())) ?>원</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user