dbmsv4 init...1
This commit is contained in:
parent
dd1b77f1c3
commit
13aff6e960
@ -71,6 +71,24 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au
|
|||||||
$routes->get('notice', 'BoardController::notice');
|
$routes->get('notice', 'BoardController::notice');
|
||||||
$routes->get('reqeusttask', 'BoardController::reqeusttask');
|
$routes->get('reqeusttask', 'BoardController::reqeusttask');
|
||||||
});
|
});
|
||||||
|
$routes->group('payment', ['namespace' => 'App\Controllers\Admin'], function ($routes) {
|
||||||
|
$routes->get('/', 'PaymentController::index');
|
||||||
|
//일회성결제관련용
|
||||||
|
$routes->get('create', 'PaymentController::create_form');
|
||||||
|
$routes->post('create', 'PaymentController::create');
|
||||||
|
$routes->get('modify/(:num)', 'PaymentController::modify_form/$1');
|
||||||
|
$routes->post('modify/(:num)', 'PaymentController::modify/$1');
|
||||||
|
$routes->get('view/(:num)', 'PaymentController::view/$1');
|
||||||
|
$routes->get('delete/(:num)', 'PaymentController::delete/$1');
|
||||||
|
$routes->get('toggle/(:num)/(:any)', 'PaymentController::toggle/$1/$2');
|
||||||
|
$routes->post('batchjob', 'PaymentController::batchjob');
|
||||||
|
$routes->post('batchjob_delete', 'PaymentController::batchjob_delete');
|
||||||
|
$routes->get('download/(:alpha)', 'PaymentController::download/$1');
|
||||||
|
//결체처리
|
||||||
|
$routes->post('paid', 'PaymentController::paid');
|
||||||
|
//청구서발행용
|
||||||
|
$routes->post('invoice', 'PaymentController::invoice');
|
||||||
|
});
|
||||||
//Customer 관련
|
//Customer 관련
|
||||||
$routes->group('customer', ['namespace' => 'App\Controllers\Admin\Customer'], function ($routes) {
|
$routes->group('customer', ['namespace' => 'App\Controllers\Admin\Customer'], function ($routes) {
|
||||||
$routes->group('client', ['namespace' => 'App\Controllers\Admin\Customer'], function ($routes) {
|
$routes->group('client', ['namespace' => 'App\Controllers\Admin\Customer'], function ($routes) {
|
||||||
@ -145,24 +163,6 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au
|
|||||||
$routes->get('terminateServer/(:num)', 'ServiceController::terminateServer/$1');
|
$routes->get('terminateServer/(:num)', 'ServiceController::terminateServer/$1');
|
||||||
$routes->post('history/(:num)', 'ServiceController::history/$1');
|
$routes->post('history/(:num)', 'ServiceController::history/$1');
|
||||||
});
|
});
|
||||||
$routes->group('payment', ['namespace' => 'App\Controllers\Admin\Customer'], function ($routes) {
|
|
||||||
$routes->get('/', 'PaymentController::index');
|
|
||||||
//일회성결제관련용
|
|
||||||
$routes->get('create', 'PaymentController::create_form');
|
|
||||||
$routes->post('create', 'PaymentController::create');
|
|
||||||
$routes->get('modify/(:num)', 'PaymentController::modify_form/$1');
|
|
||||||
$routes->post('modify/(:num)', 'PaymentController::modify/$1');
|
|
||||||
$routes->get('view/(:num)', 'PaymentController::view/$1');
|
|
||||||
$routes->get('delete/(:num)', 'PaymentController::delete/$1');
|
|
||||||
$routes->get('toggle/(:num)/(:any)', 'PaymentController::toggle/$1/$2');
|
|
||||||
$routes->post('batchjob', 'PaymentController::batchjob');
|
|
||||||
$routes->post('batchjob_delete', 'PaymentController::batchjob_delete');
|
|
||||||
$routes->get('download/(:alpha)', 'PaymentController::download/$1');
|
|
||||||
//결체처리
|
|
||||||
$routes->post('paid', 'PaymentController::paid');
|
|
||||||
//청구서발행용
|
|
||||||
$routes->post('invoice', 'PaymentController::invoice');
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
//Customer 관련
|
//Customer 관련
|
||||||
//Equipment 관련
|
//Equipment 관련
|
||||||
|
|||||||
@ -6,7 +6,11 @@ use App\Services\Auth\GoogleService;
|
|||||||
use App\Services\Auth\LocalService;
|
use App\Services\Auth\LocalService;
|
||||||
use App\Services\CollectorService;
|
use App\Services\CollectorService;
|
||||||
use App\Services\Customer\AccountService;
|
use App\Services\Customer\AccountService;
|
||||||
|
use App\Services\Customer\ClientService;
|
||||||
|
use App\Services\Customer\CouponService;
|
||||||
|
use App\Services\Customer\PointService;
|
||||||
use App\Services\MylogService;
|
use App\Services\MylogService;
|
||||||
|
use App\Services\PaymentService;
|
||||||
use App\Services\TrafficService;
|
use App\Services\TrafficService;
|
||||||
use App\Services\UserService;
|
use App\Services\UserService;
|
||||||
use CodeIgniter\Config\BaseService;
|
use CodeIgniter\Config\BaseService;
|
||||||
@ -78,7 +82,6 @@ class Services extends BaseService
|
|||||||
new \App\Models\USerModel()
|
new \App\Models\USerModel()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function mylogservice($getShared = true): MylogService
|
public static function mylogservice($getShared = true): MylogService
|
||||||
{
|
{
|
||||||
if ($getShared) {
|
if ($getShared) {
|
||||||
@ -88,17 +91,16 @@ class Services extends BaseService
|
|||||||
new \App\Models\MylogModel(),
|
new \App\Models\MylogModel(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
public static function paymentservice($getShared = true): PaymentService
|
||||||
//Customer
|
|
||||||
public static function customer_accountservice($getShared = true): AccountService
|
|
||||||
{
|
{
|
||||||
if ($getShared) {
|
if ($getShared) {
|
||||||
return static::getSharedInstance(__FUNCTION__);
|
return static::getSharedInstance(__FUNCTION__);
|
||||||
}
|
}
|
||||||
return new AccountService(
|
return new PaymentService(
|
||||||
new \App\Models\Customer\AccountModel(),
|
new \App\Models\PaymentModel(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
//Customer
|
||||||
public static function customer_clientservice($getShared = true): ClientService
|
public static function customer_clientservice($getShared = true): ClientService
|
||||||
{
|
{
|
||||||
if ($getShared) {
|
if ($getShared) {
|
||||||
@ -108,4 +110,41 @@ class Services extends BaseService
|
|||||||
new \App\Models\Customer\ClientModel(),
|
new \App\Models\Customer\ClientModel(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
public static function customer_accountservice($getShared = true): AccountService
|
||||||
|
{
|
||||||
|
if ($getShared) {
|
||||||
|
return static::getSharedInstance(__FUNCTION__);
|
||||||
|
}
|
||||||
|
return new AccountService(
|
||||||
|
new \App\Models\Customer\AccountModel(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
public static function customer_coupontservice($getShared = true): CouponService
|
||||||
|
{
|
||||||
|
if ($getShared) {
|
||||||
|
return static::getSharedInstance(__FUNCTION__);
|
||||||
|
}
|
||||||
|
return new CouponService(
|
||||||
|
new \App\Models\Customer\CouponModel(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
public static function customer_pointservice($getShared = true): PointService
|
||||||
|
{
|
||||||
|
if ($getShared) {
|
||||||
|
return static::getSharedInstance(__FUNCTION__);
|
||||||
|
}
|
||||||
|
return new PointService(
|
||||||
|
new \App\Models\Customer\PointModel(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
//Equipment
|
||||||
|
public static function equipment_lineservice($getShared = true): LineService
|
||||||
|
{
|
||||||
|
if ($getShared) {
|
||||||
|
return static::getSharedInstance(__FUNCTION__);
|
||||||
|
}
|
||||||
|
return new LineService(
|
||||||
|
new \App\Models\Equipment\LineModel(),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
225
app/Controllers/Admin/Customer/CouponController.php
Normal file
225
app/Controllers/Admin/Customer/CouponController.php
Normal file
@ -0,0 +1,225 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controllers\Admin\Customer;
|
||||||
|
|
||||||
|
use App\Entities\Customer\CouponEntity;
|
||||||
|
use CodeIgniter\HTTP\DownloadResponse;
|
||||||
|
use CodeIgniter\HTTP\RedirectResponse;
|
||||||
|
use CodeIgniter\HTTP\RequestInterface;
|
||||||
|
use CodeIgniter\HTTP\ResponseInterface;
|
||||||
|
use CodeIgniter\Validation\Exceptions\ValidationException;
|
||||||
|
use Psr\Log\LoggerInterface;
|
||||||
|
|
||||||
|
class CouponController extends CustomerController
|
||||||
|
{
|
||||||
|
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||||
|
{
|
||||||
|
parent::initController($request, $response, $logger);
|
||||||
|
if ($this->service === null) {
|
||||||
|
$this->service = service('customer_couponservice');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
protected function action_init_process(string $action): void
|
||||||
|
{
|
||||||
|
$fields = [
|
||||||
|
"clientinfo_uid",
|
||||||
|
"title",
|
||||||
|
"cnt",
|
||||||
|
"status",
|
||||||
|
"content"
|
||||||
|
];
|
||||||
|
$filters = [
|
||||||
|
"clientinfo_uid",
|
||||||
|
"status",
|
||||||
|
];
|
||||||
|
$batchjobFilters = ['status'];
|
||||||
|
// $actionButtons = ['view' => ICONS['SEARCH']];
|
||||||
|
// $batchjobButtons = [];
|
||||||
|
parent::action_init_process($action);
|
||||||
|
switch ($action) {
|
||||||
|
case 'create':
|
||||||
|
case 'create_form':
|
||||||
|
case 'modify':
|
||||||
|
case 'modify_form':
|
||||||
|
break;
|
||||||
|
case 'view':
|
||||||
|
$fields = [...$fields, 'created_at'];
|
||||||
|
break;
|
||||||
|
case 'index':
|
||||||
|
case 'download':
|
||||||
|
$fields = [...$fields, 'created_at'];
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new \Exception("[{$action}] 지원하지 않는 action입니다.");
|
||||||
|
// break;
|
||||||
|
}
|
||||||
|
$this->service->getFormService()->setFormFields($fields);
|
||||||
|
$this->service->getFormService()->setFormRules($action, $fields);
|
||||||
|
$this->service->getFormService()->setFormFilters($filters);
|
||||||
|
$this->service->getFormService()->setFormOptions($filters);
|
||||||
|
$this->service->getFormService()->setBatchjobFilters($batchjobFilters);
|
||||||
|
// $this->service->getFormService()->setActionButtons($actionButtons);
|
||||||
|
// $this->service->getFormService()->setBatchjobButtons($batchjobButtons);
|
||||||
|
parent::action_init_process($action);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create_form(): string|RedirectResponse
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$action = __FUNCTION__;
|
||||||
|
$this->action_init_process($action);
|
||||||
|
$this->addViewDatas('formDatas', $this->create_form_process());
|
||||||
|
return $this->create_form_result_process($action);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성폼 오류:" . $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public function create(): string|RedirectResponse
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$action = __FUNCTION__;
|
||||||
|
$this->action_init_process($action);
|
||||||
|
$entity = $this->create_process();
|
||||||
|
if (!$entity instanceof CouponEntity) {
|
||||||
|
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 CouponEntity만 가능");
|
||||||
|
}
|
||||||
|
return $this->create_result_process($entity);
|
||||||
|
} catch (ValidationException $e) {
|
||||||
|
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성 검증오류:" . $e->getMessage());
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성 오류:" . $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public function modify_form($uid): string|RedirectResponse
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$action = __FUNCTION__;
|
||||||
|
$this->action_init_process($action);
|
||||||
|
$entity = $this->modify_form_process($uid);
|
||||||
|
if (!$entity instanceof CouponEntity) {
|
||||||
|
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 CouponEntity만 가능");
|
||||||
|
}
|
||||||
|
$this->addViewDatas('entity', $entity);
|
||||||
|
return $this->modify_form_result_process($action);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정폼 오류:" . $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public function modify($uid): string|RedirectResponse
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$action = __FUNCTION__;
|
||||||
|
$this->action_init_process($action);
|
||||||
|
$entity = $this->modify_process($uid);
|
||||||
|
if (!$entity instanceof CouponEntity) {
|
||||||
|
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 CouponEntity만 가능");
|
||||||
|
}
|
||||||
|
$this->addViewDatas('entity', $entity);
|
||||||
|
return $this->modify_result_process($entity);
|
||||||
|
} catch (ValidationException $e) {
|
||||||
|
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 검증오류:" . $e->getMessage());
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public function delete($uid): RedirectResponse
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$entity = $this->delete_process($uid);
|
||||||
|
if (!$entity instanceof CouponEntity) {
|
||||||
|
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 CouponEntity만 가능");
|
||||||
|
}
|
||||||
|
return $this->delete_result_process($entity);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 삭제 오류:" . $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public function view($uid): string|RedirectResponse
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$action = __FUNCTION__;
|
||||||
|
$this->action_init_process($action);
|
||||||
|
$entity = $this->view_process($uid);
|
||||||
|
if (!$entity instanceof CouponEntity) {
|
||||||
|
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 CouponEntity만 가능");
|
||||||
|
}
|
||||||
|
$this->addViewDatas('entity', $entity);
|
||||||
|
return $this->view_result_process($action);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 상세보기 오류:" . $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public function batchjob(): string|RedirectResponse
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
// 사전작업 및 데이터 추출 초기화
|
||||||
|
list($uids, $selectedFields, $formDatas) = $this->batchjob_pre_process();
|
||||||
|
$this->service->getFormService()->setFormFields($selectedFields);
|
||||||
|
$this->service->getFormService()->setFormRules(__FUNCTION__, $selectedFields);
|
||||||
|
$this->service->getFormService()->setFormFilters($selectedFields);
|
||||||
|
$this->service->getFormService()->setFormOptions($selectedFields);
|
||||||
|
$entities = [];
|
||||||
|
$errors = [];
|
||||||
|
foreach ($uids as $uid) {
|
||||||
|
try {
|
||||||
|
$entities[] = $this->batchjob_process($uid, $formDatas);
|
||||||
|
} catch (ValidationException $e) {
|
||||||
|
log_message('error', "{$this->getTitle()}에서 {$uid} 수정 검증오류:" . $e->getMessage());
|
||||||
|
$errors[] = $e->getMessage();
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
log_message('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
|
||||||
|
$errors[] = $e->getMessage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $this->batchjob_result_process($uids, $entities, $errors);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄작업처리 오류:" . $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function batchjob_delete(): string|RedirectResponse
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$uids = $this->batchjob_delete_pre_process();
|
||||||
|
$entities = [];
|
||||||
|
$errors = [];
|
||||||
|
foreach ($uids as $uid) {
|
||||||
|
try {
|
||||||
|
$entities[] = $this->batchjob_delete_process($uid);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
log_message('error', "{$this->getTitle()}에서 {$uid} 삭제 오류:" . $e->getMessage());
|
||||||
|
$errors[] = $e->getMessage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $this->batchjob_delete_result_process($uids, $entities, $errors);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄삭제 오류:" . $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index(): string|ResponseInterface
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$action = __FUNCTION__;
|
||||||
|
$this->action_init_process($action);
|
||||||
|
$this->index_process($action);
|
||||||
|
$this->index_result_process($action);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
session()->setFlashdata('message', $e->getMessage());
|
||||||
|
}
|
||||||
|
return $this->index_result_process($action);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function download(string $output_type, mixed $uid = false): DownloadResponse|RedirectResponse|string
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$action = __FUNCTION__;
|
||||||
|
$this->action_init_process($action);
|
||||||
|
return $this->download_process($action, $output_type, $uid);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return $this->action_redirect_process('error', "{$this->getTitle()}에서 오류:" . $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//기본 함수 작업
|
||||||
|
//Custom 추가 함수
|
||||||
|
}
|
||||||
228
app/Controllers/Admin/Customer/PointController.php
Normal file
228
app/Controllers/Admin/Customer/PointController.php
Normal file
@ -0,0 +1,228 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controllers\Admin\Customer;
|
||||||
|
|
||||||
|
use App\Entities\Customer\PointEntity;
|
||||||
|
use CodeIgniter\HTTP\DownloadResponse;
|
||||||
|
use CodeIgniter\HTTP\RedirectResponse;
|
||||||
|
use CodeIgniter\HTTP\RequestInterface;
|
||||||
|
use CodeIgniter\HTTP\ResponseInterface;
|
||||||
|
use CodeIgniter\Validation\Exceptions\ValidationException;
|
||||||
|
use Psr\Log\LoggerInterface;
|
||||||
|
|
||||||
|
class PointController extends CustomerController
|
||||||
|
{
|
||||||
|
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||||
|
{
|
||||||
|
parent::initController($request, $response, $logger);
|
||||||
|
if ($this->service === null) {
|
||||||
|
$this->service = service('customer_pointservice');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
protected function action_init_process(string $action): void
|
||||||
|
{
|
||||||
|
$fields = [
|
||||||
|
"uid",
|
||||||
|
"user_uid",
|
||||||
|
"clientinfo_uid",
|
||||||
|
"title",
|
||||||
|
"content",
|
||||||
|
"amount",
|
||||||
|
"status",
|
||||||
|
"updated_at"
|
||||||
|
];
|
||||||
|
$filters = [
|
||||||
|
"clientinfo_uid",
|
||||||
|
"status",
|
||||||
|
];
|
||||||
|
$batchjobFilters = ['status'];
|
||||||
|
// $actionButtons = ['view' => ICONS['SEARCH']];
|
||||||
|
// $batchjobButtons = [];
|
||||||
|
parent::action_init_process($action);
|
||||||
|
switch ($action) {
|
||||||
|
case 'create':
|
||||||
|
case 'create_form':
|
||||||
|
case 'modify':
|
||||||
|
case 'modify_form':
|
||||||
|
break;
|
||||||
|
case 'view':
|
||||||
|
$fields = [...$fields, 'created_at'];
|
||||||
|
break;
|
||||||
|
case 'index':
|
||||||
|
case 'download':
|
||||||
|
$fields = [...$fields, 'created_at'];
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new \Exception("[{$action}] 지원하지 않는 action입니다.");
|
||||||
|
// break;
|
||||||
|
}
|
||||||
|
$this->service->getFormService()->setFormFields($fields);
|
||||||
|
$this->service->getFormService()->setFormRules($action, $fields);
|
||||||
|
$this->service->getFormService()->setFormFilters($filters);
|
||||||
|
$this->service->getFormService()->setFormOptions($filters);
|
||||||
|
$this->service->getFormService()->setBatchjobFilters($batchjobFilters);
|
||||||
|
// $this->service->getFormService()->setActionButtons($actionButtons);
|
||||||
|
// $this->service->getFormService()->setBatchjobButtons($batchjobButtons);
|
||||||
|
parent::action_init_process($action);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create_form(): string|RedirectResponse
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$action = __FUNCTION__;
|
||||||
|
$this->action_init_process($action);
|
||||||
|
$this->addViewDatas('formDatas', $this->create_form_process());
|
||||||
|
return $this->create_form_result_process($action);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성폼 오류:" . $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public function create(): string|RedirectResponse
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$action = __FUNCTION__;
|
||||||
|
$this->action_init_process($action);
|
||||||
|
$entity = $this->create_process();
|
||||||
|
if (!$entity instanceof PointEntity) {
|
||||||
|
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 PointEntity만 가능");
|
||||||
|
}
|
||||||
|
return $this->create_result_process($entity);
|
||||||
|
} catch (ValidationException $e) {
|
||||||
|
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성 검증오류:" . $e->getMessage());
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성 오류:" . $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public function modify_form($uid): string|RedirectResponse
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$action = __FUNCTION__;
|
||||||
|
$this->action_init_process($action);
|
||||||
|
$entity = $this->modify_form_process($uid);
|
||||||
|
if (!$entity instanceof PointEntity) {
|
||||||
|
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 PointEntity만 가능");
|
||||||
|
}
|
||||||
|
$this->addViewDatas('entity', $entity);
|
||||||
|
return $this->modify_form_result_process($action);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정폼 오류:" . $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public function modify($uid): string|RedirectResponse
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$action = __FUNCTION__;
|
||||||
|
$this->action_init_process($action);
|
||||||
|
$entity = $this->modify_process($uid);
|
||||||
|
if (!$entity instanceof PointEntity) {
|
||||||
|
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 PointEntity만 가능");
|
||||||
|
}
|
||||||
|
$this->addViewDatas('entity', $entity);
|
||||||
|
return $this->modify_result_process($entity);
|
||||||
|
} catch (ValidationException $e) {
|
||||||
|
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 검증오류:" . $e->getMessage());
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public function delete($uid): RedirectResponse
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$entity = $this->delete_process($uid);
|
||||||
|
if (!$entity instanceof PointEntity) {
|
||||||
|
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 PointEntity만 가능");
|
||||||
|
}
|
||||||
|
return $this->delete_result_process($entity);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 삭제 오류:" . $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public function view($uid): string|RedirectResponse
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$action = __FUNCTION__;
|
||||||
|
$this->action_init_process($action);
|
||||||
|
$entity = $this->view_process($uid);
|
||||||
|
if (!$entity instanceof PointEntity) {
|
||||||
|
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 PointEntity만 가능");
|
||||||
|
}
|
||||||
|
$this->addViewDatas('entity', $entity);
|
||||||
|
return $this->view_result_process($action);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 상세보기 오류:" . $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public function batchjob(): string|RedirectResponse
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
// 사전작업 및 데이터 추출 초기화
|
||||||
|
list($uids, $selectedFields, $formDatas) = $this->batchjob_pre_process();
|
||||||
|
$this->service->getFormService()->setFormFields($selectedFields);
|
||||||
|
$this->service->getFormService()->setFormRules(__FUNCTION__, $selectedFields);
|
||||||
|
$this->service->getFormService()->setFormFilters($selectedFields);
|
||||||
|
$this->service->getFormService()->setFormOptions($selectedFields);
|
||||||
|
$entities = [];
|
||||||
|
$errors = [];
|
||||||
|
foreach ($uids as $uid) {
|
||||||
|
try {
|
||||||
|
$entities[] = $this->batchjob_process($uid, $formDatas);
|
||||||
|
} catch (ValidationException $e) {
|
||||||
|
log_message('error', "{$this->getTitle()}에서 {$uid} 수정 검증오류:" . $e->getMessage());
|
||||||
|
$errors[] = $e->getMessage();
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
log_message('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
|
||||||
|
$errors[] = $e->getMessage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $this->batchjob_result_process($uids, $entities, $errors);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄작업처리 오류:" . $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function batchjob_delete(): string|RedirectResponse
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$uids = $this->batchjob_delete_pre_process();
|
||||||
|
$entities = [];
|
||||||
|
$errors = [];
|
||||||
|
foreach ($uids as $uid) {
|
||||||
|
try {
|
||||||
|
$entities[] = $this->batchjob_delete_process($uid);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
log_message('error', "{$this->getTitle()}에서 {$uid} 삭제 오류:" . $e->getMessage());
|
||||||
|
$errors[] = $e->getMessage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $this->batchjob_delete_result_process($uids, $entities, $errors);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄삭제 오류:" . $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index(): string|ResponseInterface
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$action = __FUNCTION__;
|
||||||
|
$this->action_init_process($action);
|
||||||
|
$this->index_process($action);
|
||||||
|
$this->index_result_process($action);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
session()->setFlashdata('message', $e->getMessage());
|
||||||
|
}
|
||||||
|
return $this->index_result_process($action);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function download(string $output_type, mixed $uid = false): DownloadResponse|RedirectResponse|string
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$action = __FUNCTION__;
|
||||||
|
$this->action_init_process($action);
|
||||||
|
return $this->download_process($action, $output_type, $uid);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return $this->action_redirect_process('error', "{$this->getTitle()}에서 오류:" . $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//기본 함수 작업
|
||||||
|
//Custom 추가 함수
|
||||||
|
}
|
||||||
20
app/Controllers/Admin/Equipment/EquipmentController.php
Normal file
20
app/Controllers/Admin/Equipment/EquipmentController.php
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controllers\Admin\Equipment;
|
||||||
|
|
||||||
|
use App\Controllers\Admin\AdminController;
|
||||||
|
use CodeIgniter\HTTP\RequestInterface;
|
||||||
|
|
||||||
|
use CodeIgniter\HTTP\ResponseInterface;
|
||||||
|
use Psr\Log\LoggerInterface;
|
||||||
|
|
||||||
|
abstract class EquipmentController extends AdminController
|
||||||
|
{
|
||||||
|
public const PATH = 'equipment';
|
||||||
|
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||||
|
{
|
||||||
|
parent::initController($request, $response, $logger);
|
||||||
|
$this->addActionPaths(self::PATH);
|
||||||
|
}
|
||||||
|
//Index,FieldForm관련
|
||||||
|
}
|
||||||
228
app/Controllers/Admin/Equipment/LineController.php
Normal file
228
app/Controllers/Admin/Equipment/LineController.php
Normal file
@ -0,0 +1,228 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controllers\Admin\Equipment;
|
||||||
|
|
||||||
|
use App\Entities\Equipment\LineEntity;
|
||||||
|
use CodeIgniter\HTTP\DownloadResponse;
|
||||||
|
use CodeIgniter\HTTP\RedirectResponse;
|
||||||
|
use CodeIgniter\HTTP\RequestInterface;
|
||||||
|
use CodeIgniter\HTTP\ResponseInterface;
|
||||||
|
use CodeIgniter\Validation\Exceptions\ValidationException;
|
||||||
|
use Psr\Log\LoggerInterface;
|
||||||
|
|
||||||
|
class LineController extends EquipmentController
|
||||||
|
{
|
||||||
|
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||||
|
{
|
||||||
|
parent::initController($request, $response, $logger);
|
||||||
|
if ($this->service === null) {
|
||||||
|
$this->service = service('equipment_lineservice');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
protected function action_init_process(string $action): void
|
||||||
|
{
|
||||||
|
$fields = [
|
||||||
|
"uid",
|
||||||
|
"type",
|
||||||
|
"title",
|
||||||
|
"bandwith",
|
||||||
|
"start_at",
|
||||||
|
"end_at",
|
||||||
|
"status",
|
||||||
|
"updated_at"
|
||||||
|
];
|
||||||
|
$filters = [
|
||||||
|
"clientinfo_uid",
|
||||||
|
"status",
|
||||||
|
];
|
||||||
|
$batchjobFilters = ['status'];
|
||||||
|
// $actionButtons = ['view' => ICONS['SEARCH']];
|
||||||
|
// $batchjobButtons = [];
|
||||||
|
parent::action_init_process($action);
|
||||||
|
switch ($action) {
|
||||||
|
case 'create':
|
||||||
|
case 'create_form':
|
||||||
|
case 'modify':
|
||||||
|
case 'modify_form':
|
||||||
|
break;
|
||||||
|
case 'view':
|
||||||
|
$fields = [...$fields, 'created_at'];
|
||||||
|
break;
|
||||||
|
case 'index':
|
||||||
|
case 'download':
|
||||||
|
$fields = [...$fields, 'created_at'];
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new \Exception("[{$action}] 지원하지 않는 action입니다.");
|
||||||
|
// break;
|
||||||
|
}
|
||||||
|
$this->service->getFormService()->setFormFields($fields);
|
||||||
|
$this->service->getFormService()->setFormRules($action, $fields);
|
||||||
|
$this->service->getFormService()->setFormFilters($filters);
|
||||||
|
$this->service->getFormService()->setFormOptions($filters);
|
||||||
|
$this->service->getFormService()->setBatchjobFilters($batchjobFilters);
|
||||||
|
// $this->service->getFormService()->setActionButtons($actionButtons);
|
||||||
|
// $this->service->getFormService()->setBatchjobButtons($batchjobButtons);
|
||||||
|
parent::action_init_process($action);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create_form(): string|RedirectResponse
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$action = __FUNCTION__;
|
||||||
|
$this->action_init_process($action);
|
||||||
|
$this->addViewDatas('formDatas', $this->create_form_process());
|
||||||
|
return $this->create_form_result_process($action);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성폼 오류:" . $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public function create(): string|RedirectResponse
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$action = __FUNCTION__;
|
||||||
|
$this->action_init_process($action);
|
||||||
|
$entity = $this->create_process();
|
||||||
|
if (!$entity instanceof LineEntity) {
|
||||||
|
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 LineEntity만 가능");
|
||||||
|
}
|
||||||
|
return $this->create_result_process($entity);
|
||||||
|
} catch (ValidationException $e) {
|
||||||
|
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성 검증오류:" . $e->getMessage());
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성 오류:" . $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public function modify_form($uid): string|RedirectResponse
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$action = __FUNCTION__;
|
||||||
|
$this->action_init_process($action);
|
||||||
|
$entity = $this->modify_form_process($uid);
|
||||||
|
if (!$entity instanceof LineEntity) {
|
||||||
|
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 LineEntity만 가능");
|
||||||
|
}
|
||||||
|
$this->addViewDatas('entity', $entity);
|
||||||
|
return $this->modify_form_result_process($action);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정폼 오류:" . $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public function modify($uid): string|RedirectResponse
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$action = __FUNCTION__;
|
||||||
|
$this->action_init_process($action);
|
||||||
|
$entity = $this->modify_process($uid);
|
||||||
|
if (!$entity instanceof LineEntity) {
|
||||||
|
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 LineEntity만 가능");
|
||||||
|
}
|
||||||
|
$this->addViewDatas('entity', $entity);
|
||||||
|
return $this->modify_result_process($entity);
|
||||||
|
} catch (ValidationException $e) {
|
||||||
|
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 검증오류:" . $e->getMessage());
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public function delete($uid): RedirectResponse
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$entity = $this->delete_process($uid);
|
||||||
|
if (!$entity instanceof LineEntity) {
|
||||||
|
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 LineEntity만 가능");
|
||||||
|
}
|
||||||
|
return $this->delete_result_process($entity);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 삭제 오류:" . $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public function view($uid): string|RedirectResponse
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$action = __FUNCTION__;
|
||||||
|
$this->action_init_process($action);
|
||||||
|
$entity = $this->view_process($uid);
|
||||||
|
if (!$entity instanceof LineEntity) {
|
||||||
|
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 LineEntity만 가능");
|
||||||
|
}
|
||||||
|
$this->addViewDatas('entity', $entity);
|
||||||
|
return $this->view_result_process($action);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 상세보기 오류:" . $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public function batchjob(): string|RedirectResponse
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
// 사전작업 및 데이터 추출 초기화
|
||||||
|
list($uids, $selectedFields, $formDatas) = $this->batchjob_pre_process();
|
||||||
|
$this->service->getFormService()->setFormFields($selectedFields);
|
||||||
|
$this->service->getFormService()->setFormRules(__FUNCTION__, $selectedFields);
|
||||||
|
$this->service->getFormService()->setFormFilters($selectedFields);
|
||||||
|
$this->service->getFormService()->setFormOptions($selectedFields);
|
||||||
|
$entities = [];
|
||||||
|
$errors = [];
|
||||||
|
foreach ($uids as $uid) {
|
||||||
|
try {
|
||||||
|
$entities[] = $this->batchjob_process($uid, $formDatas);
|
||||||
|
} catch (ValidationException $e) {
|
||||||
|
log_message('error', "{$this->getTitle()}에서 {$uid} 수정 검증오류:" . $e->getMessage());
|
||||||
|
$errors[] = $e->getMessage();
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
log_message('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
|
||||||
|
$errors[] = $e->getMessage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $this->batchjob_result_process($uids, $entities, $errors);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄작업처리 오류:" . $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function batchjob_delete(): string|RedirectResponse
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$uids = $this->batchjob_delete_pre_process();
|
||||||
|
$entities = [];
|
||||||
|
$errors = [];
|
||||||
|
foreach ($uids as $uid) {
|
||||||
|
try {
|
||||||
|
$entities[] = $this->batchjob_delete_process($uid);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
log_message('error', "{$this->getTitle()}에서 {$uid} 삭제 오류:" . $e->getMessage());
|
||||||
|
$errors[] = $e->getMessage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $this->batchjob_delete_result_process($uids, $entities, $errors);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄삭제 오류:" . $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index(): string|ResponseInterface
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$action = __FUNCTION__;
|
||||||
|
$this->action_init_process($action);
|
||||||
|
$this->index_process($action);
|
||||||
|
$this->index_result_process($action);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
session()->setFlashdata('message', $e->getMessage());
|
||||||
|
}
|
||||||
|
return $this->index_result_process($action);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function download(string $output_type, mixed $uid = false): DownloadResponse|RedirectResponse|string
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$action = __FUNCTION__;
|
||||||
|
$this->action_init_process($action);
|
||||||
|
return $this->download_process($action, $output_type, $uid);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return $this->action_redirect_process('error', "{$this->getTitle()}에서 오류:" . $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//기본 함수 작업
|
||||||
|
//Custom 추가 함수
|
||||||
|
}
|
||||||
231
app/Controllers/Admin/PaymentController.php
Normal file
231
app/Controllers/Admin/PaymentController.php
Normal file
@ -0,0 +1,231 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controllers\Admin;
|
||||||
|
|
||||||
|
use App\Entities\PaymentEntity;
|
||||||
|
use CodeIgniter\HTTP\DownloadResponse;
|
||||||
|
use CodeIgniter\HTTP\RedirectResponse;
|
||||||
|
use CodeIgniter\HTTP\RequestInterface;
|
||||||
|
use CodeIgniter\HTTP\ResponseInterface;
|
||||||
|
use CodeIgniter\Validation\Exceptions\ValidationException;
|
||||||
|
use Psr\Log\LoggerInterface;
|
||||||
|
|
||||||
|
class PaymentController extends AdminController
|
||||||
|
{
|
||||||
|
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||||
|
{
|
||||||
|
parent::initController($request, $response, $logger);
|
||||||
|
if ($this->service === null) {
|
||||||
|
$this->service = service('paymentservice');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//Action작업관련
|
||||||
|
protected function action_init_process(string $action): void
|
||||||
|
{
|
||||||
|
$fields = [
|
||||||
|
"uid",
|
||||||
|
"user_uid",
|
||||||
|
"clientinfo_uid",
|
||||||
|
"serviceinfo_uid",
|
||||||
|
"serverpartinfo_uid",
|
||||||
|
"title",
|
||||||
|
"content",
|
||||||
|
"amount",
|
||||||
|
"billing",
|
||||||
|
"billing_at",
|
||||||
|
"pay",
|
||||||
|
"status",
|
||||||
|
"updated_at"
|
||||||
|
];
|
||||||
|
$filters = ['role', 'status'];
|
||||||
|
$batchjobFilters = ['status'];
|
||||||
|
// $actionButtons = ['view' => ICONS['SEARCH']];
|
||||||
|
// $batchjobButtons = [];
|
||||||
|
switch ($action) {
|
||||||
|
case 'create':
|
||||||
|
case 'create_form':
|
||||||
|
break;
|
||||||
|
case 'modify':
|
||||||
|
case 'modify_form':
|
||||||
|
$fields = ['title', 'amount', 'pay', 'status'];
|
||||||
|
break;
|
||||||
|
case 'view':
|
||||||
|
$fields = [...$fields, 'created_at'];
|
||||||
|
break;
|
||||||
|
case 'index':
|
||||||
|
case 'download':
|
||||||
|
$fields = [...$fields, 'created_at'];
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new \Exception("[{$action}] 지원하지 않는 action입니다.");
|
||||||
|
// break;
|
||||||
|
}
|
||||||
|
$this->service->getFormService()->setFormFields($fields);
|
||||||
|
$this->service->getFormService()->setFormRules($action, $fields);
|
||||||
|
$this->service->getFormService()->setFormFilters($filters);
|
||||||
|
$this->service->getFormService()->setFormOptions($filters);
|
||||||
|
$this->service->getFormService()->setBatchjobFilters($batchjobFilters);
|
||||||
|
// $this->service->getFormService()->setActionButtons($actionButtons);
|
||||||
|
// $this->service->getFormService()->setBatchjobButtons($batchjobButtons);
|
||||||
|
parent::action_init_process($action);
|
||||||
|
}
|
||||||
|
public function create_form(): string|RedirectResponse
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$action = __FUNCTION__;
|
||||||
|
$this->action_init_process($action);
|
||||||
|
$this->addViewDatas('formDatas', $this->create_form_process());
|
||||||
|
return $this->create_form_result_process($action);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성폼 오류:" . $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public function create(): string|RedirectResponse
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$action = __FUNCTION__;
|
||||||
|
$this->action_init_process($action);
|
||||||
|
$entity = $this->create_process();
|
||||||
|
if (!$entity instanceof PaymentEntity) {
|
||||||
|
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 PaymentEntity만 가능");
|
||||||
|
}
|
||||||
|
return $this->create_result_process($entity);
|
||||||
|
} catch (ValidationException $e) {
|
||||||
|
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성 검증오류:" . $e->getMessage());
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성 오류:" . $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public function modify_form($uid): string|RedirectResponse
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$action = __FUNCTION__;
|
||||||
|
$this->action_init_process($action);
|
||||||
|
$entity = $this->modify_form_process($uid);
|
||||||
|
if (!$entity instanceof PaymentEntity) {
|
||||||
|
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 PaymentEntity만 가능");
|
||||||
|
}
|
||||||
|
$this->addViewDatas('entity', $entity);
|
||||||
|
return $this->modify_form_result_process($action);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정폼 오류:" . $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public function modify($uid): string|RedirectResponse
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$action = __FUNCTION__;
|
||||||
|
$this->action_init_process($action);
|
||||||
|
$entity = $this->modify_process($uid);
|
||||||
|
if (!$entity instanceof PaymentEntity) {
|
||||||
|
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 PaymentEntity만 가능");
|
||||||
|
}
|
||||||
|
$this->addViewDatas('entity', $entity);
|
||||||
|
return $this->modify_result_process($entity);
|
||||||
|
} catch (ValidationException $e) {
|
||||||
|
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 검증오류:" . $e->getMessage());
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public function delete($uid): RedirectResponse
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$entity = $this->delete_process($uid);
|
||||||
|
if (!$entity instanceof PaymentEntity) {
|
||||||
|
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 PaymentEntity만 가능");
|
||||||
|
}
|
||||||
|
return $this->delete_result_process($entity);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 삭제 오류:" . $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public function view($uid): string|RedirectResponse
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$action = __FUNCTION__;
|
||||||
|
$this->action_init_process($action);
|
||||||
|
$entity = $this->view_process($uid);
|
||||||
|
if (!$entity instanceof PaymentEntity) {
|
||||||
|
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 PaymentEntity만 가능");
|
||||||
|
}
|
||||||
|
$this->addViewDatas('entity', $entity);
|
||||||
|
return $this->view_result_process($action);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 상세보기 오류:" . $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public function batchjob(): string|RedirectResponse
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
// 사전작업 및 데이터 추출 초기화
|
||||||
|
list($uids, $selectedFields, $formDatas) = $this->batchjob_pre_process();
|
||||||
|
$this->service->getFormService()->setFormFields($selectedFields);
|
||||||
|
$this->service->getFormService()->setFormRules(__FUNCTION__, $selectedFields);
|
||||||
|
$this->service->getFormService()->setFormFilters($selectedFields);
|
||||||
|
$this->service->getFormService()->setFormOptions($selectedFields);
|
||||||
|
$entities = [];
|
||||||
|
$errors = [];
|
||||||
|
foreach ($uids as $uid) {
|
||||||
|
try {
|
||||||
|
$entities[] = $this->batchjob_process($uid, $formDatas);
|
||||||
|
} catch (ValidationException $e) {
|
||||||
|
log_message('error', "{$this->getTitle()}에서 {$uid} 수정 검증오류:" . $e->getMessage());
|
||||||
|
$errors[] = $e->getMessage();
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
log_message('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
|
||||||
|
$errors[] = $e->getMessage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $this->batchjob_result_process($uids, $entities, $errors);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄작업처리 오류:" . $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function batchjob_delete(): string|RedirectResponse
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$uids = $this->batchjob_delete_pre_process();
|
||||||
|
$entities = [];
|
||||||
|
$errors = [];
|
||||||
|
foreach ($uids as $uid) {
|
||||||
|
try {
|
||||||
|
$entities[] = $this->batchjob_delete_process($uid);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
log_message('error', "{$this->getTitle()}에서 {$uid} 삭제 오류:" . $e->getMessage());
|
||||||
|
$errors[] = $e->getMessage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $this->batchjob_delete_result_process($uids, $entities, $errors);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄삭제 오류:" . $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index(): string|ResponseInterface
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$action = __FUNCTION__;
|
||||||
|
$this->action_init_process($action);
|
||||||
|
$this->index_process($action);
|
||||||
|
$this->index_result_process($action);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
session()->setFlashdata('message', $e->getMessage());
|
||||||
|
}
|
||||||
|
return $this->index_result_process($action);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function download(string $output_type, mixed $uid = false): DownloadResponse|RedirectResponse|string
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$action = __FUNCTION__;
|
||||||
|
$this->action_init_process($action);
|
||||||
|
return $this->download_process($action, $output_type, $uid);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return $this->action_redirect_process('error', "{$this->getTitle()}에서 오류:" . $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//기본 함수 작업
|
||||||
|
//Custom 추가 함수
|
||||||
|
}
|
||||||
@ -22,9 +22,19 @@ class UserController extends AdminController
|
|||||||
//Action작업관련
|
//Action작업관련
|
||||||
protected function action_init_process(string $action): void
|
protected function action_init_process(string $action): void
|
||||||
{
|
{
|
||||||
$fields = ['id', 'passwd', 'confirmpassword', 'name', 'email', 'mobile', 'role'];
|
$fields = [
|
||||||
|
'id',
|
||||||
|
'passwd',
|
||||||
|
'confirmpassword',
|
||||||
|
'name',
|
||||||
|
'email',
|
||||||
|
'mobile',
|
||||||
|
'role'
|
||||||
|
];
|
||||||
$filters = ['role', 'status'];
|
$filters = ['role', 'status'];
|
||||||
$batchjobFilters = ['status'];
|
$batchjobFilters = ['status'];
|
||||||
|
// $actionButtons = ['view' => ICONS['SEARCH']];
|
||||||
|
// $batchjobButtons = [];
|
||||||
switch ($action) {
|
switch ($action) {
|
||||||
case 'create':
|
case 'create':
|
||||||
case 'create_form':
|
case 'create_form':
|
||||||
@ -49,6 +59,8 @@ class UserController extends AdminController
|
|||||||
$this->service->getFormService()->setFormFilters($filters);
|
$this->service->getFormService()->setFormFilters($filters);
|
||||||
$this->service->getFormService()->setFormOptions($filters);
|
$this->service->getFormService()->setFormOptions($filters);
|
||||||
$this->service->getFormService()->setBatchjobFilters($batchjobFilters);
|
$this->service->getFormService()->setBatchjobFilters($batchjobFilters);
|
||||||
|
// $this->service->getFormService()->setActionButtons($actionButtons);
|
||||||
|
// $this->service->getFormService()->setBatchjobButtons($batchjobButtons);
|
||||||
parent::action_init_process($action);
|
parent::action_init_process($action);
|
||||||
}
|
}
|
||||||
public function create_form(): string|RedirectResponse
|
public function create_form(): string|RedirectResponse
|
||||||
|
|||||||
@ -7,6 +7,7 @@ use App\DTOs\CommonDTO;
|
|||||||
class AccountDTO extends CommonDTO
|
class AccountDTO extends CommonDTO
|
||||||
{
|
{
|
||||||
public ?int $uid = null;
|
public ?int $uid = null;
|
||||||
|
public ?int $user_uid = null;
|
||||||
public ?int $clientinfo_uid = null;
|
public ?int $clientinfo_uid = null;
|
||||||
public ?string $bank = null;
|
public ?string $bank = null;
|
||||||
public ?string $title = null;
|
public ?string $title = null;
|
||||||
|
|||||||
31
app/DTOs/Customer/ClientDTO.php
Normal file
31
app/DTOs/Customer/ClientDTO.php
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\DTOs\Customer;
|
||||||
|
|
||||||
|
use App\DTOs\CommonDTO;
|
||||||
|
|
||||||
|
class ClientDTO extends CommonDTO
|
||||||
|
{
|
||||||
|
public ?int $uid = null;
|
||||||
|
public ?int $user_uid = null;
|
||||||
|
public ?string $site = null;
|
||||||
|
public ?string $role = null;
|
||||||
|
public ?string $name = null;
|
||||||
|
public ?string $phone = null;
|
||||||
|
public ?string $email = null;
|
||||||
|
public ?string $history = null;
|
||||||
|
public ?int $account_balance = null;
|
||||||
|
public ?int $coupon_balance = null;
|
||||||
|
public ?int $point_balance = null;
|
||||||
|
public ?string $status = null;
|
||||||
|
|
||||||
|
public function __construct(array $datas = [])
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
foreach ($datas as $key => $value) {
|
||||||
|
if (property_exists($this, $key)) {
|
||||||
|
$this->{$key} = $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
26
app/DTOs/Customer/CouponDTO.php
Normal file
26
app/DTOs/Customer/CouponDTO.php
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\DTOs\Customer;
|
||||||
|
|
||||||
|
use App\DTOs\CommonDTO;
|
||||||
|
|
||||||
|
class CouponDTO extends CommonDTO
|
||||||
|
{
|
||||||
|
public ?int $uid = null;
|
||||||
|
public ?int $user_uid = null;
|
||||||
|
public ?int $clientinfo_uid = null;
|
||||||
|
public ?string $title = null;
|
||||||
|
public ?int $cnt = null;
|
||||||
|
public ?string $status = null;
|
||||||
|
public ?string $content = null;
|
||||||
|
|
||||||
|
public function __construct(array $datas = [])
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
foreach ($datas as $key => $value) {
|
||||||
|
if (property_exists($this, $key)) {
|
||||||
|
$this->{$key} = $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
26
app/DTOs/Customer/PointDTO.php
Normal file
26
app/DTOs/Customer/PointDTO.php
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\DTOs\Customer;
|
||||||
|
|
||||||
|
use App\DTOs\CommonDTO;
|
||||||
|
|
||||||
|
class PointDTO extends CommonDTO
|
||||||
|
{
|
||||||
|
public ?int $uid = null;
|
||||||
|
public ?int $user_uid = null;
|
||||||
|
public ?int $clientinfo_uid = null;
|
||||||
|
public ?string $title = null;
|
||||||
|
public ?int $amount = null;
|
||||||
|
public ?string $status = null;
|
||||||
|
public ?string $content = null;
|
||||||
|
|
||||||
|
public function __construct(array $datas = [])
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
foreach ($datas as $key => $value) {
|
||||||
|
if (property_exists($this, $key)) {
|
||||||
|
$this->{$key} = $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
29
app/DTOs/PaymentDTO.php
Normal file
29
app/DTOs/PaymentDTO.php
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\DTOs;
|
||||||
|
|
||||||
|
class PaymentDTO extends CommonDTO
|
||||||
|
{
|
||||||
|
public ?int $uid = null;
|
||||||
|
public ?int $user_uid = null;
|
||||||
|
public ?int $clientinfo_uid = null;
|
||||||
|
public ?int $serviceinfo_uid = null;
|
||||||
|
public ?int $serverpartinfo_uid = null;
|
||||||
|
public ?string $title = null;
|
||||||
|
public ?string $content = null;
|
||||||
|
public ?int $amount = null;
|
||||||
|
public ?string $billing = null;
|
||||||
|
public ?string $billing_at = null;
|
||||||
|
public ?string $pay = null;
|
||||||
|
public ?string $status = null;
|
||||||
|
|
||||||
|
public function __construct(array $datas = [])
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
foreach ($datas as $key => $value) {
|
||||||
|
if (property_exists($this, $key)) {
|
||||||
|
$this->{$key} = $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
45
app/Forms/Customer/ClientForm.php
Normal file
45
app/Forms/Customer/ClientForm.php
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Forms\Customer;
|
||||||
|
|
||||||
|
use App\Forms\CommonForm;
|
||||||
|
|
||||||
|
class ClientForm extends CommonForm
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
public function getFormRule(string $action, string $field): string
|
||||||
|
{
|
||||||
|
switch ($field) {
|
||||||
|
case "user_uid":
|
||||||
|
$rule = "required|numeric";
|
||||||
|
break;
|
||||||
|
case "name":
|
||||||
|
$rule = "required|trim|string";
|
||||||
|
$rule .= in_array($action, ["create", "create_form"]) ? "|is_unique[{$this->getAttribute('table')}.{$field}]" : "";
|
||||||
|
break;
|
||||||
|
case "site":
|
||||||
|
case "role":
|
||||||
|
$rule = "required|trim|string";
|
||||||
|
break;
|
||||||
|
case "email":
|
||||||
|
$rule = "permit_empty|trim|valid_email";
|
||||||
|
break;
|
||||||
|
case "phone":
|
||||||
|
case "history":
|
||||||
|
$rule = "permit_empty|trim|string";
|
||||||
|
break;
|
||||||
|
case "account_balance":
|
||||||
|
case "coupon_balance":
|
||||||
|
case "point_balance":
|
||||||
|
$rule = "permit_empty|numeric";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$rule = parent::getFormRule($action, $field);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return $rule;
|
||||||
|
}
|
||||||
|
}
|
||||||
34
app/Forms/Customer/CouponForm.php
Normal file
34
app/Forms/Customer/CouponForm.php
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Forms\Customer;
|
||||||
|
|
||||||
|
use App\Forms\CommonForm;
|
||||||
|
|
||||||
|
class CouponForm extends CommonForm
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
public function getFormRule(string $action, string $field): string
|
||||||
|
{
|
||||||
|
switch ($field) {
|
||||||
|
case "user_uid":
|
||||||
|
case "clientinfo_uid":
|
||||||
|
case "cnt":
|
||||||
|
$rule = "required|numeric";
|
||||||
|
break;
|
||||||
|
case "title":
|
||||||
|
case "status":
|
||||||
|
$rule = "required|trim|string";
|
||||||
|
break;
|
||||||
|
case "content":
|
||||||
|
$rule = "permit_empty|trim|string";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$rule = parent::getFormRule($action, $field);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return $rule;
|
||||||
|
}
|
||||||
|
}
|
||||||
34
app/Forms/Customer/PointForm.php
Normal file
34
app/Forms/Customer/PointForm.php
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Forms\Customer;
|
||||||
|
|
||||||
|
use App\Forms\CommonForm;
|
||||||
|
|
||||||
|
class PointForm extends CommonForm
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
public function getFormRule(string $action, string $field): string
|
||||||
|
{
|
||||||
|
switch ($field) {
|
||||||
|
case "user_uid":
|
||||||
|
case "clientinfo_uid":
|
||||||
|
case "amount":
|
||||||
|
$rule = "required|numeric";
|
||||||
|
break;
|
||||||
|
case "title":
|
||||||
|
case "status":
|
||||||
|
$rule = "required|trim|string";
|
||||||
|
break;
|
||||||
|
case "content":
|
||||||
|
$rule = "permit_empty|trim|string";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$rule = parent::getFormRule($action, $field);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return $rule;
|
||||||
|
}
|
||||||
|
}
|
||||||
43
app/Forms/PaymentForm.php
Normal file
43
app/Forms/PaymentForm.php
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Forms;
|
||||||
|
|
||||||
|
use App\Forms\CommonForm;
|
||||||
|
|
||||||
|
class PaymentForm extends CommonForm
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
public function getFormRule(string $action, string $field): string
|
||||||
|
{
|
||||||
|
switch ($field) {
|
||||||
|
case "user_uid":
|
||||||
|
case "clientinfo_uid":
|
||||||
|
case "serviceinfo_uid":
|
||||||
|
case "amount":
|
||||||
|
$rule = "required|numeric";
|
||||||
|
break;
|
||||||
|
case "serverpartinfo_uid":
|
||||||
|
$rule = "permit_empty|numeric";
|
||||||
|
break;
|
||||||
|
case "title":
|
||||||
|
case "billing":
|
||||||
|
case "pay":
|
||||||
|
case "status":
|
||||||
|
$rule = "required|trim|string";
|
||||||
|
break;
|
||||||
|
case "billing_at":
|
||||||
|
$rule = "required|valid_date";
|
||||||
|
break;
|
||||||
|
case "content":
|
||||||
|
$rule = "permit_empty|trim|string";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$rule = parent::getFormRule($action, $field);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return $rule;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
namespace App\Helpers;
|
namespace App\Helpers;
|
||||||
|
|
||||||
use App\Entities\CollectorEntity;
|
|
||||||
|
|
||||||
class CollectorHelper extends CommonHelper
|
class CollectorHelper extends CommonHelper
|
||||||
{
|
{
|
||||||
public function __construct()
|
public function __construct()
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
namespace App\Helpers;
|
namespace App\Helpers;
|
||||||
|
|
||||||
use App\Entities\CommonEntity;
|
use App\Entities\CommonEntity;
|
||||||
|
use App\Libraries\AuthContext;
|
||||||
use App\Traits\UtilTrait;
|
use App\Traits\UtilTrait;
|
||||||
use RuntimeException;
|
use RuntimeException;
|
||||||
|
|
||||||
@ -15,6 +16,10 @@ class CommonHelper
|
|||||||
{
|
{
|
||||||
$this->_attributes = $attributes;
|
$this->_attributes = $attributes;
|
||||||
}
|
}
|
||||||
|
final protected function getAuthContext(): AuthContext
|
||||||
|
{
|
||||||
|
return service('myauth')->getAuthContext();
|
||||||
|
}
|
||||||
final public function getAttribute(string $key): string
|
final public function getAttribute(string $key): string
|
||||||
{
|
{
|
||||||
if (!array_key_exists($key, $this->_attributes)) {
|
if (!array_key_exists($key, $this->_attributes)) {
|
||||||
|
|||||||
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace App\Helpers\Customer;
|
namespace App\Helpers\Customer;
|
||||||
|
|
||||||
use App\Entities\AccountEntity;
|
|
||||||
use App\Helpers\CommonHelper;
|
use App\Helpers\CommonHelper;
|
||||||
|
|
||||||
class AccountHelper extends CommonHelper
|
class AccountHelper extends CommonHelper
|
||||||
|
|||||||
117
app/Helpers/Customer/ClientHelper.php
Normal file
117
app/Helpers/Customer/ClientHelper.php
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Helpers\Customer;
|
||||||
|
|
||||||
|
use App\Helpers\CommonHelper;
|
||||||
|
|
||||||
|
class ClientHelper extends CommonHelper
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
public function getFieldView(string $field, mixed $value, array $viewDatas, array $extras = []): string|null
|
||||||
|
{
|
||||||
|
switch ($field) {
|
||||||
|
case 'name':
|
||||||
|
$value = "<a href=\"/admin/customer/client/detail/{$viewDatas['entity']->getPK()}\">" . $value . "</a>";
|
||||||
|
break;
|
||||||
|
case "email":
|
||||||
|
case "phone":
|
||||||
|
$value = $this->getAuthContext()->isAccessRole([ROLE['USER']['SECURITY']]) ? parent::getFieldView($field, $value, $viewDatas, $extras) : "***********";
|
||||||
|
break;
|
||||||
|
case 'account_balance':
|
||||||
|
$value = form_label(
|
||||||
|
number_format(intval($value)) . "원",
|
||||||
|
'index',
|
||||||
|
[
|
||||||
|
"data-src" => "/admin/customer/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",
|
||||||
|
...$extras,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case 'coupon_balance':
|
||||||
|
$value = form_label(
|
||||||
|
number_format(intval($value)) . "개",
|
||||||
|
'index',
|
||||||
|
[
|
||||||
|
"data-src" => "/admin/customer/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",
|
||||||
|
...$extras,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case 'point_balance':
|
||||||
|
$value = form_label(
|
||||||
|
number_format(intval($value)) . "원",
|
||||||
|
'index',
|
||||||
|
[
|
||||||
|
"data-src" => "/admin/customer/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",
|
||||||
|
...$extras,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$value = parent::getFieldView($field, $value, $viewDatas, $extras);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (is_array($value)) {
|
||||||
|
throw new \Exception(__METHOD__ . "에서 오류: {$field}의 값이 Array형태입니다");
|
||||||
|
}
|
||||||
|
return $value;
|
||||||
|
} //
|
||||||
|
public function getListButton(string $action, string $label, array $viewDatas, array $extras = []): string
|
||||||
|
{
|
||||||
|
switch ($action) {
|
||||||
|
case 'modify':
|
||||||
|
$action = $this->getAuthContext()->isAccessRole([ROLE['USER']['SECURITY']]) ? parent::getListButton($action, $label, $viewDatas, $extras) : $label;
|
||||||
|
break;
|
||||||
|
case 'create':
|
||||||
|
case 'delete':
|
||||||
|
case 'batchjob':
|
||||||
|
case 'batchjob_delete':
|
||||||
|
$action = $this->getAuthContext()->isAccessRole([ROLE['USER']['SECURITY']]) ? parent::getListButton($action, $label, $viewDatas, $extras) : "";
|
||||||
|
break;
|
||||||
|
case 'history':
|
||||||
|
$action = form_label(
|
||||||
|
$label ? $label : ICONS['HISTORY'],
|
||||||
|
$action,
|
||||||
|
[
|
||||||
|
"data-src" => "/admin/customer/client/history?clientinfo_uid={$viewDatas['entity']->getPK()}",
|
||||||
|
"data-bs-toggle" => "modal",
|
||||||
|
"data-bs-target" => "#modal_action_form",
|
||||||
|
"class" => "btn btn-sm btn-primary form-label-sm",
|
||||||
|
...$extras
|
||||||
|
]
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case 'coupon':
|
||||||
|
case 'account':
|
||||||
|
case 'point':
|
||||||
|
$action = form_label(
|
||||||
|
$label,
|
||||||
|
$action,
|
||||||
|
[
|
||||||
|
"data-src" => "/admin/customer/{$action}?clientinfo_uid={$viewDatas['entity']->getPK()}&ActionTemplate=popup",
|
||||||
|
"data-bs-toggle" => "modal",
|
||||||
|
"data-bs-target" => "#modal_action_form",
|
||||||
|
"class" => "text-primary",
|
||||||
|
...$extras
|
||||||
|
]
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$action = parent::getListButton($action, $label, $viewDatas, $extras);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return $action;
|
||||||
|
}
|
||||||
|
}
|
||||||
28
app/Helpers/Customer/CouponHelper.php
Normal file
28
app/Helpers/Customer/CouponHelper.php
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Helpers\Customer;
|
||||||
|
|
||||||
|
use App\Helpers\CommonHelper;
|
||||||
|
|
||||||
|
class CouponHelper extends CommonHelper
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
public function getFieldView(string $field, mixed $value, array $viewDatas, array $extras = []): string|null
|
||||||
|
{
|
||||||
|
switch ($field) {
|
||||||
|
case 'cnt':
|
||||||
|
$value = number_format($value) . "개";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$value = parent::getFieldView($field, $value, $viewDatas, $extras);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (is_array($value)) {
|
||||||
|
throw new \Exception(__METHOD__ . "에서 오류: {$field}의 값이 Array형태입니다");
|
||||||
|
}
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
28
app/Helpers/Customer/PointHelper.php
Normal file
28
app/Helpers/Customer/PointHelper.php
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Helpers\Customer;
|
||||||
|
|
||||||
|
use App\Helpers\CommonHelper;
|
||||||
|
|
||||||
|
class PointHelper extends CommonHelper
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
public function getFieldView(string $field, mixed $value, array $viewDatas, array $extras = []): string|null
|
||||||
|
{
|
||||||
|
switch ($field) {
|
||||||
|
case 'cnt':
|
||||||
|
$value = number_format($value) . "점";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$value = parent::getFieldView($field, $value, $viewDatas, $extras);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (is_array($value)) {
|
||||||
|
throw new \Exception(__METHOD__ . "에서 오류: {$field}의 값이 Array형태입니다");
|
||||||
|
}
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
namespace App\Helpers;
|
namespace App\Helpers;
|
||||||
|
|
||||||
use App\Entities\MylogEntity;
|
|
||||||
|
|
||||||
class MylogHelper extends CommonHelper
|
class MylogHelper extends CommonHelper
|
||||||
{
|
{
|
||||||
public function __construct()
|
public function __construct()
|
||||||
|
|||||||
77
app/Helpers/PaymentHelper.php
Normal file
77
app/Helpers/PaymentHelper.php
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Helpers;
|
||||||
|
|
||||||
|
class PaymentHelper extends CommonHelper
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
public function getFieldView(string $field, mixed $value, array $viewDatas, array $extras = []): string|null
|
||||||
|
{
|
||||||
|
switch ($field) {
|
||||||
|
case "countdown": //결제일Countdown
|
||||||
|
$value = $viewDatas['entity']->getCountDueAt();
|
||||||
|
break;
|
||||||
|
case 'amount':
|
||||||
|
$value = number_format($value) . "원";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$value = parent::getFieldView($field, $value, $viewDatas, $extras);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (is_array($value)) {
|
||||||
|
throw new \Exception(__METHOD__ . "에서 오류: {$field}의 값이 Array형태입니다");
|
||||||
|
}
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
public function getListButton(string $action, string $label, array $viewDatas, array $extras = []): string
|
||||||
|
{
|
||||||
|
switch ($action) {
|
||||||
|
case 'create':
|
||||||
|
case 'batchjob':
|
||||||
|
case 'batchjob_delete':
|
||||||
|
$action = "";
|
||||||
|
break;
|
||||||
|
case 'modify':
|
||||||
|
if ($this->getAuthContext()->isAccessRole([ROLE['USER']['SECURITY']])) {
|
||||||
|
$action = parent::getListButton($action, $label, $viewDatas, $extras);
|
||||||
|
} else {
|
||||||
|
$oldBatchJobUids = old("batchjob_uids", null);
|
||||||
|
$oldBatchJobUids = is_array($oldBatchJobUids) ? $oldBatchJobUids : [$oldBatchJobUids];
|
||||||
|
$action = form_checkbox([
|
||||||
|
"id" => "checkbox_uid_{$viewDatas['entity']->getPK()}",
|
||||||
|
"name" => "batchjob_uids[]",
|
||||||
|
"value" => $viewDatas['entity']->getPK(),
|
||||||
|
"class" => "batchjobuids_checkboxs",
|
||||||
|
"checked" => in_array($viewDatas['entity']->getPK(), $oldBatchJobUids)
|
||||||
|
]);
|
||||||
|
$action .= $label;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'delete':
|
||||||
|
$action = "";
|
||||||
|
if ($this->getAuthContext()->isAccessRole([ROLE['USER']['SECURITY']])) {
|
||||||
|
$action = parent::getListButton($action, $label, $viewDatas, $extras);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'paid':
|
||||||
|
$action = form_submit($action . "_submit", $label ? $label : '결제 처리', [
|
||||||
|
"formaction" => current_url() . '/' . $action,
|
||||||
|
"class" => "btn btn-outline btn-warning",
|
||||||
|
]);
|
||||||
|
break;
|
||||||
|
case 'invoice':
|
||||||
|
$action = form_submit($action . "_submit", $label ? $label : '청구서 발행', [
|
||||||
|
"formaction" => current_url() . '/' . $action,
|
||||||
|
"class" => "btn btn-outline btn-primary",
|
||||||
|
]);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$action = parent::getListButton($action, $label, $viewDatas, $extras);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return $action;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
namespace App\Helpers;
|
namespace App\Helpers;
|
||||||
|
|
||||||
use App\Entities\UserEntity;
|
|
||||||
|
|
||||||
class UserHelper extends CommonHelper
|
class UserHelper extends CommonHelper
|
||||||
{
|
{
|
||||||
public function __construct()
|
public function __construct()
|
||||||
|
|||||||
@ -32,40 +32,4 @@ class ClientModel extends CustomerModel
|
|||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
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) {
|
|
||||||
case "user_uid":
|
|
||||||
$rule = "required|numeric";
|
|
||||||
break;
|
|
||||||
case "name":
|
|
||||||
$rule = "required|trim|string";
|
|
||||||
$rule .= in_array($action, ["create", "create_form"]) ? "|is_unique[{$this->table}.{$field}]" : "";
|
|
||||||
break;
|
|
||||||
case "site":
|
|
||||||
case "role":
|
|
||||||
$rule = "required|trim|string";
|
|
||||||
break;
|
|
||||||
case "email":
|
|
||||||
$rule = "permit_empty|trim|valid_email";
|
|
||||||
break;
|
|
||||||
case "phone":
|
|
||||||
case "history":
|
|
||||||
$rule = "permit_empty|trim|string";
|
|
||||||
break;
|
|
||||||
case "account_balance":
|
|
||||||
case "coupon_balance":
|
|
||||||
case "point_balance":
|
|
||||||
$rule = "permit_empty|numeric";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
$rule = parent::getFormRule($action, $field);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return $rule;
|
|
||||||
}
|
|
||||||
//입력전 코드처리
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,11 +7,11 @@ use App\Entities\Customer\CouponEntity;
|
|||||||
class CouponModel extends CustomerModel
|
class CouponModel extends CustomerModel
|
||||||
{
|
{
|
||||||
const TABLE = "couponinfo";
|
const TABLE = "couponinfo";
|
||||||
const PK = "uid";
|
const PK = "uid";
|
||||||
const TITLE = "title";
|
const TITLE = "title";
|
||||||
protected $table = self::TABLE;
|
protected $table = self::TABLE;
|
||||||
protected $primaryKey = self::PK;
|
protected $primaryKey = self::PK;
|
||||||
protected $returnType = CouponEntity::class;
|
protected $returnType = CouponEntity::class;
|
||||||
protected $allowedFields = [
|
protected $allowedFields = [
|
||||||
"uid",
|
"uid",
|
||||||
"user_uid",
|
"user_uid",
|
||||||
@ -26,28 +26,4 @@ class CouponModel extends CustomerModel
|
|||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
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) {
|
|
||||||
case "user_uid":
|
|
||||||
case "clientinfo_uid":
|
|
||||||
case "cnt":
|
|
||||||
$rule = "required|numeric";
|
|
||||||
break;
|
|
||||||
case "title":
|
|
||||||
case "status":
|
|
||||||
$rule = "required|trim|string";
|
|
||||||
break;
|
|
||||||
case "content":
|
|
||||||
$rule = "permit_empty|trim|string";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
$rule = parent::getFormRule($action, $field);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return $rule;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,19 +6,19 @@ use App\Entities\Customer\PointEntity;
|
|||||||
|
|
||||||
class PointModel extends CustomerModel
|
class PointModel extends CustomerModel
|
||||||
{
|
{
|
||||||
const TABLE = "pointinfo";
|
const TABLE = "couponinfo";
|
||||||
const PK = "uid";
|
const PK = "uid";
|
||||||
const TITLE = "title";
|
const TITLE = "title";
|
||||||
protected $table = self::TABLE;
|
protected $table = self::TABLE;
|
||||||
protected $primaryKey = self::PK;
|
protected $primaryKey = self::PK;
|
||||||
protected $returnType = PointEntity::class;
|
protected $returnType = PointEntity::class;
|
||||||
protected $allowedFields = [
|
protected $allowedFields = [
|
||||||
"uid",
|
"uid",
|
||||||
"user_uid",
|
"user_uid",
|
||||||
"clientinfo_uid",
|
"clientinfo_uid",
|
||||||
"title",
|
"title",
|
||||||
"content",
|
"content",
|
||||||
"amount",
|
"cnt",
|
||||||
"status",
|
"status",
|
||||||
"updated_at"
|
"updated_at"
|
||||||
];
|
];
|
||||||
@ -26,28 +26,4 @@ class PointModel extends CustomerModel
|
|||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
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) {
|
|
||||||
case "user_uid":
|
|
||||||
case "clientinfo_uid":
|
|
||||||
case "amount":
|
|
||||||
$rule = "required|numeric";
|
|
||||||
break;
|
|
||||||
case "title":
|
|
||||||
case "status":
|
|
||||||
$rule = "required|trim|string";
|
|
||||||
break;
|
|
||||||
case "content":
|
|
||||||
$rule = "permit_empty|trim|string";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
$rule = parent::getFormRule($action, $field);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return $rule;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,37 +31,4 @@ class PaymentModel extends CommonModel
|
|||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
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) {
|
|
||||||
case "user_uid":
|
|
||||||
case "clientinfo_uid":
|
|
||||||
case "serviceinfo_uid":
|
|
||||||
case "amount":
|
|
||||||
$rule = "required|numeric";
|
|
||||||
break;
|
|
||||||
case "serverpartinfo_uid":
|
|
||||||
$rule = "permit_empty|numeric";
|
|
||||||
break;
|
|
||||||
case "title":
|
|
||||||
case "billing":
|
|
||||||
case "pay":
|
|
||||||
case "status":
|
|
||||||
$rule = "required|trim|string";
|
|
||||||
break;
|
|
||||||
case "billing_at":
|
|
||||||
$rule = "required|valid_date";
|
|
||||||
break;
|
|
||||||
case "content":
|
|
||||||
$rule = "permit_empty|trim|string";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
$rule = parent::getFormRule($action, $field);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return $rule;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,10 +7,9 @@ use App\Entities\Customer\AccountEntity;
|
|||||||
use App\Forms\Customer\AccountForm;
|
use App\Forms\Customer\AccountForm;
|
||||||
use App\Helpers\Customer\AccountHelper;
|
use App\Helpers\Customer\AccountHelper;
|
||||||
use App\Models\Customer\AccountModel;
|
use App\Models\Customer\AccountModel;
|
||||||
use App\Services\CommonService;
|
|
||||||
use RuntimeException;
|
use RuntimeException;
|
||||||
|
|
||||||
class AccountService extends CommonService
|
class AccountService extends CustomerService
|
||||||
{
|
{
|
||||||
private $_form = null;
|
private $_form = null;
|
||||||
private $_helper = null;
|
private $_helper = null;
|
||||||
|
|||||||
106
app/Services/Customer/ClientService.php
Normal file
106
app/Services/Customer/ClientService.php
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Services\Customer;
|
||||||
|
|
||||||
|
use App\DTOs\Customer\ClientDTO;
|
||||||
|
use App\Entities\Customer\ClientEntity;
|
||||||
|
use App\Forms\Customer\ClientForm;
|
||||||
|
use App\Helpers\Customer\ClientHelper;
|
||||||
|
use App\Models\Customer\ClientModel;
|
||||||
|
use RuntimeException;
|
||||||
|
|
||||||
|
class ClientService extends CustomerService
|
||||||
|
{
|
||||||
|
private $_form = null;
|
||||||
|
private $_helper = null;
|
||||||
|
public function __construct(ClientModel $model)
|
||||||
|
{
|
||||||
|
parent::__construct($model);
|
||||||
|
$this->addClassPaths('Client');
|
||||||
|
}
|
||||||
|
public function createDTO(array $formDatas): ClientDTO
|
||||||
|
{
|
||||||
|
return new ClientDTO($formDatas);
|
||||||
|
}
|
||||||
|
public function getFormService(): ClientForm
|
||||||
|
{
|
||||||
|
if ($this->_form === null) {
|
||||||
|
$this->_form = new ClientForm();
|
||||||
|
$this->_form->setAttributes([
|
||||||
|
'pk_field' => $this->model->getPKField(),
|
||||||
|
'title_field' => $this->model->getTitleField(),
|
||||||
|
'table' => $this->model->getTable(),
|
||||||
|
'useAutoIncrement' => $this->model->useAutoIncrement(),
|
||||||
|
'class_path' => $this->getClassPaths(false)
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
return $this->_form;
|
||||||
|
}
|
||||||
|
public function getHelper(): ClientHelper
|
||||||
|
{
|
||||||
|
if ($this->_helper === null) {
|
||||||
|
$this->_helper = new ClientHelper();
|
||||||
|
$this->_helper->setAttributes([
|
||||||
|
'pk_field' => $this->model->getPKField(),
|
||||||
|
'title_field' => $this->model->getTitleField(),
|
||||||
|
'table' => $this->model->getTable(),
|
||||||
|
'useAutoIncrement' => $this->model->useAutoIncrement(),
|
||||||
|
'class_path' => $this->getClassPaths(false)
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
return $this->_helper;
|
||||||
|
}
|
||||||
|
//기본 기능부분
|
||||||
|
protected function getEntity_process(mixed $entity): ClientEntity
|
||||||
|
{
|
||||||
|
return $entity;
|
||||||
|
}
|
||||||
|
protected function create_process(array $formDatas): ClientEntity
|
||||||
|
{
|
||||||
|
return new ClientEntity($formDatas);
|
||||||
|
}
|
||||||
|
public function create(object $dto): ClientEntity
|
||||||
|
{
|
||||||
|
if (!$dto instanceof ClientDTO) {
|
||||||
|
throw new RuntimeException(__METHOD__ . "에서 오류발생:" . get_class($dto) . "는 사용할수 없습니다.");
|
||||||
|
}
|
||||||
|
$entity = parent::create($dto);
|
||||||
|
if (!$entity instanceof ClientEntity) {
|
||||||
|
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 ClientEntity만 가능");
|
||||||
|
}
|
||||||
|
return $entity;
|
||||||
|
}
|
||||||
|
protected function modify_process($uid, array $formDatas): ClientEntity
|
||||||
|
{
|
||||||
|
$entity = parent::modify_process($uid, $formDatas);
|
||||||
|
if (!$entity instanceof ClientEntity) {
|
||||||
|
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 ClientEntity만 가능");
|
||||||
|
}
|
||||||
|
return $entity;
|
||||||
|
}
|
||||||
|
public function modify($uid, object $dto): ClientEntity
|
||||||
|
{
|
||||||
|
if (!$dto instanceof ClientDTO) {
|
||||||
|
throw new RuntimeException(__METHOD__ . "에서 오류발생:" . get_class($dto) . "는 사용할수 없습니다.");
|
||||||
|
}
|
||||||
|
$entity = parent::modify($uid, $dto);
|
||||||
|
if (!$entity instanceof ClientEntity) {
|
||||||
|
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 ClientEntity만 가능");
|
||||||
|
}
|
||||||
|
return $entity;
|
||||||
|
}
|
||||||
|
//List 검색용
|
||||||
|
//FormFilter 조건절 처리
|
||||||
|
//검색어조건절처리
|
||||||
|
public function setSearchWord(string $word): void
|
||||||
|
{
|
||||||
|
$this->model->orLike($this->model->getTable() . '.alias', $word, 'both');
|
||||||
|
parent::setSearchWord($word);
|
||||||
|
}
|
||||||
|
//OrderBy 처리
|
||||||
|
public function setOrderBy(mixed $field = null, mixed $value = null): void
|
||||||
|
{
|
||||||
|
$this->model->orderBy("site ASC,name ASC");
|
||||||
|
parent::setOrderBy($field, $value);
|
||||||
|
}
|
||||||
|
}
|
||||||
95
app/Services/Customer/CouponService.php
Normal file
95
app/Services/Customer/CouponService.php
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Services\Customer;
|
||||||
|
|
||||||
|
use App\DTOs\Customer\CouponDTO;
|
||||||
|
use App\Entities\Customer\CouponEntity;
|
||||||
|
use App\Forms\Customer\CouponForm;
|
||||||
|
use App\Helpers\Customer\CouponHelper;
|
||||||
|
use App\Models\Customer\CouponModel;
|
||||||
|
use RuntimeException;
|
||||||
|
|
||||||
|
class CouponService extends CustomerService
|
||||||
|
{
|
||||||
|
private $_form = null;
|
||||||
|
private $_helper = null;
|
||||||
|
public function __construct(CouponModel $model)
|
||||||
|
{
|
||||||
|
parent::__construct($model);
|
||||||
|
$this->addClassPaths('Coupon');
|
||||||
|
}
|
||||||
|
public function createDTO(array $formDatas): CouponDTO
|
||||||
|
{
|
||||||
|
return new CouponDTO($formDatas);
|
||||||
|
}
|
||||||
|
public function getFormService(): CouponForm
|
||||||
|
{
|
||||||
|
if ($this->_form === null) {
|
||||||
|
$this->_form = new CouponForm();
|
||||||
|
$this->_form->setAttributes([
|
||||||
|
'pk_field' => $this->model->getPKField(),
|
||||||
|
'title_field' => $this->model->getTitleField(),
|
||||||
|
'table' => $this->model->getTable(),
|
||||||
|
'useAutoIncrement' => $this->model->useAutoIncrement(),
|
||||||
|
'class_path' => $this->getClassPaths(false)
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
return $this->_form;
|
||||||
|
}
|
||||||
|
public function getHelper(): CouponHelper
|
||||||
|
{
|
||||||
|
if ($this->_helper === null) {
|
||||||
|
$this->_helper = new CouponHelper();
|
||||||
|
$this->_helper->setAttributes([
|
||||||
|
'pk_field' => $this->model->getPKField(),
|
||||||
|
'title_field' => $this->model->getTitleField(),
|
||||||
|
'table' => $this->model->getTable(),
|
||||||
|
'useAutoIncrement' => $this->model->useAutoIncrement(),
|
||||||
|
'class_path' => $this->getClassPaths(false)
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
return $this->_helper;
|
||||||
|
}
|
||||||
|
//기본 기능부분
|
||||||
|
protected function getEntity_process(mixed $entity): CouponEntity
|
||||||
|
{
|
||||||
|
return $entity;
|
||||||
|
}
|
||||||
|
protected function create_process(array $formDatas): CouponEntity
|
||||||
|
{
|
||||||
|
return new CouponEntity($formDatas);
|
||||||
|
}
|
||||||
|
public function create(object $dto): CouponEntity
|
||||||
|
{
|
||||||
|
if (!$dto instanceof CouponDTO) {
|
||||||
|
throw new RuntimeException(__METHOD__ . "에서 오류발생:" . get_class($dto) . "는 사용할수 없습니다.");
|
||||||
|
}
|
||||||
|
$entity = parent::create($dto);
|
||||||
|
if (!$entity instanceof CouponEntity) {
|
||||||
|
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 CouponEntity만 가능");
|
||||||
|
}
|
||||||
|
return $entity;
|
||||||
|
}
|
||||||
|
protected function modify_process($uid, array $formDatas): CouponEntity
|
||||||
|
{
|
||||||
|
$entity = parent::modify_process($uid, $formDatas);
|
||||||
|
if (!$entity instanceof CouponEntity) {
|
||||||
|
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 CouponEntity만 가능");
|
||||||
|
}
|
||||||
|
return $entity;
|
||||||
|
}
|
||||||
|
public function modify($uid, object $dto): CouponEntity
|
||||||
|
{
|
||||||
|
if (!$dto instanceof CouponDTO) {
|
||||||
|
throw new RuntimeException(__METHOD__ . "에서 오류발생:" . get_class($dto) . "는 사용할수 없습니다.");
|
||||||
|
}
|
||||||
|
$entity = parent::modify($uid, $dto);
|
||||||
|
if (!$entity instanceof CouponEntity) {
|
||||||
|
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 CouponEntity만 가능");
|
||||||
|
}
|
||||||
|
return $entity;
|
||||||
|
}
|
||||||
|
//List 검색용
|
||||||
|
//FormFilter 조건절 처리
|
||||||
|
//검색어조건절처리
|
||||||
|
}
|
||||||
15
app/Services/Customer/CustomerService.php
Normal file
15
app/Services/Customer/CustomerService.php
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Services\Customer;
|
||||||
|
|
||||||
|
use App\Models\CommonModel;
|
||||||
|
use App\Services\CommonService;
|
||||||
|
|
||||||
|
abstract class CustomerService extends CommonService
|
||||||
|
{
|
||||||
|
protected function __construct(CommonModel $model)
|
||||||
|
{
|
||||||
|
parent::__construct($model);
|
||||||
|
$this->addClassPaths('Customer');
|
||||||
|
}
|
||||||
|
}
|
||||||
95
app/Services/Customer/PointService.php
Normal file
95
app/Services/Customer/PointService.php
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Services\Customer;
|
||||||
|
|
||||||
|
use App\DTOs\Customer\PointDTO;
|
||||||
|
use App\Entities\Customer\PointEntity;
|
||||||
|
use App\Forms\Customer\PointForm;
|
||||||
|
use App\Helpers\Customer\PointHelper;
|
||||||
|
use App\Models\Customer\PointModel;
|
||||||
|
use RuntimeException;
|
||||||
|
|
||||||
|
class PointService extends CustomerService
|
||||||
|
{
|
||||||
|
private $_form = null;
|
||||||
|
private $_helper = null;
|
||||||
|
public function __construct(PointModel $model)
|
||||||
|
{
|
||||||
|
parent::__construct($model);
|
||||||
|
$this->addClassPaths('Point');
|
||||||
|
}
|
||||||
|
public function createDTO(array $formDatas): PointDTO
|
||||||
|
{
|
||||||
|
return new PointDTO($formDatas);
|
||||||
|
}
|
||||||
|
public function getFormService(): PointForm
|
||||||
|
{
|
||||||
|
if ($this->_form === null) {
|
||||||
|
$this->_form = new PointForm();
|
||||||
|
$this->_form->setAttributes([
|
||||||
|
'pk_field' => $this->model->getPKField(),
|
||||||
|
'title_field' => $this->model->getTitleField(),
|
||||||
|
'table' => $this->model->getTable(),
|
||||||
|
'useAutoIncrement' => $this->model->useAutoIncrement(),
|
||||||
|
'class_path' => $this->getClassPaths(false)
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
return $this->_form;
|
||||||
|
}
|
||||||
|
public function getHelper(): PointHelper
|
||||||
|
{
|
||||||
|
if ($this->_helper === null) {
|
||||||
|
$this->_helper = new PointHelper();
|
||||||
|
$this->_helper->setAttributes([
|
||||||
|
'pk_field' => $this->model->getPKField(),
|
||||||
|
'title_field' => $this->model->getTitleField(),
|
||||||
|
'table' => $this->model->getTable(),
|
||||||
|
'useAutoIncrement' => $this->model->useAutoIncrement(),
|
||||||
|
'class_path' => $this->getClassPaths(false)
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
return $this->_helper;
|
||||||
|
}
|
||||||
|
//기본 기능부분
|
||||||
|
protected function getEntity_process(mixed $entity): PointEntity
|
||||||
|
{
|
||||||
|
return $entity;
|
||||||
|
}
|
||||||
|
protected function create_process(array $formDatas): PointEntity
|
||||||
|
{
|
||||||
|
return new PointEntity($formDatas);
|
||||||
|
}
|
||||||
|
public function create(object $dto): PointEntity
|
||||||
|
{
|
||||||
|
if (!$dto instanceof PointDTO) {
|
||||||
|
throw new RuntimeException(__METHOD__ . "에서 오류발생:" . get_class($dto) . "는 사용할수 없습니다.");
|
||||||
|
}
|
||||||
|
$entity = parent::create($dto);
|
||||||
|
if (!$entity instanceof PointEntity) {
|
||||||
|
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 PointEntity만 가능");
|
||||||
|
}
|
||||||
|
return $entity;
|
||||||
|
}
|
||||||
|
protected function modify_process($uid, array $formDatas): PointEntity
|
||||||
|
{
|
||||||
|
$entity = parent::modify_process($uid, $formDatas);
|
||||||
|
if (!$entity instanceof PointEntity) {
|
||||||
|
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 PointEntity만 가능");
|
||||||
|
}
|
||||||
|
return $entity;
|
||||||
|
}
|
||||||
|
public function modify($uid, object $dto): PointEntity
|
||||||
|
{
|
||||||
|
if (!$dto instanceof PointDTO) {
|
||||||
|
throw new RuntimeException(__METHOD__ . "에서 오류발생:" . get_class($dto) . "는 사용할수 없습니다.");
|
||||||
|
}
|
||||||
|
$entity = parent::modify($uid, $dto);
|
||||||
|
if (!$entity instanceof PointEntity) {
|
||||||
|
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 PointEntity만 가능");
|
||||||
|
}
|
||||||
|
return $entity;
|
||||||
|
}
|
||||||
|
//List 검색용
|
||||||
|
//FormFilter 조건절 처리
|
||||||
|
//검색어조건절처리
|
||||||
|
}
|
||||||
111
app/Services/PaymentService.php
Normal file
111
app/Services/PaymentService.php
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Services;
|
||||||
|
|
||||||
|
use App\DTOs\PaymentDTO;
|
||||||
|
use App\Entities\PaymentEntity;
|
||||||
|
use App\Forms\PaymentForm;
|
||||||
|
use App\Helpers\PaymentHelper;
|
||||||
|
use App\Models\PaymentModel;
|
||||||
|
use RuntimeException;
|
||||||
|
|
||||||
|
class PaymentService extends CommonService
|
||||||
|
{
|
||||||
|
private $_form = null;
|
||||||
|
private $_helper = null;
|
||||||
|
public function __construct(PaymentModel $model)
|
||||||
|
{
|
||||||
|
parent::__construct($model);
|
||||||
|
$this->addClassPaths('Payment');
|
||||||
|
}
|
||||||
|
public function createDTO(array $formDatas): PaymentDTO
|
||||||
|
{
|
||||||
|
return new PaymentDTO($formDatas);
|
||||||
|
}
|
||||||
|
public function getFormService(): PaymentForm
|
||||||
|
{
|
||||||
|
if ($this->_form === null) {
|
||||||
|
$this->_form = new PaymentForm();
|
||||||
|
$this->_form->setAttributes([
|
||||||
|
'pk_field' => $this->model->getPKField(),
|
||||||
|
'title_field' => $this->model->getTitleField(),
|
||||||
|
'table' => $this->model->getTable(),
|
||||||
|
'useAutoIncrement' => $this->model->useAutoIncrement(),
|
||||||
|
'class_path' => $this->getClassPaths(false)
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
return $this->_form;
|
||||||
|
}
|
||||||
|
public function getHelper(): PaymentHelper
|
||||||
|
{
|
||||||
|
if ($this->_helper === null) {
|
||||||
|
$this->_helper = new PaymentHelper();
|
||||||
|
$this->_helper->setAttributes([
|
||||||
|
'pk_field' => $this->model->getPKField(),
|
||||||
|
'title_field' => $this->model->getTitleField(),
|
||||||
|
'table' => $this->model->getTable(),
|
||||||
|
'useAutoIncrement' => $this->model->useAutoIncrement(),
|
||||||
|
'class_path' => $this->getClassPaths(false)
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
return $this->_helper;
|
||||||
|
}
|
||||||
|
//기본 기능부분
|
||||||
|
protected function getEntity_process(mixed $entity): PaymentEntity
|
||||||
|
{
|
||||||
|
return $entity;
|
||||||
|
}
|
||||||
|
protected function create_process(array $formDatas): PaymentEntity
|
||||||
|
{
|
||||||
|
//confirmpassword 필드는 Entity에 필요없으므로 제거
|
||||||
|
if (isset($formDatas['confirmpassword'])) {
|
||||||
|
unset($formDatas['confirmpassword']);
|
||||||
|
}
|
||||||
|
return new PaymentEntity($formDatas);
|
||||||
|
}
|
||||||
|
public function create(object $dto): PaymentEntity
|
||||||
|
{
|
||||||
|
if (!$dto instanceof PaymentDTO) {
|
||||||
|
throw new RuntimeException(__METHOD__ . "에서 오류발생:" . get_class($dto) . "는 사용할수 없습니다.");
|
||||||
|
}
|
||||||
|
return parent::create($dto);
|
||||||
|
}
|
||||||
|
protected function modify_process($uid, array $formDatas): PaymentEntity
|
||||||
|
{
|
||||||
|
//confirmpassword 필드는 Entity에 필요없으므로 제거
|
||||||
|
if (isset($formDatas['confirmpassword'])) {
|
||||||
|
unset($formDatas['confirmpassword']);
|
||||||
|
}
|
||||||
|
return parent::modify_process($uid, $formDatas);
|
||||||
|
}
|
||||||
|
public function modify($uid, object $dto): PaymentEntity
|
||||||
|
{
|
||||||
|
if (!$dto instanceof PaymentDTO) {
|
||||||
|
throw new RuntimeException(__METHOD__ . "에서 오류발생:" . get_class($dto) . "는 사용할수 없습니다.");
|
||||||
|
}
|
||||||
|
return parent::modify($uid, $dto);
|
||||||
|
}
|
||||||
|
//List 검색용
|
||||||
|
//FormFilter 조건절 처리
|
||||||
|
public function setFilter(string $field, mixed $filter_value): void
|
||||||
|
{
|
||||||
|
switch ($field) {
|
||||||
|
case 'role':
|
||||||
|
//FIND_IN_SET()은 MySQL 함수이므로 CodeIgniter가 이를 일반 컬럼명으로 착각하고 escape하게 되면 오류가 발생
|
||||||
|
// 따라서 ->where($sql, null, false)로 명시하여 escape를 꺼줘야 정상 작동
|
||||||
|
$where = "FIND_IN_SET(" . $this->model->escape($filter_value) . ", {$this->model->getTable()}.{$field}) > 0";
|
||||||
|
$this->model->where($where, null, false);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
parent::setFilter($field, $filter_value);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//검색어조건절처리
|
||||||
|
public function setSearchWord(string $word): void
|
||||||
|
{
|
||||||
|
$this->model->orLike($this->model->getTable() . '.id', $word, 'both');
|
||||||
|
$this->model->orLike($this->model->getTable() . '.email', $word, 'both');
|
||||||
|
parent::setSearchWord($word);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user