dbmsv4 init...2

This commit is contained in:
최준흠 2025-12-09 13:28:56 +09:00
parent ca85c5a21d
commit 358323ce8d
16 changed files with 145 additions and 156 deletions

View File

@ -102,45 +102,6 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au
$routes->get('detail/(:num)', 'ClientController::detail/$1');
$routes->post('history/(:num)', 'ClientController::history/$1');
});
$routes->group('account', function ($routes) {
$routes->get('/', 'AccountController::index');
$routes->get('create', 'AccountController::create_form');
$routes->post('create', 'AccountController::create');
$routes->get('modify/(:num)', 'AccountController::modify_form/$1');
$routes->post('modify/(:num)', 'AccountController::modify/$1');
$routes->get('view/(:num)', 'AccountController::view/$1');
$routes->get('delete/(:num)', 'AccountController::delete/$1');
$routes->get('toggle/(:num)/(:any)', 'AccountController::toggle/$1/$2');
$routes->post('batchjob', 'AccountController::batchjob');
$routes->post('batchjob_delete', 'AccountController::batchjob_delete');
$routes->get('download/(:alpha)', 'AccountController::download/$1');
});
$routes->group('coupon', function ($routes) {
$routes->get('/', 'CouponController::index');
$routes->get('create', 'CouponController::create_form');
$routes->post('create', 'CouponController::create');
$routes->get('modify/(:num)', 'CouponController::modify_form/$1');
$routes->post('modify/(:num)', 'CouponController::modify/$1');
$routes->get('view/(:num)', 'CouponController::view/$1');
$routes->get('delete/(:num)', 'CouponController::delete/$1');
$routes->get('toggle/(:num)/(:any)', 'CouponController::toggle/$1/$2');
$routes->post('batchjob', 'CouponController::batchjob');
$routes->post('batchjob_delete', 'CouponController::batchjob_delete');
$routes->get('download/(:alpha)', 'CouponController::download/$1');
});
$routes->group('point', function ($routes) {
$routes->get('/', 'PointController::index');
$routes->get('create', 'PointController::create_form');
$routes->post('create', 'PointController::create');
$routes->get('modify/(:num)', 'PointController::modify_form/$1');
$routes->post('modify/(:num)', 'PointController::modify/$1');
$routes->get('view/(:num)', 'PointController::view/$1');
$routes->get('delete/(:num)', 'PointController::delete/$1');
$routes->get('toggle/(:num)/(:any)', 'PointController::toggle/$1/$2');
$routes->post('batchjob', 'PointController::batchjob');
$routes->post('batchjob_delete', 'PointController::batchjob_delete');
$routes->get('download/(:alpha)', 'PointController::download/$1');
});
$routes->group('service', function ($routes) {
$routes->get('/', 'ServiceController::index');
$routes->get('create', 'ServiceController::create_form');
@ -159,6 +120,47 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au
$routes->get('terminateServer/(:num)', 'ServiceController::alternative_delete/$1');
$routes->post('history/(:num)', 'ServiceController::history/$1');
});
$routes->group('wallet', ['namespace' => 'App\Controllers\Admin\Customer\Wallet'], function ($routes) {
$routes->group('account', function ($routes) {
$routes->get('/', 'AccountController::index');
$routes->get('create', 'AccountController::create_form');
$routes->post('create', 'AccountController::create');
$routes->get('modify/(:num)', 'AccountController::modify_form/$1');
$routes->post('modify/(:num)', 'AccountController::modify/$1');
$routes->get('view/(:num)', 'AccountController::view/$1');
$routes->get('delete/(:num)', 'AccountController::delete/$1');
$routes->get('toggle/(:num)/(:any)', 'AccountController::toggle/$1/$2');
$routes->post('batchjob', 'AccountController::batchjob');
$routes->post('batchjob_delete', 'AccountController::batchjob_delete');
$routes->get('download/(:alpha)', 'AccountController::download/$1');
});
$routes->group('coupon', function ($routes) {
$routes->get('/', 'CouponController::index');
$routes->get('create', 'CouponController::create_form');
$routes->post('create', 'CouponController::create');
$routes->get('modify/(:num)', 'CouponController::modify_form/$1');
$routes->post('modify/(:num)', 'CouponController::modify/$1');
$routes->get('view/(:num)', 'CouponController::view/$1');
$routes->get('delete/(:num)', 'CouponController::delete/$1');
$routes->get('toggle/(:num)/(:any)', 'CouponController::toggle/$1/$2');
$routes->post('batchjob', 'CouponController::batchjob');
$routes->post('batchjob_delete', 'CouponController::batchjob_delete');
$routes->get('download/(:alpha)', 'CouponController::download/$1');
});
$routes->group('point', function ($routes) {
$routes->get('/', 'PointController::index');
$routes->get('create', 'PointController::create_form');
$routes->post('create', 'PointController::create');
$routes->get('modify/(:num)', 'PointController::modify_form/$1');
$routes->post('modify/(:num)', 'PointController::modify/$1');
$routes->get('view/(:num)', 'PointController::view/$1');
$routes->get('delete/(:num)', 'PointController::delete/$1');
$routes->get('toggle/(:num)/(:any)', 'PointController::toggle/$1/$2');
$routes->post('batchjob', 'PointController::batchjob');
$routes->post('batchjob_delete', 'PointController::batchjob_delete');
$routes->get('download/(:alpha)', 'PointController::download/$1');
});
});
});
//Customer 관련
//Equipment 관련

View File

@ -37,7 +37,7 @@ abstract class AbstractCRUDController extends AbstractWebController
$this->addViewDatas('formDatas', $formDatas);
return $this->create_form_result_process($action);
} catch (\Throwable $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성폼 오류:" . $e->getMessage());
return $this->action_redirect_process('error', static::class . '->' . __FUNCTION__ . "에서 {$this->getTitle()} 생성폼 오류:" . $e->getMessage());
}
}
protected function create_process(): object
@ -68,7 +68,7 @@ abstract class AbstractCRUDController extends AbstractWebController
}
return $this->create_result_process($entity);
} catch (\Throwable $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성 오류:" . $e->getMessage());
return $this->action_redirect_process('error', static::class . '->' . __FUNCTION__ . "에서 {$this->getTitle()} 생성 오류:" . $e->getMessage());
}
}
@ -96,7 +96,7 @@ abstract class AbstractCRUDController extends AbstractWebController
$this->action_init_process($action, $entity->toArray());
return $this->modify_form_result_process($action);
} catch (\Throwable $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 수정폼 오류:" . $e->getMessage());
return $this->action_redirect_process('error', static::class . '->' . __FUNCTION__ . "에서 {$this->getTitle()} 수정폼 오류:" . $e->getMessage());
}
}
@ -126,7 +126,7 @@ abstract class AbstractCRUDController extends AbstractWebController
$this->addViewDatas('entity', $entity);
return $this->modify_result_process($entity);
} catch (\Throwable $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 수정 오류:" . $e->getMessage());
return $this->action_redirect_process('error', static::class . '->' . __FUNCTION__ . "에서 {$this->getTitle()} 수정 오류:" . $e->getMessage());
}
}
@ -150,7 +150,7 @@ abstract class AbstractCRUDController extends AbstractWebController
$entity = $this->delete_process($uid);
return $this->delete_result_process($entity);
} catch (\Throwable $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 삭제 오류:" . $e->getMessage());
return $this->action_redirect_process('error', static::class . '->' . __FUNCTION__ . "에서 {$this->getTitle()} 삭제 오류:" . $e->getMessage());
}
}
@ -177,7 +177,7 @@ abstract class AbstractCRUDController extends AbstractWebController
$this->addViewDatas('entity', $entity);
return $this->view_result_process($action);
} catch (\Throwable $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 상세보기 오류:" . $e->getMessage());
return $this->action_redirect_process('error', static::class . '->' . __FUNCTION__ . "에서 {$this->getTitle()} 상세보기 오류:" . $e->getMessage());
}
}
}

View File

@ -48,8 +48,7 @@ class ClientController extends CustomerController
helper(['form']);
return $this->action_render_process($action, $this->getViewDatas(), $this->request->getVar('ActionTemplate') ?? 'client');
} catch (\Throwable $e) {
return $e->getMessage();
// return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정폼 오류:" . $e->getMessage());
return $this->action_redirect_process('error', static::class . '->' . __FUNCTION__ . "에서 {$this->getTitle()} 고객 Detail Page 오류:" . $e->getMessage());
}
}
@ -61,9 +60,9 @@ class ClientController extends CustomerController
$this->service->getFormService()->setFormFields($fields);
$this->service->getFormService()->setFormRules($action, $fields);
$this->addViewDatas('entity', $this->service->modify($uid, $this->service->createDTO($this->request->getPost())));
return $this->action_redirect_process('error', "{$this->getTitle()}에서 비고설정이 완료되었습니다.");
return $this->action_redirect_process('info', static::class . '->' . __FUNCTION__ . "에서 {$this->getTitle()} 비고설정이 완료되었습니다.");
} catch (\Throwable $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 비고 오류:" . $e->getMessage());
return $this->action_redirect_process('error', static::class . '->' . __FUNCTION__ . "에서 {$this->getTitle()} 비고설정 오류:" . $e->getMessage());
}
}
}

View File

@ -50,9 +50,9 @@ class ServiceController extends CustomerController
$this->service->getFormService()->setFormFields($fields);
$this->service->getFormService()->setFormRules($action, $fields);
$this->addViewDatas('entity', $this->service->modify($uid, $this->service->createDTO($this->request->getPost())));
return $this->action_redirect_process('error', "{$this->getTitle()}에서 비고설정이 완료되었습니다.");
return $this->action_redirect_process('info', static::class . '->' . __FUNCTION__ . "에서 {$this->getTitle()} 비고설정이 완료되었습니다.");
} catch (\Throwable $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 비고 오류:" . $e->getMessage());
return $this->action_redirect_process('error', static::class . '->' . __FUNCTION__ . "에서 {$this->getTitle()} 비고설정 오류:" . $e->getMessage());
}
}
@ -64,7 +64,7 @@ class ServiceController extends CustomerController
$this->action_init_process($action, $this->request->getVar());
return $this->action_render_process($action, $this->getViewDatas(), $this->request->getVar('ActionTemplate') ?? 'server');
} catch (\Throwable $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 대체서버 추가폼 오류:" . $e->getMessage());
return $this->action_redirect_process('error', static::class . '->' . __FUNCTION__ . "에서 {$this->getTitle()} 대체서버 추가폼 오류:" . $e->getMessage());
}
}
public function alternative_create(int $uid): string|RedirectResponse
@ -78,9 +78,9 @@ class ServiceController extends CustomerController
$entity = $this->service->getEntity($uid);
//대체서버 추가
service('equipment_serverservice')->attachToService($entity, $this->request->getPost('serverinfo_uid'));
return $this->action_redirect_process('info', "{$this->getTitle()}에서 대체서버추가가 완료되었습니다");
return $this->action_redirect_process('info', static::class . '->' . __FUNCTION__ . "에서 {$this->getTitle()} 대체서버 추가가 완료되었습니다.");
} catch (\Throwable $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 대체서버추가 오류:" . $e->getMessage());
return $this->action_redirect_process('error', static::class . '->' . __FUNCTION__ . "에서 {$this->getTitle()} 대체서버 추가 오류:" . $e->getMessage());
}
}
@ -102,9 +102,9 @@ class ServiceController extends CustomerController
$formDatas['title'] = $serverEntity->getCustomTitle();
//대체서버를 메인서버로 설정
$this->service->modify($uid, $this->service->createDTO($formDatas));
return $this->action_redirect_process('info', "{$this->getTitle()}에서 메인서버설정이 완료되었습니다");
return $this->action_redirect_process('info', static::class . '->' . __FUNCTION__ . "에서 {$this->getTitle()} 메인서버 설정이 완료되었습니다.");
} catch (\Throwable $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 메인서버설정 오류:" . $e->getMessage());
return $this->action_redirect_process('error', static::class . '->' . __FUNCTION__ . "에서 {$this->getTitle()} 메인서버 설정 오류:" . $e->getMessage());
}
}
public function alternative_delete(int $uid): string|RedirectResponse
@ -118,9 +118,9 @@ class ServiceController extends CustomerController
$entity = $this->service->getEntity($uid);
//대체서버 해지
service('equipment_serverservice')->detachFromService($entity, $this->request->getGet('serverinfo_uid'));
return $this->action_redirect_process('info', "{$this->getTitle()}에서 대체서버해지가 완료되었습니다");
return $this->action_redirect_process('info', static::class . '->' . __FUNCTION__ . "에서 {$this->getTitle()} 대체서버 해지가 완료되었습니다.");
} catch (\Throwable $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 대체서버 해지 오류:" . $e->getMessage());
return $this->action_redirect_process('error', static::class . '->' . __FUNCTION__ . "에서 {$this->getTitle()} 대체서버 해지 오류:" . $e->getMessage());
}
}
}

View File

@ -94,7 +94,7 @@ class PaymentController extends AdminController
$this->addViewDatas('rows', $rows);
return $this->invoice_result_process($action);
} catch (\Throwable $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 청구서발행 오류:" . $e->getMessage());
return $this->action_redirect_process('error', static::class . '->' . __FUNCTION__ . "에서 {$this->getTitle()} 청구서발행 오류:" . $e->getMessage());
}
}
public function paid($uid): string|RedirectResponse
@ -103,7 +103,7 @@ class PaymentController extends AdminController
$entity = $this->service->paid($uid);
return $this->action_redirect_process('info', "{$this->getTitle()}에서 {$entity->getTitle()} 결체처리가 완료되었습니다.");
} catch (\Throwable $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 결제 오류:" . $e->getMessage());
return $this->action_redirect_process('error', static::class . '->' . __FUNCTION__ . "에서 {$this->getTitle()} 결제 오류:" . $e->getMessage());
}
}
}

View File

@ -23,13 +23,13 @@ abstract class CommonController extends AbstractCRUDController
// 1. postDatas에서 선택된 uids 정보 추출
$uids = $postDatas['batchjob_uids'] ?? [];
if (empty($uids)) {
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 적용할 리스트을 선택하셔야합니다.");
throw new RuntimeException("{$this->getTitle()}에서 일괄작업에 적용할 리스트을 선택하셔야합니다.");
}
// 2. 변경할 데이터 추출 및 정리
unset($postDatas['batchjob_uids'], $postDatas['batchjob_submit']); //formDatas에 포함되지 않게하기위함
$formDatas = array_filter($postDatas, fn($value) => $value !== "" && $value !== null);
if (empty($formDatas)) {
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 변경할 조건항목을 선택하셔야합니다.");
throw new RuntimeException("{$this->getTitle()}에서 일괄작업에 변경할 조건항목을 선택하셔야합니다.");
}
// 3. 데이터가 있는 필드 추출
$selectedFields = array_keys($formDatas);
@ -64,7 +64,7 @@ abstract class CommonController extends AbstractCRUDController
$entities = $this->batchjob_process($uids, $formDatas);
return $this->batchjob_result_process($uids, $entities);
} catch (\Throwable $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄수정 오류:" . $e->getMessage());
return $this->action_redirect_process('error', static::class . '->' . __FUNCTION__ . "에서 {$this->getTitle()} 일괄수정 오류:" . $e->getMessage());
}
}
// --- 일괄 삭제 (Batch Job Delete) ---
@ -103,7 +103,7 @@ abstract class CommonController extends AbstractCRUDController
$entities = $this->batchjob_delete_process($uids);
return $this->batchjob_delete_result_process($uids, $entities);
} catch (\Throwable $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄삭제 오류:" . $e->getMessage());
return $this->action_redirect_process('error', static::class . '->' . __FUNCTION__ . "에서 {$this->getTitle()} 일괄삭제 오류:" . $e->getMessage());
}
}
@ -294,7 +294,7 @@ abstract class CommonController extends AbstractCRUDController
$this->action_init_process($action);
return $this->download_process($action, $output_type, $uid);
} catch (\Throwable $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 Download 오류:" . $e->getMessage());
return $this->action_redirect_process('error', static::class . '->' . __FUNCTION__ . "에서 {$this->getTitle()} 다운로드 오류:" . $e->getMessage());
}
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -54,7 +54,7 @@ class ClientHelper extends CustomerHelper
number_format(intval($value)) . "",
'index',
[
"data-src" => "/admin/customer/account?clientinfo_uid={$viewDatas['entity']->getPK()}&ActionTemplate=popup",
"data-src" => "/admin/customer/wallet/account?clientinfo_uid={$viewDatas['entity']->getPK()}&ActionTemplate=popup",
"data-bs-toggle" => "modal",
"data-bs-target" => "#modal_action_form",
"class" => "btn btn-sm form-label-sm text-primary",
@ -67,7 +67,7 @@ class ClientHelper extends CustomerHelper
number_format(intval($value)) . "",
'index',
[
"data-src" => "/admin/customer/coupon?clientinfo_uid={$viewDatas['entity']->getPK()}&ActionTemplate=popup",
"data-src" => "/admin/customer/wallet/coupon?clientinfo_uid={$viewDatas['entity']->getPK()}&ActionTemplate=popup",
"data-bs-toggle" => "modal",
"data-bs-target" => "#modal_action_form",
"class" => "btn btn-sm form-label-sm text-primary",
@ -80,7 +80,7 @@ class ClientHelper extends CustomerHelper
number_format(intval($value)) . "",
'index',
[
"data-src" => "/admin/customer/point?clientinfo_uid={$viewDatas['entity']->getPK()}&ActionTemplate=popup",
"data-src" => "/admin/customer/wallet/point?clientinfo_uid={$viewDatas['entity']->getPK()}&ActionTemplate=popup",
"data-bs-toggle" => "modal",
"data-bs-target" => "#modal_action_form",
"class" => "btn btn-sm form-label-sm text-primary",

View File

@ -169,9 +169,9 @@ abstract class CommonService
//생성용
protected function create_process(array $formDatas): object
{
if ($this instanceof PaymentService) {
log_message('debug', var_export($formDatas, true));
}
$fields = array_keys($formDatas);
$this->getFormService()->setFormFields($fields);
$this->getFormService()->setFormRules('create', $fields);
//FormData 검증
if (!$this->getFormService()->validate($formDatas)) {
throw new ValidationException(implode("\n", service('validation')->getErrors()));
@ -185,9 +185,9 @@ abstract class CommonService
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생:Return Type은 {$entityClass}만 가능");
}
$entity = $this->save_process($entity);
if ($entity instanceof PaymentEntity) {
log_message('debug', var_export($entity, true));
}
//입력/출력데이터 확인용
log_message('debug', var_export($formDatas, true));
log_message('debug', var_export($entity->toArray(), true));
return $entity;
}
final public function create(object $dto): object
@ -221,6 +221,9 @@ abstract class CommonService
//수정용
protected function modify_process($entity, array $formDatas): object
{
$fields = array_keys($formDatas);
$this->getFormService()->setFormFields($fields);
$this->getFormService()->setFormRules('modify', $fields);
// 검증
if (!$this->getFormService()->validate($formDatas)) {
throw new ValidationException(
@ -241,8 +244,11 @@ abstract class CommonService
$entity->$key = $value;
}
}
// dd($entity);
return $this->save_process($entity);
$entity = $this->save_process($entity);
//입력/출력데이터 확인용
log_message('debug', var_export($formDatas, true));
log_message('debug', var_export($entity->toArray(), true));
return $entity;
}
final public function modify(string|int $uid, object $dto): object
@ -289,16 +295,11 @@ abstract class CommonService
$entity = $this->modify_process($entity, $formDatas);
return $entity;
}
final public function batchjob(array $uids, object $dto): array
final public function batchjob(array $uids, array $formDatas): array
{
$db = \Config\Database::connect();
try {
$db->transException(true)->transStart();
//DTO 타입 체크 로직을 일반화
$dtoClass = $this->getDTOClass();
if (!$dto instanceof $dtoClass) {
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: " . get_class($dto) . "는 사용할 수 없습니다. ({$dtoClass} 필요)");
}
//일괄작업처리
$entities = [];
foreach ($uids as $uid) {
@ -311,7 +312,7 @@ abstract class CommonService
if (!$entity instanceof $entityClass) {
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생:Return Type은 {$entityClass}만 가능");
}
$entities[] = $this->batchjob_process($entity, $dto->toArray());
$entities[] = $this->batchjob_process($entity, $formDatas);
}
// 트랜잭션 완료 및 커밋
$db->transComplete();

View File

@ -120,18 +120,22 @@ class ClientService extends CustomerService
$calculatedValue = null;
$balance = 0;
$title = "";
$field = "";
switch ($key) {
case PAYMENT['PAY']['ACCOUNT']:
$balance = $entity->getAccountBalance();
$title = "예치금";
$field = "account_balance";
break;
case PAYMENT['PAY']['COUPON']:
$balance = $entity->getCouponBalance();
$title = "쿠폰";
$field = "coupon_balance";
break;
case PAYMENT['PAY']['POINT']:
$balance = $entity->getPointBalance();
$title = "포인트";
$field = "point_balance";
break;
}
//입금,추가 처리
@ -157,10 +161,7 @@ class ClientService extends CustomerService
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 {$entity->getTitle()} 고객 {$title}의 계산결과 값이 NULL이거나 0보다 작은 값입니다.");
}
//balance 수정
$formDatas = ["{$key}_balance" => $calculatedValue, 'status' => $status];
$fields = array_keys($formDatas);
$this->getFormService()->setFormFields($fields);
$this->getFormService()->setFormRules('modify', $fields);
$formDatas = [$field => $calculatedValue, 'status' => $status];
return parent::modify_process($entity, $formDatas);
}
//pay방식에따른 결제처리

View File

@ -184,9 +184,6 @@ class ServiceService extends CustomerService
}
//총 서비스금액 설정
$formDatas = ['billing_at' => $billing_at];
$fields = array_keys($formDatas);
$this->getFormService()->setFormFields($fields);
$this->getFormService()->setFormRules('modify', $fields);
return parent::modify_process($entity, $formDatas);
}
// 서비스금액관련처리
@ -203,9 +200,6 @@ class ServiceService extends CustomerService
//총 서비스금액 설정
$formDatas = ['amount' => $caculatedAmount];
$fields = array_keys($formDatas);
$this->getFormService()->setFormFields($fields);
$this->getFormService()->setFormRules('modify', $fields);
return parent::modify_process($entity, $formDatas);
}
//기본 기능부분

View File

@ -274,9 +274,6 @@ class ServerService extends EquipmentService
$formDatas['serviceinfo_uid'] = $serviceEntity->getPK();
$formDatas["clientinfo_uid"] = $serviceEntity->getClientInfoUID();
$formDatas['status'] = $formDatas['status'] ?? STATUS['OCCUPIED'];
$fields = array_keys($formDatas);
$this->getFormService()->setFormFields($fields);
$this->getFormService()->setFormRules('modify', $fields);
parent::modify_process($entity, $formDatas);
}
public function detachFromService(int|ServerEntity $uid): void
@ -290,9 +287,6 @@ class ServerService extends EquipmentService
$formDatas["switchinfo_uid"] = NULL;
$formDatas["ip"] = NULL;
$formDatas['status'] = $formDatas['status'] ?? STATUS['AVAILABLE'];
$fields = array_keys($formDatas);
$this->getFormService()->setFormFields($fields);
$this->getFormService()->setFormRules('modify', $fields);
parent::modify_process($entity, $formDatas);
//서버파트정보처리
service('part_ipservice')->detachFromServer($entity);

View File

@ -16,12 +16,4 @@ abstract class PartService extends CommonService
}
abstract public function attachToServerPart(ServerPartEntity $serverPartEntity, array $formDatas = []): PartEntity;
abstract public function detachFromServerPart(ServerPartEntity $serverPartEntity, array $formDatas = []): PartEntity;
protected function modify_process($entity, array $formDatas): object
{
$fields = array_keys($formDatas);
$this->getFormService()->setFormFields($fields);
$this->getFormService()->setFormRules('modify', $fields);
return parent::modify_process($entity, $formDatas);
}
}

View File

@ -208,6 +208,47 @@ class PaymentService extends CommonService
return $entity;
}
//지불 관련
//일괄 지불용
protected function batchjob_process($entity, array $formDatas): object
{
// modify_process를 호출하여 로직 재사용 (PK 로드 및 PK 제거/방어 로직 포함)
$entity = $this->modify_process($entity, $formDatas);
//지불방식에 따른 고객 예치금,쿠폰,포인트 처리
service('customer_clientservice')->updateWalletByPayment($entity);
return $entity;
}
//단일 지불용
public function paid($uid): PaymentEntity
{
$db = \Config\Database::connect();
try {
//트랜잭션 도중 DB 오류가 발생하면 DatabaseException을 던지도록 설정
$db->transException(true)->transStart();
$entity = $this->getEntity($uid);
if (!$entity instanceof PaymentEntity) {
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생:[{$uid}]에 대한 결제정보를 찾을 수 없습니다.");
}
//결제 완료 처리 후 추가정보 처리
$entity = parent::modify_process($entity, ['status' => STATUS['PAID']]);
//지불방식에 따른 고객 예치금,쿠폰,포인트 처리
service('customer_clientservice')->updateWalletByPayment($entity);
$db->transComplete();
return $entity;
} catch (DatabaseException $e) {
// DatabaseException을 포착하면 자동으로 롤백 처리됨
throw new RuntimeException(sprintf(
"\n----[%s]에서 트랜잭션 실패: DB 오류----\n%s\n%s\n------------------------------\n",
__METHOD__,
$this->model->getLastQuery(),
$e->getMessage()
), $e->getCode(), $e);
} catch (\Throwable $e) {
$db->transRollback(); // 예외 발생 시 수동으로 롤백
throw new RuntimeException($e->getMessage(), 0, $e);
}
}
//청구서 관련
public function getInvoices(ClientEntity $clientEntity, ServiceEntity $serviceEntity, PaymentEntity $entity, array $rows): array
{
@ -240,41 +281,6 @@ class PaymentService extends CommonService
return $rows;
}
//지불 관련
public function paid($uid): PaymentEntity
{
$db = \Config\Database::connect();
try {
//트랜잭션 도중 DB 오류가 발생하면 DatabaseException을 던지도록 설정
$db->transException(true)->transStart();
$entity = $this->getEntity($uid);
if (!$entity instanceof PaymentEntity) {
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생:[{$uid}]에 대한 결제정보를 찾을 수 없습니다.");
}
//결제 완료 처리 후 추가정보 처리
$formDatas['status'] = STATUS['PAID'];
$fields = array_keys($formDatas);
$this->getFormService()->setFormFields($fields);
$this->getFormService()->setFormRules('modify', $fields);
$entity = parent::modify_process($entity, $formDatas);
//지불방식에 따른 고객 예치금,쿠폰,포인트 처리
$entity = service('customer_clientservice')->updateWalletByPayment($entity);
$db->transComplete();
return $entity;
} catch (DatabaseException $e) {
// DatabaseException을 포착하면 자동으로 롤백 처리됨
throw new RuntimeException(sprintf(
"\n----[%s]에서 트랜잭션 실패: DB 오류----\n%s\n%s\n------------------------------\n",
__METHOD__,
$this->model->getLastQuery(),
$e->getMessage()
), $e->getCode(), $e);
} catch (\Throwable $e) {
$db->transRollback(); // 예외 발생 시 수동으로 롤백
throw new RuntimeException($e->getMessage(), 0, $e);
}
}
//서비스관련
private function getFormDatasByService(ServiceEntity $serviceEntity, array $formDatas = []): array
{

View File

@ -15,13 +15,13 @@
<span class="nav-link active" aria-current="page" style="cursor:pointer;"><a href="/admin/customer/client">고객정보</a></span>
</li>
<li class="nav-item">
<span class="nav-link active" aria-current="page" style="cursor:pointer;"><a href="/admin/customer/account">예치금정보</a></span>
<span class="nav-link active" aria-current="page" style="cursor:pointer;"><a href="/admin/customer/wallet/account">예치금정보</a></span>
</li>
<li class="nav-item">
<span class="nav-link active" aria-current="page" style="cursor:pointer;"><a href="/admin/customer/coupon">쿠폰정보</a></span>
<span class="nav-link active" aria-current="page" style="cursor:pointer;"><a href="/admin/customer/wallet/coupon">쿠폰정보</a></span>
</li>
<li class="nav-item">
<span class="nav-link active" aria-current="page" style="cursor:pointer;"><a href="/admin/customer/point">포인트정보</a></span>
<span class="nav-link active" aria-current="page" style="cursor:pointer;"><a href="/admin/customer/wallet/point">포인트정보</a></span>
</li>
<li class="nav-item">
<span class="nav-link active" aria-current="page" style="cursor:pointer;"><a href="/admin/customer/service">서비스정보</a></span>